結果
問題 |
No.154 市バス
|
ユーザー |
![]() |
提出日時 | 2025-02-20 03:04:24 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 340 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 10,368 KB |
最終ジャッジ日時 | 2025-02-20 03:04:27 |
合計ジャッジ時間 | 1,863 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | AC * 6 WA * 2 |
ソースコード
def solve(s: str) -> bool: if s[-1] != 'R': return False w = 0 g = 0 r = 0 for c in s: match c: case 'W': w += 1 case 'G': if w == 0: return False w -= 1 g += 1 case 'R': if g == 0: return False g -= 1 r += 1 return True T = int(input()) for _ in range(T): S = input() if solve(S): print('possible') else: print('impossible')