結果

問題 No.154 市バス
ユーザー fmhrfmhr
提出日時 2015-02-18 03:30:23
言語 PyPy3
(7.3.15)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 596 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 76,956 KB
最終ジャッジ日時 2024-04-21 08:01:05
合計ジャッジ時間 1,617 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

t = int(input())
ans = []
for i in range(t):
    s = list(input())
    f = 0
    flag = 1
    count_w = 0
    count_g = 0
    count_r = 0
    for wgr in s:
        if wgr == 'W':
            count_w += 1
            flag = 1
        elif wgr == 'G':
            count_g += 1
            flag = 0
        elif wgr == 'R':
            count_r += 1
        if count_g < count_r or count_w < count_g:
            f = 1
            break
    if f == 0 and flag == 0 and count_w >= count_g == count_r:
        ans.append('possible')
    else:
        ans.append('impossible')
for j in ans:
    print(j)
0