結果

問題 No.1279 Array Battle
ユーザー 👑 timitimi
提出日時 2020-11-16 16:37:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,716 ms / 2,000 ms
コード長 329 bytes
コンパイル時間 100 ms
コンパイル使用メモリ 10,988 KB
実行使用メモリ 51,012 KB
最終ジャッジ日時 2023-09-30 07:19:16
合計ジャッジ時間 10,043 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,096 KB
testcase_01 AC 15 ms
8,148 KB
testcase_02 AC 13 ms
8,168 KB
testcase_03 AC 13 ms
8,104 KB
testcase_04 AC 14 ms
8,316 KB
testcase_05 AC 13 ms
8,292 KB
testcase_06 AC 14 ms
8,156 KB
testcase_07 AC 13 ms
8,220 KB
testcase_08 AC 13 ms
8,268 KB
testcase_09 AC 14 ms
8,096 KB
testcase_10 AC 14 ms
8,284 KB
testcase_11 AC 16 ms
8,224 KB
testcase_12 AC 32 ms
8,616 KB
testcase_13 AC 185 ms
12,968 KB
testcase_14 AC 186 ms
12,940 KB
testcase_15 AC 1,477 ms
51,012 KB
testcase_16 AC 1,618 ms
50,868 KB
testcase_17 AC 1,716 ms
50,832 KB
testcase_18 AC 1,688 ms
50,920 KB
testcase_19 AC 1,556 ms
50,872 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