結果
| 問題 | No.1279 Array Battle |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-06-23 17:37:47 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 78 ms / 2,000 ms |
| コード長 | 525 bytes |
| 記録 | |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 81,024 KB |
| 最終ジャッジ日時 | 2026-06-23 17:37:53 |
| 合計ジャッジ時間 | 5,148 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 20 |
ソースコード
# N <= 9なので順列全探索が可能 (O(N!N)
# 逆に得点最大の選び方の数をとわれているので全探索するべき?
from itertools import permutations
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
score_max = 0
cnt = Counter()
for p in permutations(A):
tmp = 0
for i in range(N):
tmp += max(0,p[i]-B[i])
score_max = max(score_max, tmp)
cnt[tmp] += 1
print(cnt[score_max])