結果
| 問題 |
No.161 制限ジャンケン
|
| コンテスト | |
| ユーザー |
takakin
|
| 提出日時 | 2020-04-21 22:44:28 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 31 ms / 5,000 ms |
| コード長 | 406 bytes |
| コンパイル時間 | 240 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-09 13:42:25 |
| 合計ジャッジ時間 | 1,573 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
import sys
input=lambda: sys.stdin.readline().rstrip()
g,c,p=map(int,input().split())
S=input()
ans=0
gs,cs,ps=0,0,0
for s in S:
if s=="G":
gs+=1
elif s=="C":
cs+=1
else:
ps+=1
if gs>0 and p>0:
w=min(gs,p)
gs-=w
p-=w
ans+=3*w
if cs>0 and g>0:
w=min(cs,g)
cs-=w
g-=w
ans+=3*w
if ps>0 and c>0:
w=min(ps,c)
ps-=w
c-=w
ans+=3*w
print(ans+min(gs,g)+min(cs,c)+min(ps,p))
takakin