結果
問題 |
No.1564 Sum of Products of Pairs
|
ユーザー |
![]() |
提出日時 | 2021-12-07 09:34:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 305 bytes |
コンパイル時間 | 1,639 ms |
コンパイル使用メモリ | 171,788 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-07 10:22:35 |
合計ジャッジ時間 | 7,396 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 4 WA * 3 RE * 23 |
ソースコード
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<int> a(n); for(int i=0; i<2*n; i++) cin >> a[i]; sort(a.begin(),a.end()); reverse(a.begin(),a.end()); long long sum=0; for(int i=0; i<2*n; i+=2) sum += a[i]*a[i+1]; cout << sum << endl; }