結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー cookie63cookie63
提出日時 2023-04-15 15:00:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 426 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,392 KB
実行使用メモリ 115,356 KB
最終ジャッジ日時 2024-04-19 09:14:59
合計ジャッジ時間 17,076 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
52,992 KB
testcase_01 AC 41 ms
52,992 KB
testcase_02 AC 40 ms
53,376 KB
testcase_03 AC 41 ms
53,248 KB
testcase_04 AC 40 ms
53,248 KB
testcase_05 AC 41 ms
52,992 KB
testcase_06 AC 40 ms
53,248 KB
testcase_07 AC 39 ms
53,248 KB
testcase_08 WA -
testcase_09 AC 42 ms
53,888 KB
testcase_10 AC 40 ms
53,504 KB
testcase_11 AC 40 ms
53,120 KB
testcase_12 AC 41 ms
52,864 KB
testcase_13 AC 41 ms
53,248 KB
testcase_14 AC 41 ms
53,376 KB
testcase_15 AC 41 ms
53,376 KB
testcase_16 AC 41 ms
53,744 KB
testcase_17 AC 41 ms
53,504 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 41 ms
53,248 KB
testcase_44 AC 40 ms
53,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import copy
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = copy(a)
c = sorted(c)

ind = n//2-3
ans = (None, pow(10, 15))
for i in range(6):
    j = ind+i
    if j>=n:
        continue
    if j<0:
        continue
    x = c[j]
    tmp = 0
    for k in range(n):
        tmp += b[k] * abs(x-a[k])
    if tmp<ans[1]:
        ans = (x, tmp)

print(" ".join(map(str, ans)))

0