結果
問題 | No.2284 Assembly |
ユーザー |
|
提出日時 | 2023-02-10 21:14:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 124 ms / 2,000 ms |
コード長 | 422 bytes |
コンパイル時間 | 693 ms |
コンパイル使用メモリ | 66,348 KB |
最終ジャッジ日時 | 2025-02-10 12:00:19 |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 |
ソースコード
#include <iostream> using namespace std; typedef long long ll; void solve() { int n; cin >> n; ll a[200002], b[200002]; for(int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } ll sa = 0, sb = 0; ll ans = 0; for(int i = n - 1; i >= 0; i--) { ans += max(sa * b[i], sb * a[i]); sa += a[i]; sb += b[i]; } cout << ans << endl; } int main() { solve(); }