結果

問題 No.154 市バス
ユーザー ああいいああいい
提出日時 2022-01-28 15:52:37
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 600 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 82,452 KB
実行使用メモリ 76,520 KB
最終ジャッジ日時 2024-12-29 12:38:56
合計ジャッジ時間 1,944 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other WA * 2 MLE * 6
権限があれば一括ダウンロードができます

ソースコード

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