結果

問題 No.154 市バス
ユーザー tikitaka1201tikitaka1201
提出日時 2020-09-16 21:00:11
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 446 bytes
コンパイル時間 409 ms
コンパイル使用メモリ 10,764 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2023-09-04 03:56:51
合計ジャッジ時間 3,221 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 288 ms
7,832 KB
testcase_01 AC 288 ms
7,792 KB
testcase_02 AC 282 ms
7,760 KB
testcase_03 AC 214 ms
7,840 KB
testcase_04 AC 272 ms
7,844 KB
testcase_05 WA -
testcase_06 AC 16 ms
7,768 KB
testcase_07 AC 349 ms
7,764 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
for _ in range(t):
    flg=True
    s=list(input())
    n=len(s)
    w=0
    g=0
    r=0
    for i in range(n):
        if s[i]=='W': w+=1
        elif s[i]=='G': 
            g+=1
            w-=1
        elif s[i]=='R': 
            r+=1
            g-=1
        if w<0 or g<0:
            flg=False
            break
    if flg==False or r==0 or g>0 or s[-1]=='W':
        print('impossible')
    else:
        print('possible')
0