結果

問題 No.2284 Assembly
ユーザー hongrock
提出日時 2023-04-28 21:48:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 193,068 KB
最終ジャッジ日時 2025-02-12 15:05:00
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 2e5 + 10;
int a[N], b[N];

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);

  int n;
  cin >> n;
  ll s1 = 0, s2 = 0;
  for(int i=0; i<n; ++i){
    cin >> a[i] >> b[i];
    s1 += a[i];
    s2 += b[i];
  }

  ll ans = 0;
  for(int i=0; i<n; ++i){
    s1 -= a[i];
    s2 -= b[i];
    ans += max(a[i] * s2, b[i] * s1);
  }

  cout << ans << '\n';

  return 0;
}
0