結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー tonnnura172tonnnura172
提出日時 2020-10-23 23:53:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 627 ms / 2,000 ms
コード長 995 bytes
コンパイル時間 1,354 ms
コンパイル使用メモリ 86,700 KB
実行使用メモリ 150,392 KB
最終ジャッジ日時 2023-09-28 19:14:39
合計ジャッジ時間 31,494 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 162 ms
79,988 KB
testcase_01 AC 161 ms
79,800 KB
testcase_02 AC 160 ms
79,888 KB
testcase_03 AC 163 ms
79,928 KB
testcase_04 AC 167 ms
79,944 KB
testcase_05 AC 165 ms
79,844 KB
testcase_06 AC 163 ms
79,772 KB
testcase_07 AC 163 ms
79,824 KB
testcase_08 AC 164 ms
79,848 KB
testcase_09 AC 165 ms
79,832 KB
testcase_10 AC 166 ms
79,760 KB
testcase_11 AC 169 ms
79,768 KB
testcase_12 AC 165 ms
79,836 KB
testcase_13 AC 165 ms
79,876 KB
testcase_14 AC 168 ms
79,752 KB
testcase_15 AC 165 ms
79,924 KB
testcase_16 AC 167 ms
79,628 KB
testcase_17 AC 164 ms
79,768 KB
testcase_18 AC 607 ms
148,416 KB
testcase_19 AC 562 ms
142,796 KB
testcase_20 AC 369 ms
119,128 KB
testcase_21 AC 190 ms
82,256 KB
testcase_22 AC 415 ms
130,236 KB
testcase_23 AC 188 ms
83,036 KB
testcase_24 AC 484 ms
140,160 KB
testcase_25 AC 397 ms
119,172 KB
testcase_26 AC 233 ms
91,028 KB
testcase_27 AC 189 ms
82,872 KB
testcase_28 AC 622 ms
150,056 KB
testcase_29 AC 627 ms
149,076 KB
testcase_30 AC 614 ms
149,680 KB
testcase_31 AC 622 ms
149,536 KB
testcase_32 AC 612 ms
149,900 KB
testcase_33 AC 609 ms
149,736 KB
testcase_34 AC 617 ms
149,916 KB
testcase_35 AC 609 ms
149,352 KB
testcase_36 AC 604 ms
149,744 KB
testcase_37 AC 609 ms
149,228 KB
testcase_38 AC 599 ms
149,728 KB
testcase_39 AC 597 ms
149,828 KB
testcase_40 AC 610 ms
149,828 KB
testcase_41 AC 611 ms
150,392 KB
testcase_42 AC 615 ms
149,524 KB
testcase_43 AC 163 ms
79,792 KB
testcase_44 AC 160 ms
79,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
AB = [[x, y] for x, y in zip(LIST(), LIST())]
AB.sort(key=lambda x:x[0])
A, B = zip(*AB)
med = (sum(B)+1)//2
idx = bisect_left(list(accumulate(B)), med)
X = A[idx]
print(X, sum(b*abs(X-a) for a, b in zip(A, B)))
0