結果

問題 No.1279 Array Battle
ユーザー 👑 timitimi
提出日時 2020-11-16 16:38:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 228 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 677 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 131,908 KB
最終ジャッジ日時 2023-09-30 07:19:21
合計ジャッジ時間 4,280 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,500 KB
testcase_01 AC 71 ms
71,536 KB
testcase_02 AC 71 ms
71,536 KB
testcase_03 AC 76 ms
71,188 KB
testcase_04 AC 74 ms
71,548 KB
testcase_05 AC 74 ms
71,452 KB
testcase_06 AC 74 ms
71,388 KB
testcase_07 AC 72 ms
71,320 KB
testcase_08 AC 71 ms
71,396 KB
testcase_09 AC 73 ms
71,388 KB
testcase_10 AC 71 ms
71,604 KB
testcase_11 AC 81 ms
76,436 KB
testcase_12 AC 81 ms
76,500 KB
testcase_13 AC 92 ms
78,568 KB
testcase_14 AC 91 ms
78,896 KB
testcase_15 AC 210 ms
131,892 KB
testcase_16 AC 224 ms
131,784 KB
testcase_17 AC 228 ms
131,708 KB
testcase_18 AC 226 ms
131,908 KB
testcase_19 AC 226 ms
131,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
A=sorted(A)[::-1]
B=sorted(B)
ma=0
for i in range(N):
  ma+=max(A[i]-B[i],0)
import itertools
D=list(itertools.permutations(range(N)))
ans=0
for i in D:
  cnt=0
  for j in range(N):
    cnt+=max(A[i[j]]-B[j],0)
  if cnt==ma:
    ans+=1
print(ans)
0