結果

問題 No.154 市バス
ユーザー titia
提出日時 2022-03-22 00:07:38
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 377 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-10-09 15:24:58
合計ジャッジ時間 3,505 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 6 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

T=int(input())
for tests in range(T):
    S=input()

    W=0
    G=0
    R=0
    flag=1

    for s in S:
        if s=="G":
            G+=1
        elif s=="R":
            R+=1
        else:
            W+=1
        if G<R:
            flag=0
        if W<G or W<R:
            flag=0

    if G==R and flag==1:
        print("possible")
    else:
        print("impossible")
0