結果

問題 No.1060 素敵な宝箱
ユーザー convexineqconvexineq
提出日時 2021-05-11 08:16:40
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 81,576 KB
実行使用メモリ 76,384 KB
最終ジャッジ日時 2023-10-21 12:46:05
合計ジャッジ時間 2,915 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
55,424 KB
testcase_01 AC 46 ms
55,424 KB
testcase_02 AC 47 ms
55,424 KB
testcase_03 AC 45 ms
55,424 KB
testcase_04 AC 45 ms
55,424 KB
testcase_05 AC 46 ms
55,424 KB
testcase_06 AC 46 ms
55,424 KB
testcase_07 AC 46 ms
55,424 KB
testcase_08 AC 60 ms
63,972 KB
testcase_09 AC 56 ms
63,996 KB
testcase_10 AC 55 ms
63,996 KB
testcase_11 AC 54 ms
63,996 KB
testcase_12 AC 64 ms
72,208 KB
testcase_13 AC 66 ms
73,600 KB
testcase_14 AC 74 ms
76,176 KB
testcase_15 AC 79 ms
76,360 KB
testcase_16 AC 74 ms
76,112 KB
testcase_17 AC 63 ms
70,148 KB
testcase_18 AC 66 ms
73,564 KB
testcase_19 AC 65 ms
72,208 KB
testcase_20 AC 77 ms
76,232 KB
testcase_21 AC 77 ms
76,224 KB
testcase_22 AC 77 ms
76,292 KB
testcase_23 AC 65 ms
72,264 KB
testcase_24 AC 81 ms
76,384 KB
testcase_25 AC 81 ms
76,384 KB
testcase_26 AC 80 ms
76,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from functools import reduce
add = lambda x,y: [v+w for v,w in zip(x,y)]
n,m = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(n)]
r = reduce(add,a)
p = [sum(rj*aij for rj,aij in zip(r,ai)) for i,ai in enumerate(a)]
order = sorted(range(n),key = lambda i:p[i],reverse=1)
x = reduce(add,[a[idx] for idx in order[::2]])
print(sum(xi**2 for xi in x) - sum((ri-xi)**2 for ri,xi in zip(r,x)))
0