Submission #1989866


Source Code Expand

<?php
fscanf(STDIN, "%d %d", $numKatana, $monsterHp);
    for($i = 0; $i < $numKatana; $i++){
        fscanf(STDIN, "%d %d", $shakeDmg, $throwDmg);
        $shakeDmgs[] = $shakeDmg;
        $throwDmgs[] = $throwDmg;
    }

    $maxShakeDmg = max($shakeDmgs);

    $bigThrowDmgs = array_filter($throwDmgs,
        function ($throwDmgs) use ($maxShakeDmg) {
            return $throwDmgs > $maxShakeDmg;
        }
    );

    $totalThrowDmg = array_sum($bigThrowDmgs);
    $monsterHpAfterThrow = $monsterHp - $totalThrowDmg;
    if($monsterHpAfterThrow > 0){
        $numAttack = ceil($monsterHpAfterThrow / $maxShakeDmg) + count($bigThrowDmgs);
        echo $numAttack;
    }else {
        $numAttack = count($bigThrowDmgs);
        echo $numAttack;
    }

Submission Info

Submission Time
Task D - Katana Thrower
User okamu
Language PHP (5.6.30)
Score 0
Code Size 780 Byte
Status WA
Exec Time 143 ms
Memory 42356 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 400
Status
AC × 4
AC × 21
WA × 3
Set Name Test Cases
Sample a01, a02, a03, a04
All a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24
Case Name Status Exec Time Memory
a01 AC 13 ms 3956 KB
a02 AC 9 ms 3576 KB
a03 AC 9 ms 3576 KB
a04 AC 9 ms 3576 KB
b05 AC 9 ms 3576 KB
b06 AC 129 ms 32628 KB
b07 AC 9 ms 3576 KB
b08 AC 130 ms 32628 KB
b09 AC 9 ms 3576 KB
b10 AC 9 ms 3576 KB
b11 AC 9 ms 3576 KB
b12 AC 9 ms 3576 KB
b13 AC 137 ms 42356 KB
b14 WA 132 ms 42356 KB
b15 AC 118 ms 32628 KB
b16 AC 119 ms 32628 KB
b17 AC 122 ms 32628 KB
b18 AC 124 ms 32628 KB
b19 AC 141 ms 42356 KB
b20 WA 136 ms 40180 KB
b21 WA 143 ms 41972 KB
b22 AC 141 ms 42356 KB
b23 AC 9 ms 3576 KB
b24 AC 12 ms 4340 KB