結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2015-10-14 15:38:48 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 653 bytes |
コンパイル時間 | 397 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-10-13 07:42:14 |
合計ジャッジ時間 | 6,925 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 1 |
ソースコード
def check(str): if str.count('R') != str.count('G'): return 'impossible' elif str.count('W') < str.count('R'): return 'impossible' lines = [0] * str.count('R') for s in str: if s == 'W': if 0 not in lines: return 'impossible' elif s == 'G': try: lines[lines.index(0)] = 1 except: return 'impossible' elif s == 'R': try: lines[lines.index(1)] = 2 except: return 'impossible' return 'possible' T = input() for t in range(T): print check(raw_input())