結果

問題 No.154 市バス
ユーザー syunsukesyunsuke
提出日時 2019-08-10 22:17:41
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 373 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 7,876 KB
最終ジャッジ日時 2023-09-26 23:41:58
合計ジャッジ時間 3,015 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 234 ms
7,836 KB
testcase_01 AC 237 ms
7,776 KB
testcase_02 AC 231 ms
7,876 KB
testcase_03 AC 172 ms
7,672 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 16 ms
7,840 KB
testcase_07 AC 242 ms
7,820 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

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