結果

問題 No.1279 Array Battle
ユーザー mlihua09mlihua09
提出日時 2021-01-30 19:21:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 77,580 KB
最終ジャッジ日時 2023-09-10 15:58:23
合計ジャッジ時間 4,544 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,252 KB
testcase_01 AC 74 ms
71,196 KB
testcase_02 AC 73 ms
71,044 KB
testcase_03 AC 74 ms
71,260 KB
testcase_04 AC 72 ms
71,244 KB
testcase_05 AC 73 ms
71,080 KB
testcase_06 AC 72 ms
70,776 KB
testcase_07 AC 72 ms
71,108 KB
testcase_08 AC 72 ms
71,316 KB
testcase_09 AC 73 ms
71,268 KB
testcase_10 AC 74 ms
71,376 KB
testcase_11 AC 114 ms
75,196 KB
testcase_12 AC 122 ms
77,580 KB
testcase_13 AC 115 ms
76,720 KB
testcase_14 AC 108 ms
77,204 KB
testcase_15 AC 200 ms
76,636 KB
testcase_16 AC 226 ms
77,012 KB
testcase_17 AC 229 ms
77,116 KB
testcase_18 AC 231 ms
77,292 KB
testcase_19 AC 224 ms
76,788 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations

N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

x = 0
y = 0

for p in permutations(A, r=N):
    
    s = sum([p[i] - B[i] + abs(p[i] - B[i]) for i in range(N)])
    
    if s > x:
        x = s
        y = 1
        
    elif s == x:
        y += 1
        
print(y)
0