結果

問題 No.1279 Array Battle
ユーザー ygd.
提出日時 2020-11-06 21:31:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 400 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 130,916 KB
最終ジャッジ日時 2024-07-22 12:17:12
合計ジャッジ時間 2,667 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools

N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
A.sort(reverse=True)
B.sort()
MAX = 0
for i in range(N):
  temp = max(A[i] - B[i],0)
  MAX += temp
ans = 0

L = list(itertools.permutations(A,N))
for X in L:
  point = 0
  for i in range(N):
    temp = max(X[i] - B[i],0)
    point += temp
  if point == MAX:
    ans += 1
print(ans)
0