結果

問題 No.1251 絶対に間違ってはいけない最小化問題
ユーザー realDivineJKrealDivineJK
提出日時 2020-10-09 22:41:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 703 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 44,052 KB
最終ジャッジ日時 2023-09-27 18:37:45
合計ジャッジ時間 25,008 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,920 KB
testcase_01 AC 14 ms
7,984 KB
testcase_02 AC 14 ms
7,772 KB
testcase_03 AC 14 ms
7,764 KB
testcase_04 AC 14 ms
7,816 KB
testcase_05 AC 14 ms
7,904 KB
testcase_06 AC 14 ms
7,848 KB
testcase_07 AC 13 ms
7,824 KB
testcase_08 AC 14 ms
7,772 KB
testcase_09 AC 13 ms
7,820 KB
testcase_10 AC 14 ms
7,916 KB
testcase_11 AC 13 ms
7,924 KB
testcase_12 AC 13 ms
7,772 KB
testcase_13 AC 15 ms
7,776 KB
testcase_14 AC 13 ms
7,772 KB
testcase_15 AC 14 ms
7,752 KB
testcase_16 AC 13 ms
7,952 KB
testcase_17 AC 14 ms
7,828 KB
testcase_18 AC 628 ms
40,824 KB
testcase_19 AC 597 ms
39,848 KB
testcase_20 AC 301 ms
26,120 KB
testcase_21 AC 46 ms
10,552 KB
testcase_22 AC 331 ms
27,888 KB
testcase_23 AC 35 ms
10,404 KB
testcase_24 AC 455 ms
33,984 KB
testcase_25 AC 303 ms
27,008 KB
testcase_26 AC 95 ms
14,832 KB
testcase_27 AC 35 ms
10,260 KB
testcase_28 AC 663 ms
43,960 KB
testcase_29 AC 663 ms
43,772 KB
testcase_30 AC 666 ms
43,884 KB
testcase_31 AC 652 ms
43,780 KB
testcase_32 AC 657 ms
44,052 KB
testcase_33 AC 642 ms
43,788 KB
testcase_34 AC 667 ms
43,852 KB
testcase_35 AC 647 ms
41,696 KB
testcase_36 AC 644 ms
42,140 KB
testcase_37 AC 654 ms
43,936 KB
testcase_38 AC 648 ms
43,852 KB
testcase_39 AC 660 ms
43,704 KB
testcase_40 AC 703 ms
44,044 KB
testcase_41 AC 671 ms
43,780 KB
testcase_42 AC 644 ms
43,956 KB
testcase_43 AC 14 ms
7,768 KB
testcase_44 AC 15 ms
7,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
X = -1
for i in range(N):
    if S * (S - 2 * C[i][1]) <= 0:
        X = C[i][0]
        break
    S -= 2 * C[i][1]

SS = 0
for i in range(N):
    SS += B[i] * abs(X - A[i])
print(X, SS)
0