結果

問題 No.1279 Array Battle
ユーザー mesame3993mesame3993
提出日時 2021-11-18 19:08:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 192 ms / 2,000 ms
コード長 548 bytes
コンパイル時間 322 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 76,140 KB
最終ジャッジ日時 2023-08-27 07:06:47
合計ジャッジ時間 3,747 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,236 KB
testcase_01 AC 76 ms
71,116 KB
testcase_02 AC 75 ms
71,184 KB
testcase_03 AC 75 ms
71,340 KB
testcase_04 AC 74 ms
71,300 KB
testcase_05 AC 76 ms
71,392 KB
testcase_06 AC 75 ms
71,260 KB
testcase_07 AC 73 ms
71,276 KB
testcase_08 AC 73 ms
71,212 KB
testcase_09 AC 75 ms
71,052 KB
testcase_10 AC 74 ms
71,300 KB
testcase_11 AC 87 ms
75,564 KB
testcase_12 AC 90 ms
75,920 KB
testcase_13 AC 109 ms
76,140 KB
testcase_14 AC 104 ms
75,964 KB
testcase_15 AC 161 ms
75,932 KB
testcase_16 AC 185 ms
76,040 KB
testcase_17 AC 181 ms
76,128 KB
testcase_18 AC 192 ms
76,044 KB
testcase_19 AC 187 ms
76,124 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
  from sys import stdin
  from itertools import permutations
  readline=stdin.readline
  n = int(readline())
  A = list(map(int, readline().split()))
  B = list(map(int, readline().split()))
  ans = 0
  L = [x for x in range(n)]
  for i in permutations(L):
    tmp = 0
    k = 0
    for j in i:
      tmp += max(A[j]-B[k], 0)
      k += 1
    ans = max(ans, tmp)
  cnt = 0
  for i in permutations(L):
    tmp = 0
    k = 0
    for j in i:
      tmp += max(A[j]-B[k], 0)
      k += 1
    if tmp == ans:
      cnt += 1
  print(cnt)
main()
0