結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー marroncastlemarroncastle
提出日時 2020-10-09 21:31:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 709 ms / 2,000 ms
コード長 357 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 86,832 KB
実行使用メモリ 129,068 KB
最終ジャッジ日時 2023-09-27 14:54:36
合計ジャッジ時間 26,728 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
71,200 KB
testcase_01 AC 62 ms
71,304 KB
testcase_02 AC 62 ms
71,376 KB
testcase_03 AC 65 ms
71,160 KB
testcase_04 AC 64 ms
71,284 KB
testcase_05 AC 66 ms
71,368 KB
testcase_06 AC 65 ms
71,232 KB
testcase_07 AC 63 ms
71,148 KB
testcase_08 AC 62 ms
71,420 KB
testcase_09 AC 64 ms
71,040 KB
testcase_10 AC 64 ms
71,404 KB
testcase_11 AC 64 ms
71,544 KB
testcase_12 AC 63 ms
71,360 KB
testcase_13 AC 62 ms
71,240 KB
testcase_14 AC 70 ms
71,236 KB
testcase_15 AC 65 ms
71,232 KB
testcase_16 AC 67 ms
71,096 KB
testcase_17 AC 65 ms
71,204 KB
testcase_18 AC 572 ms
128,676 KB
testcase_19 AC 532 ms
122,904 KB
testcase_20 AC 332 ms
101,656 KB
testcase_21 AC 101 ms
77,768 KB
testcase_22 AC 342 ms
103,180 KB
testcase_23 AC 92 ms
77,588 KB
testcase_24 AC 442 ms
118,996 KB
testcase_25 AC 330 ms
102,080 KB
testcase_26 AC 160 ms
87,784 KB
testcase_27 AC 91 ms
77,608 KB
testcase_28 AC 565 ms
128,848 KB
testcase_29 AC 573 ms
128,928 KB
testcase_30 AC 559 ms
128,692 KB
testcase_31 AC 566 ms
128,740 KB
testcase_32 AC 561 ms
128,708 KB
testcase_33 AC 561 ms
128,872 KB
testcase_34 AC 573 ms
129,060 KB
testcase_35 AC 593 ms
128,740 KB
testcase_36 AC 566 ms
128,636 KB
testcase_37 AC 556 ms
128,996 KB
testcase_38 AC 560 ms
129,068 KB
testcase_39 AC 571 ms
128,816 KB
testcase_40 AC 630 ms
129,028 KB
testcase_41 AC 709 ms
128,544 KB
testcase_42 AC 573 ms
128,840 KB
testcase_43 AC 63 ms
71,080 KB
testcase_44 AC 63 ms
71,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
lis = []
for a,b in zip(A,B):
  lis.append((a,b))
lis.sort()
cum = -sum(B)
ans = []
for i in range(N):
  cum += lis[i][1]*2
  if cum>=0:
    x = lis[i][0]
    ans.append(x)
    break
ans.append(0)
for i in range(N):
  ans[1] += lis[i][1]*abs(x-lis[i][0])
print(*ans)

0