結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー pluto77pluto77
提出日時 2022-02-12 15:35:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 518 ms / 2,000 ms
コード長 270 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 40,892 KB
最終ジャッジ日時 2023-09-11 03:13:16
合計ジャッジ時間 26,211 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,152 KB
testcase_01 AC 16 ms
8,060 KB
testcase_02 AC 16 ms
8,068 KB
testcase_03 AC 16 ms
8,064 KB
testcase_04 AC 16 ms
8,048 KB
testcase_05 AC 16 ms
8,080 KB
testcase_06 AC 16 ms
8,080 KB
testcase_07 AC 16 ms
8,176 KB
testcase_08 AC 16 ms
8,092 KB
testcase_09 AC 16 ms
8,080 KB
testcase_10 AC 16 ms
8,160 KB
testcase_11 AC 16 ms
8,132 KB
testcase_12 AC 16 ms
8,144 KB
testcase_13 AC 16 ms
8,104 KB
testcase_14 AC 16 ms
8,120 KB
testcase_15 AC 16 ms
8,116 KB
testcase_16 AC 16 ms
8,096 KB
testcase_17 AC 16 ms
8,160 KB
testcase_18 AC 482 ms
39,304 KB
testcase_19 AC 467 ms
37,800 KB
testcase_20 AC 253 ms
24,960 KB
testcase_21 AC 40 ms
10,508 KB
testcase_22 AC 280 ms
26,144 KB
testcase_23 AC 32 ms
10,328 KB
testcase_24 AC 375 ms
31,636 KB
testcase_25 AC 262 ms
25,364 KB
testcase_26 AC 87 ms
14,024 KB
testcase_27 AC 33 ms
10,272 KB
testcase_28 AC 502 ms
40,672 KB
testcase_29 AC 507 ms
40,764 KB
testcase_30 AC 508 ms
40,848 KB
testcase_31 AC 501 ms
40,672 KB
testcase_32 AC 503 ms
40,800 KB
testcase_33 AC 502 ms
40,760 KB
testcase_34 AC 505 ms
40,700 KB
testcase_35 AC 499 ms
40,888 KB
testcase_36 AC 508 ms
40,696 KB
testcase_37 AC 514 ms
40,656 KB
testcase_38 AC 518 ms
40,772 KB
testcase_39 AC 516 ms
40,892 KB
testcase_40 AC 507 ms
40,764 KB
testcase_41 AC 509 ms
40,736 KB
testcase_42 AC 507 ms
40,880 KB
testcase_43 AC 16 ms
8,048 KB
testcase_44 AC 16 ms
8,148 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#yuki1251
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
s=sum(b)
c=[(a[i],b[i]) for i in range(n)]
c.sort()
mid=(s+1)//2
t=0
for i in range(n):
 t+=c[i][1]
 if t>=mid:
  x=c[i][0]
  y=sum(b*abs(a-x) for a,b in c)
  print(x,y)
  exit()
0