結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-09-16 13:44:16 |
| 言語 | PHP (843.2) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,199 bytes |
| コンパイル時間 | 86 ms |
| コンパイル使用メモリ | 30,612 KB |
| 実行使用メモリ | 31,280 KB |
| 最終ジャッジ日時 | 2024-10-13 08:43:44 |
| 合計ジャッジ時間 | 1,245 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 1 |
コンパイルメッセージ
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; }
$rcount = substr_count($str, "R");
$gcount = substr_count($str, "G");
if($rcount < 1 || $gcount < 1 || $rcount != $gcount) { break; }
for($i = 0; $rcount && $gcount; $i++)
{
switch($str[$i])
{
case "R":
$rcount--;
break;
case "G":
$gcount--;
break;
}
if($rcount > $gcount) {break 2;}
}
$ans = "";
break;
}
echo $ans."possible";
echo PHP_EOL;
$trial--;
}