結果
問題 | No.1564 Sum of Products of Pairs |
ユーザー |
![]() |
提出日時 | 2021-06-26 14:40:18 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 308 bytes |
コンパイル時間 | 1,549 ms |
コンパイル使用メモリ | 170,696 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 10:36:28 |
合計ジャッジ時間 | 3,947 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 20 RE * 1 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {int n;cin >> n;vector<int> a(2*n);for(int i = 0; i < 2*n; i++) cin >> a[i];sort(a.begin(), a.end());reverse(a.begin(), a.end());long long ans = 0;for(int i = 0; i < 2*n; i++) ans += a[2*i]*a[2*i+1];cout << ans << endl;}