結果

問題 No.154 市バス
コンテスト
ユーザー JunOnuma
提出日時 2017-05-18 19:03:04
言語 PyPy2
(7.3.15)
結果
MLE  
実行時間 -
コード長 374 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 150 ms
コンパイル使用メモリ 77,572 KB
最終ジャッジ日時 2025-12-03 23:46:01
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 1
other MLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

t = int(raw_input())
for _ in range(t):
    s = raw_input()
    ans = True
    cnt = 0
    for c in s:
        if c == 'G':
            cnt += 1
        elif c == 'R':
            cnt -= 1
            if cnt < 0:
                ans = False
                break
    if cnt != 0:
        ans = False
    if ans:
        print 'possible'
    else:
        print 'impossible'
0