結果

問題 No.2284 Assembly
ユーザー titiatitia
提出日時 2023-04-29 01:10:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 475 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 526 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 49,792 KB
最終ジャッジ日時 2024-04-29 01:34:14
合計ジャッジ時間 7,226 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 23 ms
10,496 KB
testcase_02 AC 24 ms
10,752 KB
testcase_03 AC 23 ms
10,624 KB
testcase_04 AC 23 ms
10,752 KB
testcase_05 AC 24 ms
10,752 KB
testcase_06 AC 24 ms
10,624 KB
testcase_07 AC 24 ms
10,624 KB
testcase_08 AC 436 ms
49,408 KB
testcase_09 AC 454 ms
49,408 KB
testcase_10 AC 461 ms
49,408 KB
testcase_11 AC 462 ms
49,536 KB
testcase_12 AC 446 ms
49,408 KB
testcase_13 AC 462 ms
49,536 KB
testcase_14 AC 458 ms
49,536 KB
testcase_15 AC 457 ms
49,536 KB
testcase_16 AC 455 ms
49,408 KB
testcase_17 AC 453 ms
49,536 KB
testcase_18 AC 475 ms
49,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N=int(input())
AB=[list(map(int,input().split())) for i in range(N)]

SA=0
SB=0
ANS=0

for i in range(N-1,-1,-1):
    a,b=AB[i]

    if a*SB>b*SA:
        ANS+=a*SB
    else:
        ANS+=b*SA

    SA+=a
    SB+=b

print(ANS)

0