結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
brthyyjp
|
| 提出日時 | 2021-04-12 18:41:43 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 882 bytes |
| コンパイル時間 | 161 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 52,480 KB |
| 最終ジャッジ日時 | 2024-06-28 15:26:54 |
| 合計ジャッジ時間 | 1,719 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 5 |
ソースコード
G0, C0, P0 = map(int, input().split())
S = str(input())
G1, C1, P1 = 0, 0, 0
for c in S:
if c == 'G':
G1 += 1
elif c == 'C':
C1 += 1
else:
P1 += 1
ans = 0
ans += min(G0, C1)*3
G0, C1 = G0-min(G0, C1), C1-min(G0, C1)
ans += min(C0, P1)*3
C0, P1 = C0-min(C0, P1), P1-min(C0, P1)
ans += min(P0, G1)*3
P0, G1 = min(P0, G1), G1-min(P0, G1)
if C1:
if C0 >= C1:
C0 -= C1
ans += C1
C1 = 0
else:
ans += C0
C1 -= C0
P0 -= C1
C0 = 0
C1 = 0
if P1:
if P0 >= P1:
P0 -= P1
ans += P1
P1 = 0
else:
ans += P0
P1 -= P0
G0 -= P1
P0 = 0
P1 = 0
if G1:
if G0 >= G1:
G0 -= G1
ans += G1
G1 = 0
else:
ans += G0
G1 -= G0
C0 -= G1
G0 = 0
G1 = 0
print(ans)
brthyyjp