結果

問題 No.154 市バス
ユーザー Mr.FukuMr.Fuku
提出日時 2018-08-05 14:38:00
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 603 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 11,876 KB
実行使用メモリ 10,156 KB
最終ジャッジ日時 2023-10-19 22:04:30
合計ジャッジ時間 2,066 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
10,156 KB
testcase_01 AC 171 ms
10,156 KB
testcase_02 AC 170 ms
10,156 KB
testcase_03 AC 133 ms
10,156 KB
testcase_04 WA -
testcase_05 AC 28 ms
10,132 KB
testcase_06 AC 29 ms
10,132 KB
testcase_07 AC 205 ms
10,156 KB
testcase_08 AC 29 ms
10,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

for i in range(n):
    flag_w = True
    green = 0
    buss = input()
    if len(buss)<3:
        print("impossible")
        continue
    for right in buss:
        if right=='W':
            flag_w=False
        elif right=='G':
            green+=1
            flag_w=True
        elif right=='R':
            green-=1
            if green<0:
                print("impossible")
                break
        else:
            print("impossible")
            break
    else:
        if green==0 and flag_w:
            print("possible")
        else:
            print("impossible")
0