結果

問題 No.2284 Assembly
コンテスト
ユーザー rin204
提出日時 2024-04-29 21:15:12
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 231 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 248 ms
コンパイル使用メモリ 85,068 KB
実行使用メモリ 101,980 KB
最終ジャッジ日時 2026-05-13 13:23:01
合計ジャッジ時間 4,139 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

n = int(input())
tot_a = 0
tot_b = 0
ans = 0
AB = [list(map(int, input().split())) for _ in range(n)]
for a, b in AB[::-1]:
    bef = b * tot_a
    aft = a * tot_b
    ans += max(bef, aft)
    tot_a += a
    tot_b += b

print(ans)
0