結果

問題 No.1279 Array Battle
ユーザー vwxyzvwxyz
提出日時 2023-05-10 07:03:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 445 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 76,972 KB
最終ジャッジ日時 2023-08-17 15:22:32
合計ジャッジ時間 2,916 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,316 KB
testcase_01 AC 70 ms
71,372 KB
testcase_02 AC 70 ms
71,384 KB
testcase_03 AC 70 ms
71,148 KB
testcase_04 AC 69 ms
71,080 KB
testcase_05 AC 69 ms
71,384 KB
testcase_06 AC 70 ms
71,328 KB
testcase_07 AC 69 ms
71,164 KB
testcase_08 AC 69 ms
71,152 KB
testcase_09 AC 68 ms
71,092 KB
testcase_10 AC 68 ms
71,360 KB
testcase_11 AC 78 ms
76,472 KB
testcase_12 AC 80 ms
76,272 KB
testcase_13 AC 85 ms
76,208 KB
testcase_14 AC 83 ms
76,504 KB
testcase_15 AC 115 ms
76,776 KB
testcase_16 AC 133 ms
76,788 KB
testcase_17 AC 133 ms
76,936 KB
testcase_18 AC 143 ms
76,972 KB
testcase_19 AC 138 ms
76,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline
write=sys.stdout.write
from math import gcd as GCD
import math
import itertools

N=int(readline())
A=list(map(int,readline().split()))
B=list(map(int,readline().split()))
m,ans=-1,0
for tpl in itertools.permutations([i for i in range(N)]):
    s=0
    for i in range(N):
        a=A[tpl[i]]
        b=B[i]
        s+=max(0,a-b)
    if s==m:
        ans+=1
    elif s>m:
        m=s
        ans=1
print(ans)
0