結果
問題 |
No.154 市バス
|
ユーザー |
|
提出日時 | 2020-05-06 23:50:10 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 448 bytes |
コンパイル時間 | 312 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-07-03 09:13:32 |
合計ジャッジ時間 | 2,748 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 1 |
ソースコード
def solve(S): d = {'W': 0, 'G': 0, 'R': 0} for s in reversed(S): if s == 'G' and d['R'] == 0: return False elif s == 'W' and d['G'] == 0: return False d[s] += 1 if d['G'] > d['R']: return False return True if d['W'] >= d['G'] == d['R'] and 0 not in d.values() else False N = int(input()) for _ in range(N): print('possible' if solve(input()) else 'impossible')