結果

問題 No.154 市バス
ユーザー ああいいああいい
提出日時 2022-01-28 15:52:37
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 600 bytes
コンパイル時間 1,223 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 77,436 KB
最終ジャッジ日時 2023-08-28 13:04:32
合計ジャッジ時間 2,104 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())
for _ in range(T):
    S = input()
    w = 0
    g = 0
    r = 0
    flag = True
    for s in S:
        if s == 'W':
            w += 1
        if s == 'G':
            if w == 0:
                print('impposible')
                flag = False
                break
            else:
                w -= 1
        if s == 'R':
            if g == 0:
                print('impposible')
                flag = False
                break
            g -= 1
    if flag:
        if g == 0:
            print('possible')
        else:
            print('impposible')
                
0