結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2016-10-22 12:08:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 104 ms / 2,000 ms |
コード長 | 583 bytes |
コンパイル時間 | 251 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-13 08:45:55 |
合計ジャッジ時間 | 1,557 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
#!/usr/bin/env python3def is_possible(s):w0 = 0w1 = Falseg = 0r = 0for c in s:if c == 'W':w0 += 1w1 = Trueelif c == 'G':if not w0:return Falsew1 = Falsew0 -= 1g += 1elif c == 'R':if not g:return Falseg -= 1r += 1if w1 or g:return Falsereturn Truet = int(input())for _ in range(t):s = input()print('possible' if is_possible(s) else 'impossible')