結果

問題 No.1279 Array Battle
コンテスト
ユーザー trineutron
提出日時 2024-11-27 19:14:05
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 68 ms / 2,000 ms
+ 610µs
コード長 435 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 65 ms
コンパイル使用メモリ 81,800 KB
実行使用メモリ 83,036 KB
最終ジャッジ日時 2026-10-01 00:42:42
合計ジャッジ時間 2,638 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from itertools import permutations

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
scores = {}
for order in permutations(a, n):
    s = 0
    for i in range(n):
        s += max(0, order[i] - b[i])
    if s not in scores:
        scores[s] = 0
    scores[s] += 1
ans_key = -1
ans = 0
for key, value in scores.items():
    if key > ans_key:
        ans_key = key
        ans = value
print(ans)
0