結果
問題 | No.2284 Assembly |
ユーザー |
|
提出日時 | 2023-04-29 02:32:28 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 368 bytes |
コンパイル時間 | 2,019 ms |
コンパイル使用メモリ | 195,788 KB |
最終ジャッジ日時 | 2025-02-12 15:52:14 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;using P = pair<ll, ll>;int main () {int N;cin >> N;std::vector<P> A(N);for (auto& [a, b] : A) {cin >> a >> b;}ll ans = 0, sa = 0, sb = 0;for (int i = N - 1; i >= 0; i --) {auto [a, b] = A[i];ans += max(sa * b, sb * a);sa += a; sb += b;}std::cout << ans << std::endl;}