結果
| 問題 |
No.154 市バス
|
| コンテスト | |
| ユーザー |
rlangevin
|
| 提出日時 | 2023-03-05 23:23:46 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 487 ms / 2,000 ms |
| コード長 | 642 bytes |
| コンパイル時間 | 178 ms |
| コンパイル使用メモリ | 12,288 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-09-18 01:42:04 |
| 合計ジャッジ時間 | 3,936 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 |
ソースコード
T = int(input())
for _ in range(T):
S = list(input())
cntR = S.count("R")
cntG = S.count("G")
cntW = S.count("W")
if cntR != cntG or cntR == 0 or cntW < cntG:
print("impossible")
continue
flag = 1
nR, nW, nG = 0, 0, 0
for s in S:
if s == "G":
nG += 1
elif s == "R":
nR += 1
else:
nW += 1
if nW < nG or nG < nR or (cntG == nG and cntW != nW) or (cntR == nR and cntW != nW):
print("impossible")
flag = 0
break
if flag == 0:
continue
print("possible")
rlangevin