結果
問題 | No.161 制限ジャンケン |
ユーザー | 🍡yurahuna |
提出日時 | 2016-04-18 23:39:38 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 476 bytes |
コンパイル時間 | 97 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-11-30 04:52:27 |
合計ジャッジ時間 | 1,463 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
from collections import Counter g1, c1, p1 = map(int, input().split()) s = Counter(input()) g2, c2, p2 = s['G'], s['C'], s['P'] ans = 0 # 勝ちに貪欲に割り当てる d = min(g1, c2) ans += 3 * d g1 -= d c2 -= d d = min(c1, p2) ans += 3 * d c1 -= d p2 -= d d = min(p1, g2) ans += 3 * d p1 -= d g2 -= d # print(ans) # print(g1, c1, p1) # print(g2, c2, p2) # あいこに貪欲に割り当てる ans += min(g1, g2) ans += min(c1, c2) ans += min(p1, p2) print(ans)