結果

問題 No.1279 Array Battle
ユーザー mlihua09
提出日時 2021-01-30 19:21:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 202 ms / 2,000 ms
コード長 345 bytes
コンパイル時間 1,600 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 76,160 KB
最終ジャッジ日時 2024-06-28 07:05:11
合計ジャッジ時間 2,824 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

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