結果
| 問題 |
No.1251 絶対に間違ってはいけない最小化問題
|
| コンテスト | |
| ユーザー |
trineutron
|
| 提出日時 | 2020-10-09 21:32:05 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 346 bytes |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 41,704 KB |
| 最終ジャッジ日時 | 2024-07-20 08:59:49 |
| 合計ジャッジ時間 | 26,202 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 1 WA * 41 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = [(a[i], b[i]) for i in range(n)]
c.sort()
s = sum(b)
idx = 0
t = 0
for i in range(n):
t += c[i][0]
if t >= s - t:
idx = i
break
x = c[idx][0]
ans = 0
for i in range(n):
ans += c[i][1] * abs(x - c[i][0])
print(c[idx][0], ans)
trineutron