結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-11 13:01:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 614 bytes |
| 記録 | |
| コンパイル時間 | 247 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,368 KB |
| 最終ジャッジ日時 | 2025-12-11 13:02:01 |
| 合計ジャッジ時間 | 2,181 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 5 WA * 3 |
ソースコード
import sys
def input(): return sys.stdin.readline().rstrip('\n')
def main():
def solve(x):
r = g = 0
for c in x:
if c == 'R':
r += 1
elif c == 'G':
if r == 0:
return False
else:
r -= 1
g += 1
else:
g = max(0, g - 1)
return g == 0
for _ in range(int(input())):
print('possible' if solve(input()[::-1]) else 'impossible')
if __name__ == '__main__':
ret = main()
if ret is not None:
print(ret)