結果

問題 No.154 市バス
ユーザー 👑 SPD_9X2
提出日時 2025-10-04 18:37:22
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 461 bytes
コンパイル時間 944 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 77,076 KB
最終ジャッジ日時 2025-10-04 18:37:25
合計ジャッジ時間 2,644 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 2 MLE * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

TT = int(input())

for loop in range(TT):

    S = input()

    ans = "possible"

    a = [0,0]
    for v in reversed(S):
        if v == "R":
            a[0] += 1
        if v == "G":
            if a[0] == 0:
                ans = "impossible"
                break
            else:
                a[0] -= 1
                a[1] += 1
        if v == "W":
            if a[1] == 0:
                ans = "impossible"
                break

    print (ans)
0