結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2015-02-18 00:28:00 |
言語 | Python2 (2.7.18) |
結果 |
TLE
|
実行時間 | - |
コード長 | 792 bytes |
コンパイル時間 | 216 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 20,288 KB |
最終ジャッジ日時 | 2024-10-13 06:38:28 |
合計ジャッジ時間 | 6,865 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 1 |
other | TLE * 1 -- * 7 |
ソースコード
#!/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 for i in range(len(s)): if s[i] == 'W': isOk = False for j in range(i + 1, len(s)): if s[j] == 'G': isOk = True break if not isOk: print "impossible" return if val[0] >= val[1] and val[1] == val[2] and val[2] > 0 and s[-1] == 'R': print "possible" else: print "impossible" if __name__ == "__main__": for i in range(input()): work(read())