結果
| 問題 | No.154 市バス |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-12-18 23:45:49 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 575 bytes |
| 記録 | |
| コンパイル時間 | 415 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 15,360 KB |
| 最終ジャッジ日時 | 2026-04-04 20:16:26 |
| 合計ジャッジ時間 | 3,316 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 1 |
| other | AC * 6 WA * 2 |
ソースコード
def answer():
S = list(input())
W = [int(i == 'W') for i in S]
G = [int(i == 'G') for i in S]
R = [int(i == 'R') for i in S]
N = len(S)
from itertools import accumulate
SW = list(accumulate(W))
SG = list(accumulate(G))
SR = list(accumulate(R))
for i in range(N):
if SW[i]>=SG[i]>=SR[i]:
continue
else:
print('impossible')
return
if SG[-1] != SR[-1]:
print('impossible')
return
print('possible')
return
for _ in range(int(input())):
answer()