結果

問題 No.1279 Array Battle
ユーザー persimmon-persimmonpersimmon-persimmon
提出日時 2021-02-18 20:29:44
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 454 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 1,130 ms
コンパイル使用メモリ 86,856 KB
実行使用メモリ 165,100 KB
最終ジャッジ日時 2023-10-13 04:00:59
合計ジャッジ時間 6,092 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,388 KB
testcase_01 AC 72 ms
71,376 KB
testcase_02 AC 74 ms
71,328 KB
testcase_03 AC 73 ms
71,284 KB
testcase_04 AC 73 ms
71,216 KB
testcase_05 AC 73 ms
71,444 KB
testcase_06 AC 73 ms
71,300 KB
testcase_07 AC 72 ms
71,360 KB
testcase_08 AC 74 ms
71,212 KB
testcase_09 AC 73 ms
71,224 KB
testcase_10 AC 72 ms
71,436 KB
testcase_11 AC 92 ms
76,628 KB
testcase_12 AC 93 ms
76,348 KB
testcase_13 AC 134 ms
85,556 KB
testcase_14 AC 124 ms
81,820 KB
testcase_15 AC 424 ms
164,684 KB
testcase_16 AC 454 ms
164,924 KB
testcase_17 AC 450 ms
164,944 KB
testcase_18 AC 454 ms
165,100 KB
testcase_19 AC 443 ms
164,708 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
allpat=[]
todo=[[i] for i in range(n)]
while todo:
  v=todo.pop()
  if len(v)==n:
    allpat.append(v)
    continue
  for nv in range(n):
    if nv in v:continue
    todo.append(v+[nv])
mxv=0
ans=0

for pat in allpat:
  tmp=0
  for i in range(n):
    tmp+=max(0,a[pat[i]]-b[i])
  if tmp==mxv:
    ans+=1
  elif tmp>mxv:
    mxv=tmp
    ans=1
print(ans)
0