結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 176 ms
7,720 KB
testcase_01 AC 177 ms
7,720 KB
testcase_02 AC 177 ms
7,856 KB
testcase_03 AC 179 ms
7,724 KB
testcase_04 WA -
testcase_05 AC 13 ms
7,952 KB
testcase_06 AC 12 ms
7,804 KB
testcase_07 AC 208 ms
7,768 KB
testcase_08 AC 14 ms
7,716 KB
権限があれば一括ダウンロードができます

ソースコード

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 or len(S) < 3:
        print("impossible")
    else:
        print("possible")
0