結果

問題 No.154 市バス
ユーザー roiti46roiti46
提出日時 2015-02-17 23:34:48
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 379 bytes
コンパイル時間 192 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-04-21 07:35:58
合計ジャッジ時間 2,251 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
6,272 KB
testcase_01 AC 186 ms
6,144 KB
testcase_02 AC 184 ms
6,272 KB
testcase_03 AC 131 ms
6,272 KB
testcase_04 WA -
testcase_05 AC 11 ms
6,272 KB
testcase_06 AC 9 ms
6,272 KB
testcase_07 AC 175 ms
6,144 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(raw_input())
for loop in xrange(T):
    S = raw_input()
    w = last = 0
    for s in S:
        if   s == "G":
            last += 1
            w = 0
        elif s == "R":
            last -= 1
        else:
            w += 1
        if last < 0:
            print "impossible"
            break
    else:
        print "possible" if last == w == 0 else "impossible"
0