結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-11 13:01:45 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 614 bytes |
| 記録 | |
| コンパイル時間 | 305 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 75,680 KB |
| 最終ジャッジ日時 | 2025-12-11 13:01:47 |
| 合計ジャッジ時間 | 1,931 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | WA * 2 MLE * 6 |
ソースコード
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)