結果
問題 | No.154 市バス |
ユーザー | persimmon-persimmon |
提出日時 | 2021-06-17 09:42:13 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 508 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 10,796 KB |
実行使用メモリ | 16,604 KB |
最終ジャッジ日時 | 2023-08-30 18:05:53 |
合計ジャッジ時間 | 4,177 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 504 ms
16,600 KB |
testcase_01 | AC | 508 ms
16,600 KB |
testcase_02 | AC | 476 ms
16,604 KB |
testcase_03 | AC | 174 ms
16,428 KB |
testcase_04 | AC | 477 ms
16,432 KB |
testcase_05 | AC | 18 ms
8,592 KB |
testcase_06 | AC | 18 ms
8,564 KB |
testcase_07 | AC | 465 ms
16,396 KB |
testcase_08 | AC | 18 ms
8,452 KB |
ソースコード
t=int(input()) sary=[list(input()) for _ in range(t)] from collections import Counter for s in sary: cs=dict(Counter(s)) if "W" not in cs or "G" not in cs or "R" not in cs: print("impossible") continue if cs["R"]!=cs["G"] or cs["R"]>cs["W"]: print("impossible") continue flg=True counter={"W":0,"G":0,"R":0} for x in s: counter[x]+=1 if counter["W"]>=counter["G"]>=counter["R"]: pass else: flg=False break if counter["G"]==cs["G"] and x=="W": flg=False break if flg: print("possible") else: print("impossible")