結果
問題 |
No.1564 Sum of Products of Pairs
|
ユーザー |
|
提出日時 | 2021-09-05 10:48:32 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 83 ms / 2,000 ms |
コード長 | 317 bytes |
コンパイル時間 | 2,144 ms |
コンパイル使用メモリ | 197,032 KB |
最終ジャッジ日時 | 2025-01-24 08:15:03 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; vector<ll> a(2*n); for(int i=0;i < 2*n;i++) cin >> a[i]; sort(a.begin(),a.end()); ll ans = 0; for(int i=0;i < n;i++) ans += a[2*i]*a[2*i+1]; cout << ans << endl; return 0; }