結果

問題 No.154 市バス
ユーザー kyo1kyo1
提出日時 2020-09-04 13:24:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-05-04 02:20:57
合計ジャッジ時間 2,164 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
10,752 KB
testcase_01 AC 200 ms
10,752 KB
testcase_02 AC 197 ms
10,752 KB
testcase_03 AC 213 ms
10,752 KB
testcase_04 WA -
testcase_05 AC 25 ms
10,880 KB
testcase_06 AC 25 ms
10,752 KB
testcase_07 AC 230 ms
10,880 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

for _ in range(int(input())):
    S = input()
    a, b = 0, 0
    f = True
    for s in S[::-1]:
        if s == "G":
            a += 1
            if not a <= b:
                f = False
        if s == "R":
            b += 1
            if not a < b:
                f = False
        if s == "W":
            if not a > 0:
                f = False
    if not f or a != b:
        print("impossible")
    else:
        print("possible")
0