結果

問題 No.154 市バス
ユーザー JunOnuma
提出日時 2017-05-18 19:03:04
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 90 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 09:03:11
合計ジャッジ時間 1,632 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

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