結果

問題 No.154 市バス
ユーザー irumo8202irumo8202
提出日時 2022-01-22 17:53:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 412 bytes
コンパイル時間 352 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,012 KB
最終ジャッジ日時 2023-08-18 12:00:29
合計ジャッジ時間 2,649 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 204 ms
7,788 KB
testcase_01 AC 215 ms
7,780 KB
testcase_02 AC 197 ms
7,888 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 185 ms
7,832 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

ans = ["impossible", "possible"]

for _ in range(N):
    S = input()
    rcnt = 0
    gcnt = 0
    wcnt = 0

    flg = True
    for s in S[::-1]:
        if s == "R":
            rcnt += 1
        elif s == "G":
            gcnt += 1
            if gcnt > rcnt:
                flg = False
        elif s == "W":
            wcnt += 1
    if gcnt > wcnt:
        flg = False
    print(ans[flg])
0