結果

問題 No.1279 Array Battle
ユーザー osrgy01osrgy01
提出日時 2021-05-05 14:14:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,152 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,980 KB
実行使用メモリ 51,544 KB
最終ジャッジ日時 2023-10-11 07:59:16
合計ジャッジ時間 6,641 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,112 KB
testcase_01 AC 19 ms
8,136 KB
testcase_02 AC 17 ms
8,152 KB
testcase_03 AC 17 ms
8,288 KB
testcase_04 AC 17 ms
8,136 KB
testcase_05 AC 17 ms
8,196 KB
testcase_06 AC 17 ms
8,284 KB
testcase_07 AC 16 ms
8,252 KB
testcase_08 AC 17 ms
8,196 KB
testcase_09 AC 17 ms
8,116 KB
testcase_10 AC 17 ms
8,128 KB
testcase_11 AC 18 ms
8,364 KB
testcase_12 AC 27 ms
8,776 KB
testcase_13 AC 129 ms
12,968 KB
testcase_14 AC 101 ms
13,044 KB
testcase_15 AC 669 ms
51,196 KB
testcase_16 AC 887 ms
51,140 KB
testcase_17 AC 1,152 ms
51,184 KB
testcase_18 AC 1,039 ms
51,544 KB
testcase_19 AC 1,112 ms
51,316 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

n=int(input())
a=[*map(int,input().split())]
b=[*map(int,input().split())]
A=[*itertools.permutations(a)]
chk={}
for i in A:
    cnt=0
    for j in range(n):
        if i[j]>b[j]:
            cnt+=i[j]-b[j]
    if cnt not in chk:
        chk[cnt]=1
    else:
        chk[cnt]+=1
print(sorted(chk.items(),key=lambda x:(-x[0],-x[1]))[0][1])
0