結果

問題 No.154 市バス
ユーザー ntudantuda
提出日時 2024-01-05 00:18:58
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 571 bytes
コンパイル時間 2,721 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 75,936 KB
最終ジャッジ日時 2024-01-05 00:19:08
合計ジャッジ時間 1,851 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

for j in range(int(input())):
    #print(j)
    W,R,G = 0,0,0
    lastw = 0
    lastg = 0
    S = input()
    for i,s in enumerate(S):
        if s == "W":
            W += 1
            lastw = i
        if s == "R":
            R += 1
        if s == "G":
            G += 1
            lastg = i
        if W < G or G < R:
            print("impossible")
            break

    else:
        if lastw > lastg:
            print("impossible")
            continue
        if R == G and R > 0:
            print("possible")
        else:
            print("impossible")
0