結果
問題 | No.1279 Array Battle |
ユーザー | Yosh |
提出日時 | 2020-11-06 22:11:05 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 300 ms / 2,000 ms |
コード長 | 2,179 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 156,596 KB |
最終ジャッジ日時 | 2024-07-22 12:56:22 |
合計ジャッジ時間 | 5,320 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 144 ms
92,032 KB |
testcase_01 | AC | 148 ms
92,288 KB |
testcase_02 | AC | 154 ms
92,160 KB |
testcase_03 | AC | 146 ms
92,160 KB |
testcase_04 | AC | 147 ms
92,160 KB |
testcase_05 | AC | 151 ms
91,904 KB |
testcase_06 | AC | 152 ms
92,160 KB |
testcase_07 | AC | 151 ms
92,288 KB |
testcase_08 | AC | 155 ms
92,160 KB |
testcase_09 | AC | 150 ms
92,160 KB |
testcase_10 | AC | 147 ms
92,160 KB |
testcase_11 | AC | 156 ms
92,288 KB |
testcase_12 | AC | 154 ms
92,672 KB |
testcase_13 | AC | 169 ms
94,848 KB |
testcase_14 | AC | 170 ms
94,848 KB |
testcase_15 | AC | 280 ms
154,128 KB |
testcase_16 | AC | 300 ms
156,576 KB |
testcase_17 | AC | 299 ms
156,192 KB |
testcase_18 | AC | 295 ms
156,544 KB |
testcase_19 | AC | 295 ms
156,596 KB |
ソースコード
from __future__ import print_function from functools import reduce from operator import mul from collections import Counter from collections import deque from itertools import accumulate from queue import Queue from queue import PriorityQueue as pq from heapq import heapreplace from heapq import heapify from heapq import heappushpop from heapq import heappop from heapq import heappush import heapq import time import random import bisect import itertools import collections from fractions import Fraction import fractions import string import math import operator import functools import copy import array import re import sys sys.setrecursionlimit(500000) input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return # from fractions import gcd # from math import gcd # def lcm(n, m): # return int(n * m / gcd(n, m)) # def coprimize(p, q): # common = gcd(p, q) # return (p // common, q // common) # def find_gcd(list_l): # x = reduce(gcd, list_l) # return x def combinations_count(n, r): r = min(r, n - r) numer = reduce(mul, range(n, n - r, -1), 1) denom = reduce(mul, range(1, r + 1), 1) return numer // denom mod = 1000000007 def combinations_count_mod(n, r): r = min(r, n - r) numer = reduce(lambda x, y: x * y % mod, range(n, n - r, -1), 1) denom = pow(reduce(lambda x, y: x * y % mod, range(1, r + 1), 1), mod - 2, mod) return numer * denom % mod # def solve(): n = int(input().strip()) a = list(map(int, input().strip().split())) b = list(map(int, input().strip().split())) l_x_sum = [] l_p = [] for p in itertools.permutations([i for i in range(n)]): # eprint(p) x_sum = 0 # eprint('temp ', end=': ') for (i, j) in enumerate(p): temp = max(a[j] - b[i], 0) # eprint(temp, end=" ") x_sum += temp # eprint() # eprint('p,x_sum ', end=':\n') # eprint(p, x_sum) l_x_sum.append(x_sum) l_p.append(p) S = max(l_x_sum) ans = 0 for i in range(len(l_x_sum)): if S == l_x_sum[i]: ans += 1 # # eprint('l_p[i] ',end=':\n') # # eprint(l_p[i]) print(ans) # print(l_x_sum)