結果

問題 No.154 市バス
ユーザー syunsuke
提出日時 2019-08-10 22:17:41
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-19 17:25:34
合計ジャッジ時間 3,082 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 6 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
for i in range(N):
    r=0
    g=0
    S=list(input())
    F=1
    for j in range(len(S)):
        if S[j]=="R":
            r+=1
        elif S[j]=="G":
            g+=1
        if r>g:
            print("impossible")
            F=0
            break
    if r==g and S[-1]=="R" and F==1:
        print("possible")
    elif F==1:
        print("impossible")
0