結果

問題 No.154 市バス
ユーザー ああいいああいい
提出日時 2022-01-28 15:51:31
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 620 bytes
コンパイル時間 1,184 ms
コンパイル使用メモリ 86,632 KB
実行使用メモリ 77,876 KB
最終ジャッジ日時 2023-08-28 13:04:09
合計ジャッジ時間 3,936 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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