結果
問題 | No.161 制限ジャンケン |
ユーザー |
|
提出日時 | 2024-12-07 07:50:23 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 5,000 ms |
コード長 | 352 bytes |
コンパイル時間 | 359 ms |
コンパイル使用メモリ | 82,224 KB |
実行使用メモリ | 53,860 KB |
最終ジャッジ日時 | 2024-12-07 07:50:25 |
合計ジャッジ時間 | 2,011 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
G,C,P = map(int,input().split())S = input().strip()A = {"G":0,"C":0,"P":0}for a in S:A[a] += 1ans = 0ans += 3*(min(G,A["C"])+min(C,A["P"])+min(P,A["G"]))G,A["C"] = max(0,G-A["C"]),max(0,A["C"]-G)C,A["P"] = max(0,C-A["P"]),max(0,A["P"]-C)P,A["G"] = max(0,P-A["G"]),max(0,A["G"]-P)ans += min(G,A["G"])+min(C,A["C"])+min(P,A["P"])print(ans)