結果

問題 No.154 市バス
ユーザー roarisroaris
提出日時 2019-07-27 10:55:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 458 bytes
コンパイル時間 72 ms
コンパイル使用メモリ 10,676 KB
実行使用メモリ 7,924 KB
最終ジャッジ日時 2023-09-15 05:59:17
合計ジャッジ時間 3,250 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 289 ms
7,840 KB
testcase_01 AC 306 ms
7,796 KB
testcase_02 AC 301 ms
7,892 KB
testcase_03 AC 216 ms
7,836 KB
testcase_04 AC 282 ms
7,780 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 301 ms
7,772 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

T = int(input())

for _ in range(T):
    S = input()
    W_cnt, G_cnt, R_cnt = 0, 0, 0
    
    for S_i in S:
        if S_i == 'W':
            W_cnt += 1
        if S_i == 'G':
            G_cnt += 1
        if S_i == 'R':
            R_cnt += 1
    
        if W_cnt < G_cnt or G_cnt < R_cnt:
            print('impossible')
            break
    else:
        if G_cnt == R_cnt:
            print('possible')
        else:
            print('impossible')
0