結果

問題 No.154 市バス
ユーザー steek79steek79
提出日時 2015-10-14 15:38:48
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 653 bytes
コンパイル時間 119 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-21 08:50:09
合計ジャッジ時間 6,497 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 801 ms
6,400 KB
testcase_01 AC 800 ms
6,272 KB
testcase_02 AC 797 ms
6,272 KB
testcase_03 AC 149 ms
6,400 KB
testcase_04 WA -
testcase_05 AC 10 ms
6,272 KB
testcase_06 AC 10 ms
6,400 KB
testcase_07 AC 1,581 ms
6,272 KB
testcase_08 AC 10 ms
6,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def check(str):
    if str.count('R') != str.count('G'):
        return 'impossible'
    elif str.count('W') < str.count('R'):
        return 'impossible'
    lines = [0] * str.count('R')
    for s in str:
        if s == 'W':
            if 0 not in lines:
                return 'impossible'
        elif s == 'G':
            try:
                lines[lines.index(0)] = 1
            except:
                return 'impossible'
        elif s == 'R':
            try:
                lines[lines.index(1)] = 2
            except:
                return 'impossible'

    return 'possible'

T = input()
for t in range(T):
    print check(raw_input())
0