結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 21:22:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 5,000 ms |
| コード長 | 624 bytes |
| コンパイル時間 | 155 ms |
| コンパイル使用メモリ | 82,172 KB |
| 実行使用メモリ | 53,900 KB |
| 最終ジャッジ日時 | 2025-03-20 21:22:42 |
| 合計ジャッジ時間 | 1,512 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
# Read input
G, C, P = map(int, input().split())
S = input().strip()
# Count opponent's moves
cnt_G = S.count('G')
cnt_C = S.count('C')
cnt_P = S.count('P')
# Calculate maximum wins for each type
a = min(cnt_G, P)
b = min(cnt_C, G)
c = min(cnt_P, C)
# Remaining opponent's moves after wins
rem_G = cnt_G - a
rem_C = cnt_C - b
rem_P = cnt_P - c
# Remaining moves for yuki
yg_rem = G - b
yc_rem = C - c
yp_rem = P - a
# Calculate maximum draws
draw_G = min(rem_G, yg_rem)
draw_C = min(rem_C, yc_rem)
draw_P = min(rem_P, yp_rem)
# Total score
total_score = 3 * (a + b + c) + (draw_G + draw_C + draw_P)
print(total_score)
lam6er