結果

問題 No.1279 Array Battle
ユーザー harurunharurun
提出日時 2021-02-05 01:09:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 390 ms / 2,000 ms
コード長 413 bytes
コンパイル時間 1,786 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 8,264 KB
最終ジャッジ日時 2023-09-13 21:36:35
合計ジャッジ時間 4,729 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,060 KB
testcase_01 AC 16 ms
8,176 KB
testcase_02 AC 16 ms
8,216 KB
testcase_03 AC 16 ms
8,264 KB
testcase_04 AC 15 ms
8,188 KB
testcase_05 AC 16 ms
8,052 KB
testcase_06 AC 16 ms
8,008 KB
testcase_07 AC 16 ms
8,160 KB
testcase_08 AC 15 ms
8,072 KB
testcase_09 AC 15 ms
8,088 KB
testcase_10 AC 16 ms
8,180 KB
testcase_11 AC 16 ms
8,104 KB
testcase_12 AC 18 ms
8,080 KB
testcase_13 AC 49 ms
8,100 KB
testcase_14 AC 43 ms
8,188 KB
testcase_15 AC 250 ms
8,160 KB
testcase_16 AC 311 ms
8,084 KB
testcase_17 AC 390 ms
8,064 KB
testcase_18 AC 364 ms
8,220 KB
testcase_19 AC 383 ms
8,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import permutations
from sys import stdin
pin=stdin.readline
def main():
  N=int(pin())
  a=list(map(int,pin().split()))
  b=list(map(int,pin().split()))
  p=permutations(list(range(N)))
  ans=0
  cnt=0
  for i in p:
    sc=0
    for j in range(N):
      if a[i[j]]>b[j]:
        sc+=a[i[j]]-b[j]
    if sc==ans:
      cnt+=1
    elif sc>ans:
      ans=sc
      cnt=1
  print(cnt)
  return

main()
0