結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー sibasyunsibasyun
提出日時 2021-01-30 15:32:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 810 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 103 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 42,600 KB
最終ジャッジ日時 2023-09-10 11:41:33
合計ジャッジ時間 29,918 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,860 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 16 ms
7,736 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 15 ms
7,852 KB
testcase_05 AC 16 ms
7,808 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 16 ms
7,936 KB
testcase_08 AC 16 ms
7,804 KB
testcase_09 AC 15 ms
7,772 KB
testcase_10 AC 16 ms
7,880 KB
testcase_11 AC 16 ms
7,880 KB
testcase_12 AC 16 ms
7,804 KB
testcase_13 AC 16 ms
7,772 KB
testcase_14 AC 15 ms
7,776 KB
testcase_15 AC 16 ms
7,896 KB
testcase_16 AC 15 ms
7,852 KB
testcase_17 AC 15 ms
7,880 KB
testcase_18 AC 746 ms
40,816 KB
testcase_19 AC 730 ms
39,912 KB
testcase_20 AC 365 ms
26,032 KB
testcase_21 AC 48 ms
10,800 KB
testcase_22 AC 408 ms
27,904 KB
testcase_23 AC 38 ms
10,348 KB
testcase_24 AC 548 ms
33,932 KB
testcase_25 AC 377 ms
26,936 KB
testcase_26 AC 108 ms
14,840 KB
testcase_27 AC 40 ms
10,252 KB
testcase_28 AC 762 ms
42,504 KB
testcase_29 AC 782 ms
42,552 KB
testcase_30 AC 785 ms
42,500 KB
testcase_31 AC 810 ms
42,384 KB
testcase_32 AC 781 ms
42,432 KB
testcase_33 AC 775 ms
42,384 KB
testcase_34 AC 779 ms
42,472 KB
testcase_35 AC 788 ms
42,480 KB
testcase_36 AC 793 ms
42,336 KB
testcase_37 AC 799 ms
42,576 KB
testcase_38 AC 779 ms
42,452 KB
testcase_39 AC 781 ms
42,312 KB
testcase_40 AC 780 ms
42,380 KB
testcase_41 AC 770 ms
42,380 KB
testcase_42 AC 791 ms
42,600 KB
testcase_43 AC 16 ms
7,828 KB
testcase_44 AC 15 ms
7,980 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
AB = [[A[i], B[i]] for i in range(N)]
AB.sort()

Bsum = sum(B)

T = 0
for i in range(N):
    T = T + AB[i][1]
    if T >= (Bsum + 1) / 2:
        a = i
        break

A0 = AB[a][0]
Ans = 0
for i in range(N):
    Ans = Ans + AB[i][1] * abs(AB[i][0] - A0)

print(str(A0) + " " + str(Ans))
0