結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー nagissnagiss
提出日時 2020-10-09 22:09:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 451 ms / 2,000 ms
コード長 297 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,620 KB
実行使用メモリ 40,816 KB
最終ジャッジ日時 2023-09-27 17:33:41
合計ジャッジ時間 19,565 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,780 KB
testcase_01 AC 13 ms
7,788 KB
testcase_02 AC 15 ms
7,804 KB
testcase_03 AC 14 ms
7,884 KB
testcase_04 AC 14 ms
7,864 KB
testcase_05 AC 13 ms
7,876 KB
testcase_06 AC 14 ms
7,796 KB
testcase_07 AC 13 ms
7,800 KB
testcase_08 AC 14 ms
7,796 KB
testcase_09 AC 13 ms
7,712 KB
testcase_10 AC 13 ms
7,916 KB
testcase_11 AC 14 ms
7,708 KB
testcase_12 AC 13 ms
7,856 KB
testcase_13 AC 14 ms
7,784 KB
testcase_14 AC 13 ms
7,792 KB
testcase_15 AC 14 ms
7,824 KB
testcase_16 AC 13 ms
7,868 KB
testcase_17 AC 14 ms
7,852 KB
testcase_18 AC 386 ms
38,004 KB
testcase_19 AC 365 ms
37,820 KB
testcase_20 AC 194 ms
24,524 KB
testcase_21 AC 35 ms
10,496 KB
testcase_22 AC 216 ms
26,124 KB
testcase_23 AC 28 ms
10,448 KB
testcase_24 AC 304 ms
32,780 KB
testcase_25 AC 200 ms
25,248 KB
testcase_26 AC 71 ms
14,380 KB
testcase_27 AC 29 ms
10,392 KB
testcase_28 AC 407 ms
40,772 KB
testcase_29 AC 399 ms
40,528 KB
testcase_30 AC 423 ms
40,664 KB
testcase_31 AC 432 ms
40,800 KB
testcase_32 AC 406 ms
40,700 KB
testcase_33 AC 411 ms
40,620 KB
testcase_34 AC 451 ms
40,816 KB
testcase_35 AC 409 ms
40,728 KB
testcase_36 AC 415 ms
40,464 KB
testcase_37 AC 417 ms
40,800 KB
testcase_38 AC 402 ms
40,620 KB
testcase_39 AC 417 ms
40,812 KB
testcase_40 AC 415 ms
40,812 KB
testcase_41 AC 430 ms
40,768 KB
testcase_42 AC 427 ms
40,716 KB
testcase_43 AC 14 ms
7,784 KB
testcase_44 AC 14 ms
7,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
AB = sorted(zip(A, B))
sumB = sum(B)
half = sumB // 2
c = 0
ans2 = 0
for a, b in AB:
    c += b
    if c > half:
        ans1 = a
        break
for a, b in AB:
    ans2 += abs(ans1 - a) * b
print(ans1, ans2)
0