結果

問題 No.154 市バス
ユーザー yaoshimaxyaoshimax
提出日時 2015-02-19 02:29:12
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-21 08:12:04
合計ジャッジ時間 2,626 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 280 ms
6,400 KB
testcase_01 AC 274 ms
6,400 KB
testcase_02 AC 275 ms
6,400 KB
testcase_03 WA -
testcase_04 AC 259 ms
6,272 KB
testcase_05 WA -
testcase_06 AC 10 ms
6,272 KB
testcase_07 AC 304 ms
6,400 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(raw_input())
for i in range(T):
    S=raw_input()
    Wcnt=0
    Gcnt=0
    ok=True
    for s in S:
        if s=='W':
            ok=False
            Wcnt+=1
        if s=='G':
            ok=False
            if Wcnt < 1:
                break
            Wcnt-=1
            Gcnt+=1
        if s=='R':
            if Gcnt <= 0:
                ok=False
                break
            ok=True
            Gcnt-=1
    if ok:
        print 'possible'
    else:
        print 'impossible'
0