結果
問題 | No.154 市バス |
ユーザー | papinianus |
提出日時 | 2016-09-16 13:45:34 |
言語 | PHP (8.3.4) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,341 bytes |
コンパイル時間 | 1,706 ms |
コンパイル使用メモリ | 31,428 KB |
実行使用メモリ | 31,368 KB |
最終ジャッジ日時 | 2024-04-21 09:56:24 |
合計ジャッジ時間 | 1,327 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 85 ms
31,248 KB |
testcase_01 | AC | 86 ms
31,320 KB |
testcase_02 | AC | 83 ms
31,368 KB |
testcase_03 | AC | 53 ms
31,316 KB |
testcase_04 | WA | - |
testcase_05 | AC | 40 ms
31,272 KB |
testcase_06 | AC | 39 ms
31,132 KB |
testcase_07 | AC | 73 ms
31,304 KB |
testcase_08 | AC | 39 ms
30,932 KB |
コンパイルメッセージ
No syntax errors detected in Main.php
ソースコード
<?php $trial = trim(fgets(STDIN)); while($trial) { $ans = "im"; while(true) { $str = trim(fgets(STDIN)); $wpos = strpos($str, "W"); $gpos = strpos($str, "G"); $rpos = strpos($str, "R"); $len = strlen($str); if($wpos !== 0 || $gpos === false || $rpos === false || $gpos < 1 || $rpos < $gpos ) { break; } $str = strrev($str); $len = strlen($str); $wpos = strpos($str, "W"); $gpos = strpos($str, "G"); $rpos = strpos($str, "R"); if($rpos !== 0 || $wpos < $gpos) { break; } $wcount = substr_count($str, "W"); $rcount = substr_count($str, "R"); $gcount = substr_count($str, "G"); if($rcount < 1 || $gcount < 1 || $rcount != $gcount || $wcount < $gcount) { break; } for($i = 0; $rcount && $gcount; $i++) { switch($str[$i]) { case "R": $rcount--; break; case "G": $gcount--; break; case "W": $wcount--; } if($rcount > $gcount || $wcount < $gcount) {break 2;} } $ans = ""; break; } echo $ans."possible"; echo PHP_EOL; $trial--; }