結果

問題 No.161 制限ジャンケン
ユーザー uran110uran110
提出日時 2018-11-16 17:20:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 15 ms / 5,000 ms
コード長 620 bytes
コンパイル時間 594 ms
コンパイル使用メモリ 10,708 KB
実行使用メモリ 7,928 KB
最終ジャッジ日時 2023-08-26 01:27:58
合計ジャッジ時間 1,914 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,760 KB
testcase_01 AC 13 ms
7,836 KB
testcase_02 AC 12 ms
7,916 KB
testcase_03 AC 12 ms
7,844 KB
testcase_04 AC 12 ms
7,840 KB
testcase_05 AC 13 ms
7,844 KB
testcase_06 AC 13 ms
7,896 KB
testcase_07 AC 13 ms
7,772 KB
testcase_08 AC 12 ms
7,724 KB
testcase_09 AC 13 ms
7,808 KB
testcase_10 AC 13 ms
7,792 KB
testcase_11 AC 13 ms
7,812 KB
testcase_12 AC 14 ms
7,736 KB
testcase_13 AC 14 ms
7,860 KB
testcase_14 AC 14 ms
7,928 KB
testcase_15 AC 14 ms
7,808 KB
testcase_16 AC 14 ms
7,736 KB
testcase_17 AC 12 ms
7,720 KB
testcase_18 AC 15 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

'''
matrix[[G,Ci],
       [C,Pi],
       [P,Gi]]
'''
com=[[],[],[]]
nums=[0,0,0]
N=0

num=input().split()
for i in range(3):
    com[i].append(int(num[i]))
    N+=int(num[i])
str=input()

for i in range(N):
    if str[i] == 'C':
        nums[0]+=1
    if str[i] == 'P':
        nums[1]+=1
    if str[i] == 'G':
        nums[2]+=1

for i in range(3):
    com[i].append(nums[i])

win=min(com[0])+min(com[1])+min(com[2])
drr=min((com[0][0]-min(com[0])),(com[2][1]-min(com[2])))\
   +min((com[1][0]-min(com[1])),(com[0][1]-min(com[0])))\
   +min((com[2][0]-min(com[2])),(com[1][1]-min(com[1])))

print(3*win+drr)
0