結果

問題 No.154 市バス
ユーザー JunOnumaJunOnuma
提出日時 2017-05-19 14:32:26
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 500 bytes
コンパイル時間 48 ms
コンパイル使用メモリ 6,736 KB
実行使用メモリ 6,060 KB
最終ジャッジ日時 2023-08-03 12:20:37
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 170 ms
6,048 KB
testcase_01 AC 169 ms
5,996 KB
testcase_02 AC 174 ms
5,924 KB
testcase_03 AC 144 ms
5,992 KB
testcase_04 WA -
testcase_05 AC 11 ms
6,060 KB
testcase_06 AC 11 ms
5,860 KB
testcase_07 AC 164 ms
6,048 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(raw_input())
for _ in range(t):
    l = list(raw_input())
    l.reverse()
    ans = True
    r = 0
    g = 0
    for c in l:
        if c == 'G':
            g += 1
            if g > r:
                ans = False
                break
        elif c == 'R':
            r += 1
        elif c == 'W':
            if g == 0:
                ans = False
                break
    if ans and r != g:
        ans = False
    if ans:
        print 'possible'
    else:
        print 'impossible'
0