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