結果
問題 |
No.1251 絶対に間違ってはいけない最小化問題
|
ユーザー |
|
提出日時 | 2023-04-15 15:00:43 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 241 ms |
コンパイル使用メモリ | 82,520 KB |
実行使用メモリ | 114,864 KB |
最終ジャッジ日時 | 2024-10-11 01:47:35 |
合計ジャッジ時間 | 17,504 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 26 |
ソースコード
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)))