結果
| 問題 | No.161 制限ジャンケン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-09 23:32:52 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 22 ms / 5,000 ms |
| + 174µs | |
| コード長 | 1,168 bytes |
| 記録 | |
| コンパイル時間 | 59 ms |
| コンパイル使用メモリ | 15,104 KB |
| 実行使用メモリ | 11,008 KB |
| 最終ジャッジ日時 | 2026-10-02 09:57:34 |
| 合計ジャッジ時間 | 2,124 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 |
ソースコード
import sys
def debug(x, table):
for name, val in table.items():
if x is val:
print('DEBUG:{} -> {}'.format(name, val), file=sys.stderr)
return None
def solve():
gcp_y = [int(i) for i in input().split()]
gcp_em = [0, 0, 0]
hands = input().rstrip()
for hand in hands:
if hand == 'G':
gcp_em[0] += 1
elif hand == 'C':
gcp_em[1] += 1
else:
gcp_em[2] += 1
score = 0
kati = 0
for i in range(3):
if gcp_y[i] > gcp_em[(i + 1) % 3]:
kati += gcp_em[(i + 1) % 3]
gcp_y[i] -= gcp_em[(i + 1) % 3]
gcp_em[(i + 1) % 3] = 0
else:
kati += gcp_y[i]
gcp_em[(i + 1) % 3] -= gcp_y[i]
gcp_y[i] = 0
score += kati * 3
aiko = 0
for i in range(3):
if gcp_y[i] > gcp_em[i]:
aiko += gcp_em[i]
gcp_y[i] -= gcp_em[i]
gcp_em[(i + 1) % 3] = 0
else:
aiko += gcp_y[i]
gcp_em[i] -= gcp_y[i]
gcp_y[i] = 0
score += aiko * 1
print(score)
if __name__ == '__main__':
solve()