結果

問題 No.154 市バス
コンテスト
ユーザー IJKTanabe
提出日時 2019-09-04 14:05:32
言語 Python3
(3.15.2 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
WA  
実行時間 -
コード長 396 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 53 ms
コンパイル使用メモリ 14,848 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2026-10-08 07:56:20
合計ジャッジ時間 2,373 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 4 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

count = int(input())
result = []

for i in range(count):
    memo = input()
    judge = 0
    for char in reversed(memo):
        if char == 'R':
            judge += 1
        elif char == 'G':
            judge -= 1
        
        if judge < 0:
            break
    if judge < 0:
        result.append("impossible")
    else:
        result.append("possible")
for r in result:
    print(r)
 
0