結果

問題 No.154 市バス
ユーザー ayaoniayaoni
提出日時 2020-11-27 14:20:58
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-07-23 21:35:59
合計ジャッジ時間 2,553 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 1
other AC * 5 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def I(): return int(sys.stdin.readline().rstrip())
def S(): return sys.stdin.readline().rstrip()


T = I()
for _ in range(T):
    U = S()[::-1]
    r,g,w = 0,0,0
    for u in U:
        if u == 'R':
            r += 1
        elif u == 'G':
            g += 1
        else:
            w += 1
        if r < g:
            print('impossible')
            break
    else:
        if r != g or w < r:
            print('impossible')
        else:
            print('possible')
0