結果

問題 No.154 市バス
ユーザー H3PO4H3PO4
提出日時 2020-05-06 23:29:14
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 299 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 10,632 KB
実行使用メモリ 8,024 KB
最終ジャッジ日時 2023-09-16 07:37:42
合計ジャッジ時間 1,211 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
7,928 KB
testcase_01 AC 69 ms
7,972 KB
testcase_02 AC 71 ms
7,872 KB
testcase_03 AC 55 ms
7,836 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 65 ms
7,872 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(S):
    ct = 0
    for s in S:
        if s == 'G':
            ct += 1
        elif s == 'R':
            ct -= 1
            if ct < 0:
                return 'impossible'
    return 'possible' if ct == 0 else 'impossible'


N = int(input())
for _ in range(N):
    print(solve(input()))
0