結果

問題 No.1279 Array Battle
ユーザー ygd.ygd.
提出日時 2020-11-06 21:31:32
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 132,056 KB
最終ジャッジ日時 2023-09-29 18:15:58
合計ジャッジ時間 3,388 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,324 KB
testcase_01 AC 66 ms
71,512 KB
testcase_02 AC 69 ms
71,572 KB
testcase_03 AC 67 ms
71,444 KB
testcase_04 AC 68 ms
71,480 KB
testcase_05 AC 67 ms
71,408 KB
testcase_06 AC 67 ms
71,480 KB
testcase_07 AC 67 ms
71,232 KB
testcase_08 AC 67 ms
71,484 KB
testcase_09 AC 68 ms
71,484 KB
testcase_10 AC 69 ms
71,272 KB
testcase_11 AC 73 ms
76,500 KB
testcase_12 AC 75 ms
76,716 KB
testcase_13 AC 84 ms
78,648 KB
testcase_14 AC 85 ms
78,764 KB
testcase_15 AC 186 ms
132,056 KB
testcase_16 AC 204 ms
131,860 KB
testcase_17 AC 212 ms
131,924 KB
testcase_18 AC 211 ms
132,008 KB
testcase_19 AC 211 ms
131,804 KB
権限があれば一括ダウンロードができます

ソースコード

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