結果

問題 No.154 市バス
ユーザー tktk_snsntktk_snsn
提出日時 2021-02-09 20:27:15
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 430 bytes
コンパイル時間 277 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 77,656 KB
最終ジャッジ日時 2023-09-21 08:07:46
合計ジャッジ時間 2,479 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 MLE -
testcase_01 MLE -
testcase_02 MLE -
testcase_03 MLE -
testcase_04 MLE -
testcase_05 MLE -
testcase_06 MLE -
testcase_07 MLE -
testcase_08 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)


def main():
    S = input().rstrip()
    G = 0
    for s in S:
        if s == "G":
            G += 1
        elif s == "R":
            if not G:
                print("impossible")
                return
            G -= 1
    if G:
        print("impossible")
    else:
        print("possible")
    return


T = int(input())
for _ in range(T):
    main()
0