結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー KudeKude
提出日時 2020-10-09 21:46:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 163 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 330 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 126,356 KB
最終ジャッジ日時 2023-09-27 16:12:35
合計ジャッジ時間 17,449 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
91,360 KB
testcase_01 AC 83 ms
91,464 KB
testcase_02 AC 76 ms
91,488 KB
testcase_03 AC 74 ms
91,344 KB
testcase_04 AC 74 ms
91,488 KB
testcase_05 AC 76 ms
91,200 KB
testcase_06 AC 76 ms
91,404 KB
testcase_07 AC 77 ms
91,220 KB
testcase_08 AC 77 ms
91,228 KB
testcase_09 AC 75 ms
91,284 KB
testcase_10 AC 76 ms
91,424 KB
testcase_11 AC 76 ms
91,416 KB
testcase_12 AC 76 ms
91,368 KB
testcase_13 AC 76 ms
91,248 KB
testcase_14 AC 75 ms
91,384 KB
testcase_15 AC 76 ms
91,608 KB
testcase_16 AC 74 ms
91,460 KB
testcase_17 AC 76 ms
91,332 KB
testcase_18 AC 160 ms
126,056 KB
testcase_19 AC 155 ms
122,040 KB
testcase_20 AC 126 ms
106,912 KB
testcase_21 AC 84 ms
92,212 KB
testcase_22 AC 129 ms
108,012 KB
testcase_23 AC 84 ms
92,132 KB
testcase_24 AC 140 ms
116,032 KB
testcase_25 AC 123 ms
107,068 KB
testcase_26 AC 98 ms
100,128 KB
testcase_27 AC 83 ms
91,920 KB
testcase_28 AC 154 ms
126,264 KB
testcase_29 AC 157 ms
125,984 KB
testcase_30 AC 156 ms
126,136 KB
testcase_31 AC 157 ms
126,112 KB
testcase_32 AC 160 ms
126,356 KB
testcase_33 AC 155 ms
126,136 KB
testcase_34 AC 160 ms
126,344 KB
testcase_35 AC 158 ms
126,220 KB
testcase_36 AC 161 ms
126,080 KB
testcase_37 AC 162 ms
126,236 KB
testcase_38 AC 155 ms
126,212 KB
testcase_39 AC 162 ms
126,268 KB
testcase_40 AC 159 ms
126,248 KB
testcase_41 AC 163 ms
126,300 KB
testcase_42 AC 155 ms
126,296 KB
testcase_43 AC 74 ms
91,528 KB
testcase_44 AC 74 ms
91,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
d = [0] * (2 * 10 ** 6 + 3)
base = 10 ** 6 + 1
for ai, bi in zip(a, b):
    d[0] -= bi
    d[base + ai] += bi * 2
now = d[0]
for x in range(1, 2 * 10 ** 6 + 3):
    now += d[x]
    if now >= 0:
        break
x -= base
ans = 0
for ai, bi in zip(a, b):
    ans += bi * abs(x - ai)
print(x, ans)
0