結果
| 問題 | No.1564 Sum of Products of Pairs | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-08-11 02:15:24 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 84 ms / 2,000 ms | 
| コード長 | 322 bytes | 
| コンパイル時間 | 908 ms | 
| コンパイル使用メモリ | 78,056 KB | 
| 最終ジャッジ日時 | 2025-01-23 17:27:49 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(void){
    int N;long long ans=0;
    cin >> N;
    vector<long long> A(2*N);
    for(int i=0;i<2*N;i++)cin >> A[i];
    sort(A.begin(),A.end());
    for(int i=0;i<N;i++)ans+=A[2*i]*A[2*i+1];
    cout << ans << endl;
    return 0;
}
            
            
            
        