結果

問題 No.154 市バス
ユーザー lllllll88938494lllllll88938494
提出日時 2022-06-02 13:33:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 429 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 11,860 KB
実行使用メモリ 10,152 KB
最終ジャッジ日時 2023-10-21 01:06:53
合計ジャッジ時間 3,668 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 429 ms
10,152 KB
testcase_01 AC 402 ms
10,152 KB
testcase_02 AC 424 ms
10,152 KB
testcase_03 AC 404 ms
10,152 KB
testcase_04 AC 412 ms
10,152 KB
testcase_05 AC 27 ms
10,136 KB
testcase_06 AC 28 ms
10,136 KB
testcase_07 AC 402 ms
10,152 KB
testcase_08 AC 26 ms
10,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
#n=1

for i in range(n):
    s=input()
    g=0
    r=0
    w=0
    w2=0
    f=1
    se=set()
    for i in s:
        se.add(i)
        if i == 'W':
            w+=1
            w2+=1
        elif i == 'G':
            g+=1
            w2 = 2
        elif i == 'R':
            r+=1
            w2%=2
        if (g - r) < 0:
            f = 0
        if (w-g) < 0:
            f = 0
                
    if ((g-r) != 0) or (f == 0) or (len(se) == 1) or (len(s) < 3) or (w<g) or (w2!=0):
        #print(((g-r) != 0) , (f == 0) , (len(se) == 1) , (len(s) < 3) , (w<g) , (w2!=0),w2,g,r)
        print('impossible')
    else:
        print('possible')
0