結果

問題 No.1564 Sum of Products of Pairs
ユーザー tadanoningen
提出日時 2021-09-05 10:45:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 319 bytes
コンパイル時間 2,162 ms
コンパイル使用メモリ 197,064 KB
最終ジャッジ日時 2025-01-24 08:14:54
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#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-2]*a[2*i-1];
    
    cout << ans << endl;
    return 0;
}
0