結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー |
|
提出日時 | 2015-06-26 23:18:12 |
言語 | PHP (7.2.24) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,007 bytes |
コンパイル時間 | 313 ms |
コンパイル使用メモリ | 16,752 KB |
実行使用メモリ | 23,216 KB |
最終ジャッジ日時 | 2023-07-01 07:29:53 |
合計ジャッジ時間 | 4,485 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 306 ms
19,792 KB |
testcase_01 | AC | 329 ms
23,216 KB |
testcase_02 | WA | - |
testcase_03 | AC | 307 ms
19,848 KB |
testcase_04 | AC | 16 ms
16,924 KB |
testcase_05 | AC | 15 ms
17,176 KB |
testcase_06 | AC | 15 ms
16,928 KB |
testcase_07 | AC | 14 ms
17,072 KB |
testcase_08 | AC | 232 ms
20,736 KB |
testcase_09 | AC | 16 ms
16,984 KB |
testcase_10 | AC | 15 ms
17,008 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 15 ms
17,136 KB |
testcase_15 | AC | 14 ms
17,132 KB |
testcase_16 | AC | 15 ms
17,100 KB |
testcase_17 | AC | 14 ms
17,112 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 15 ms
17,164 KB |
testcase_22 | AC | 14 ms
16,996 KB |
testcase_23 | AC | 14 ms
17,000 KB |
testcase_24 | AC | 14 ms
17,160 KB |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php define("INPUT_UP", "^"); define("INPUT_DOWN", "v"); define("INPUT_LEFT", "<"); define("INPUT_RIGHT", ">"); list($t, $a, $b) = explode(" ",trim(fgets(STDIN))); if ( max($a, $b) > $t ) { echo 'NO'.PHP_EOL; return; } $move_string = array_fill(0,$t,""); // 上方向判定 for ( $i=0; $i<$a; $i++ ) { $move_string[$i] = INPUT_UP.$move_string[$i]; } // 右方向判定 for ( $i=0; $i<$b; $i++ ) { $move_string[$t-$i-1] = INPUT_RIGHT.$move_string[$t-$i-1]; } // 未入力タイミング回数のカウント $no_input_count = 0; foreach ( $move_string as $str ) { if ( strlen($str) == 0 ) { $no_input_count++; } } // 未入力タイミングが奇数回ならあきらめてもらう if ( $no_input_count % 2 ) { echo 'NO'.PHP_EOL; return; } // 答え出力 echo 'YES'.PHP_EOL; foreach ( $move_string as $str ) { if ( strlen($str) > 0 ) { echo $str; } else { if ( !($no_input_count % 2) ) { echo INPUT_RIGHT; } else { echo INPUT_LEFT; } $no_input_count--; } echo PHP_EOL; }