結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
norioc
|
| 提出日時 | 2025-02-20 03:03:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 538 bytes |
| コンパイル時間 | 258 ms |
| コンパイル使用メモリ | 82,740 KB |
| 実行使用メモリ | 76,500 KB |
| 最終ジャッジ日時 | 2025-02-20 03:03:52 |
| 合計ジャッジ時間 | 1,774 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 1 WA * 1 MLE * 6 |
ソースコード
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')
norioc