結果
問題 | No.232 めぐるはめぐる (2) |
ユーザー | 綾地寧々 |
提出日時 | 2015-06-26 23:18:12 |
言語 | PHP (8.3.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,007 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 18,836 KB |
実行使用メモリ | 25,088 KB |
最終ジャッジ日時 | 2023-09-22 01:35:32 |
合計ジャッジ時間 | 4,336 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 271 ms
22,964 KB |
testcase_01 | AC | 291 ms
25,016 KB |
testcase_02 | WA | - |
testcase_03 | AC | 268 ms
22,948 KB |
testcase_04 | AC | 15 ms
18,896 KB |
testcase_05 | AC | 15 ms
18,900 KB |
testcase_06 | AC | 15 ms
18,868 KB |
testcase_07 | AC | 15 ms
18,900 KB |
testcase_08 | AC | 207 ms
25,088 KB |
testcase_09 | AC | 15 ms
18,828 KB |
testcase_10 | AC | 15 ms
18,880 KB |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | AC | 15 ms
18,988 KB |
testcase_15 | AC | 15 ms
18,944 KB |
testcase_16 | AC | 14 ms
18,904 KB |
testcase_17 | AC | 15 ms
18,936 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | AC | 15 ms
18,848 KB |
testcase_22 | AC | 15 ms
18,848 KB |
testcase_23 | AC | 14 ms
18,816 KB |
testcase_24 | AC | 15 ms
18,988 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; }