結果

問題 No.1279 Array Battle
ユーザー uni_pythonuni_python
提出日時 2020-11-06 21:32:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 126 ms / 2,000 ms
コード長 448 bytes
コンパイル時間 247 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 77,008 KB
最終ジャッジ日時 2023-09-29 18:16:55
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,064 KB
testcase_01 AC 64 ms
71,476 KB
testcase_02 AC 66 ms
71,336 KB
testcase_03 AC 70 ms
71,432 KB
testcase_04 AC 66 ms
71,596 KB
testcase_05 AC 65 ms
71,476 KB
testcase_06 AC 67 ms
71,480 KB
testcase_07 AC 66 ms
71,188 KB
testcase_08 AC 67 ms
71,376 KB
testcase_09 AC 66 ms
71,272 KB
testcase_10 AC 65 ms
71,424 KB
testcase_11 AC 69 ms
76,424 KB
testcase_12 AC 70 ms
76,612 KB
testcase_13 AC 76 ms
76,576 KB
testcase_14 AC 79 ms
76,576 KB
testcase_15 AC 104 ms
76,732 KB
testcase_16 AC 115 ms
76,884 KB
testcase_17 AC 118 ms
77,008 KB
testcase_18 AC 126 ms
76,888 KB
testcase_19 AC 121 ms
76,872 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

N=I()
A=LI()
B=LI()

import itertools

ans=0
M=-1

for ite in itertools.permutations(A, N):
    temp=0
    for i in range(N):
        a=ite[i]
        b=B[i]
        if a>b:
            temp+=a-b
    if temp>M:
        ans=1
        M=temp
    elif temp==M:
        ans+=1

print(ans)
    
0