結果

問題 No.2284 Assembly
ユーザー Alex WiceAlex Wice
提出日時 2023-04-28 22:56:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 167 ms
コンパイル使用メモリ 82,324 KB
実行使用メモリ 97,152 KB
最終ジャッジ日時 2024-04-29 00:17:44
合計ジャッジ時間 4,735 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,840 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 40 ms
51,968 KB
testcase_03 AC 41 ms
51,840 KB
testcase_04 AC 41 ms
51,968 KB
testcase_05 AC 40 ms
51,840 KB
testcase_06 AC 41 ms
51,968 KB
testcase_07 AC 41 ms
51,840 KB
testcase_08 AC 261 ms
96,768 KB
testcase_09 AC 269 ms
96,896 KB
testcase_10 AC 261 ms
97,024 KB
testcase_11 AC 262 ms
97,024 KB
testcase_12 AC 271 ms
97,024 KB
testcase_13 AC 260 ms
97,024 KB
testcase_14 AC 268 ms
97,008 KB
testcase_15 AC 254 ms
97,152 KB
testcase_16 AC 266 ms
97,024 KB
testcase_17 AC 256 ms
97,024 KB
testcase_18 AC 281 ms
96,768 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
A = [list(map(int, input().split())) for _ in range(n)]
asu = sum(a for a, b in A)
bsu = sum(b for a, b in A)
ans = 0
for a, b in A:
    if a * (bsu - b) >= b * (asu - a):
        asu -= a
        bsu -= b
        ans += a * bsu
    else:
        asu -= a
        bsu -= b
        ans += b * asu
print(ans)
0