結果
問題 | No.154 市バス |
ユーザー |
|
提出日時 | 2021-06-17 09:42:13 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 562 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 173 ms |
コンパイル使用メモリ | 12,032 KB |
実行使用メモリ | 18,048 KB |
最終ジャッジ日時 | 2025-01-02 11:59:46 |
合計ジャッジ時間 | 4,452 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 8 |
ソースコード
t=int(input())sary=[list(input()) for _ in range(t)]from collections import Counterfor s in sary:cs=dict(Counter(s))if "W" not in cs or "G" not in cs or "R" not in cs:print("impossible")continueif cs["R"]!=cs["G"] or cs["R"]>cs["W"]:print("impossible")continueflg=Truecounter={"W":0,"G":0,"R":0}for x in s:counter[x]+=1if counter["W"]>=counter["G"]>=counter["R"]:passelse:flg=Falsebreakif counter["G"]==cs["G"] and x=="W":flg=Falsebreakif flg:print("possible")else:print("impossible")