結果

問題 No.154 市バス
ユーザー lllllll88938494lllllll88938494
提出日時 2022-06-02 13:08:50
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 643 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2023-10-21 01:06:44
合計ジャッジ時間 1,642 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 AC 34 ms
53,516 KB
testcase_06 AC 33 ms
53,516 KB
testcase_07 MLE -
testcase_08 AC 34 ms
53,516 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 ((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