結果

問題 No.154 市バス
ユーザー Mr.Fuku
提出日時 2018-08-05 14:33:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 522 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-09-19 18:02:47
合計ジャッジ時間 2,163 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 7 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())

for i in range(n):
    flag_w = True
    green = 0
    for right in input():
        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