結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
adoth
|
| 提出日時 | 2017-11-07 20:09:58 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 954 bytes |
| コンパイル時間 | 160 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-10-13 09:16:17 |
| 合計ジャッジ時間 | 1,636 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
ソースコード
def main():
n = int(input())
for _ in range(n):
memo = input()[::-1]
W, G, R, pair_GR = 0, 0, 0, 0
last_R, last_G, b = False, False, True
for s in memo:
if s == 'R':
R += 1
last_R = True
elif s == 'G' and last_R:
last_G = True
if R > 0:
R -= 1
pair_GR += 1
else:
print('impossible')
b = False
break
elif s == 'W' and last_R and last_G:
if pair_GR == 0:
print('impossible')
b = False
break
elif pair_GR > 0:
W += 1
else:
print('impossible')
b = False
break
if R == 0 and b:
print('possible')
main()
adoth