結果
| 問題 | No.1251 絶対に間違ってはいけない最小化問題 | 
| コンテスト | |
| ユーザー |  mkawa2 | 
| 提出日時 | 2020-10-09 23:33:08 | 
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 703 ms / 2,000 ms | 
| コード長 | 964 bytes | 
| コンパイル時間 | 99 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 55,860 KB | 
| 最終ジャッジ日時 | 2024-07-20 14:25:58 | 
| 合計ジャッジ時間 | 26,281 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 42 | 
ソースコード
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)
            
            
            
        