結果
問題 | No.154 市バス |
ユーザー | convexineq |
提出日時 | 2020-12-08 05:50:17 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 303 ms / 2,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 11,916 KB |
実行使用メモリ | 10,172 KB |
最終ジャッジ日時 | 2023-10-17 16:58:11 |
合計ジャッジ時間 | 3,549 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 271 ms
10,172 KB |
testcase_01 | AC | 260 ms
10,172 KB |
testcase_02 | AC | 277 ms
10,172 KB |
testcase_03 | AC | 266 ms
10,172 KB |
testcase_04 | AC | 279 ms
10,172 KB |
testcase_05 | AC | 28 ms
10,148 KB |
testcase_06 | AC | 29 ms
10,148 KB |
testcase_07 | AC | 303 ms
10,172 KB |
testcase_08 | AC | 29 ms
10,152 KB |
ソースコード
t = int(input()) for _ in range(t): s = input() w=g=r=0 ok = 1 for i in s[::-1]: if i=="W": if g: w += 1 g -= 1 elif w==0: ok = 0 if i=="G": if r==0: ok = 0 g += 1 r -= 1 if i=="R": r += 1 if r or g: ok = 0 print("possible" if ok else "impossible")