結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー mkawa2mkawa2
提出日時 2020-10-09 23:33:08
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 608 ms / 2,000 ms
コード長 964 bytes
コンパイル時間 643 ms
コンパイル使用メモリ 10,820 KB
実行使用メモリ 51,712 KB
最終ジャッジ日時 2023-09-27 19:55:46
合計ジャッジ時間 25,623 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,580 KB
testcase_01 AC 19 ms
8,780 KB
testcase_02 AC 20 ms
8,604 KB
testcase_03 AC 20 ms
8,512 KB
testcase_04 AC 20 ms
8,552 KB
testcase_05 AC 20 ms
8,600 KB
testcase_06 AC 19 ms
8,620 KB
testcase_07 AC 20 ms
8,736 KB
testcase_08 AC 20 ms
8,636 KB
testcase_09 AC 20 ms
8,564 KB
testcase_10 AC 19 ms
8,552 KB
testcase_11 AC 20 ms
8,648 KB
testcase_12 AC 20 ms
8,588 KB
testcase_13 AC 20 ms
8,628 KB
testcase_14 AC 20 ms
8,656 KB
testcase_15 AC 20 ms
8,704 KB
testcase_16 AC 19 ms
8,564 KB
testcase_17 AC 20 ms
8,708 KB
testcase_18 AC 569 ms
49,864 KB
testcase_19 AC 539 ms
50,060 KB
testcase_20 AC 288 ms
30,776 KB
testcase_21 AC 48 ms
11,812 KB
testcase_22 AC 323 ms
32,800 KB
testcase_23 AC 38 ms
10,944 KB
testcase_24 AC 447 ms
42,420 KB
testcase_25 AC 311 ms
31,872 KB
testcase_26 AC 98 ms
16,964 KB
testcase_27 AC 40 ms
10,896 KB
testcase_28 AC 599 ms
50,804 KB
testcase_29 AC 598 ms
50,708 KB
testcase_30 AC 603 ms
50,812 KB
testcase_31 AC 608 ms
50,812 KB
testcase_32 AC 607 ms
50,880 KB
testcase_33 AC 598 ms
50,820 KB
testcase_34 AC 603 ms
50,772 KB
testcase_35 AC 602 ms
50,772 KB
testcase_36 AC 597 ms
50,700 KB
testcase_37 AC 608 ms
51,644 KB
testcase_38 AC 596 ms
50,804 KB
testcase_39 AC 601 ms
50,784 KB
testcase_40 AC 598 ms
50,876 KB
testcase_41 AC 597 ms
50,724 KB
testcase_42 AC 604 ms
51,712 KB
testcase_43 AC 19 ms
8,608 KB
testcase_44 AC 20 ms
8,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from operator import itemgetter
from itertools import *
from bisect import *
from collections import *
from heapq import *
import sys

# input=sys.stdin.buffer.readline
input=sys.stdin.readline

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(input())
def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())
def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return input()[:-1]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

n=II()
aa=LI()
bb=LI()
ab=[(a,b) for a,b in zip(aa,bb)]
ab.sort()

cs=[ab[0][1]]
for a,b in ab[1:]:cs.append(cs[-1]+b)
for i,s in enumerate(cs):
    if s>=(cs[-1]+1)//2:
        x=ab[i][0]
        ans=sum(abs(a-x)*b for a,b in ab)
        break
print(x,ans)
0