結果

問題 No.154 市バス
ユーザー HachimoriHachimori
提出日時 2015-02-18 00:10:06
言語 Python2
(2.7.18)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-04-21 07:50:30
合計ジャッジ時間 2,924 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 296 ms
6,400 KB
testcase_01 AC 303 ms
6,400 KB
testcase_02 AC 293 ms
6,272 KB
testcase_03 AC 217 ms
6,400 KB
testcase_04 AC 282 ms
6,400 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 302 ms
6,400 KB
testcase_08 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8


def read():
    return raw_input()


def work(s):
    chList = "WGR"

    val = [0, 0, 0]
    for ch in s:
        val[chList.find(ch)] += 1
        if not (val[0] >= val[1] >= val[2]):
            print "impossible"
            return

    print "possible" if val[0] >= val[1] and val[1] == val[2] else "impossible"


if __name__ == "__main__":
    for i in range(input()):
        work(read())
0