結果

問題 No.154 市バス
ユーザー kyo1kyo1
提出日時 2020-09-04 13:24:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 443 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 7,940 KB
最終ジャッジ日時 2023-08-16 18:48:44
合計ジャッジ時間 2,322 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 180 ms
7,860 KB
testcase_01 AC 181 ms
7,912 KB
testcase_02 AC 175 ms
7,784 KB
testcase_03 AC 176 ms
7,848 KB
testcase_04 WA -
testcase_05 AC 14 ms
7,848 KB
testcase_06 AC 13 ms
7,792 KB
testcase_07 AC 201 ms
7,780 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