結果

問題 No.1279 Array Battle
ユーザー titiatitia
提出日時 2020-11-06 21:24:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,383 ms / 2,000 ms
コード長 391 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 10,700 KB
実行使用メモリ 51,068 KB
最終ジャッジ日時 2023-09-29 18:04:19
合計ジャッジ時間 7,684 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,248 KB
testcase_01 AC 16 ms
8,232 KB
testcase_02 AC 16 ms
8,116 KB
testcase_03 AC 16 ms
8,144 KB
testcase_04 AC 16 ms
8,108 KB
testcase_05 AC 15 ms
8,252 KB
testcase_06 AC 16 ms
8,088 KB
testcase_07 AC 15 ms
8,232 KB
testcase_08 AC 15 ms
8,252 KB
testcase_09 AC 15 ms
8,156 KB
testcase_10 AC 15 ms
8,096 KB
testcase_11 AC 17 ms
8,208 KB
testcase_12 AC 27 ms
8,748 KB
testcase_13 AC 127 ms
12,996 KB
testcase_14 AC 111 ms
12,964 KB
testcase_15 AC 764 ms
50,876 KB
testcase_16 AC 961 ms
51,012 KB
testcase_17 AC 1,383 ms
51,068 KB
testcase_18 AC 1,272 ms
50,988 KB
testcase_19 AC 1,340 ms
50,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline


N=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))

from itertools import permutations

L=list(permutations(range(N)))

MAX=0
ANS=0

for l in L:
    R=0
    for i in range(N):
        if A[l[i]]>B[i]:
            R+=A[l[i]]-B[i]

    if R==MAX:
        ANS+=1
    elif R>MAX:
        MAX=R
        ANS=1

print(ANS)
    
0