結果
問題 | No.1564 Sum of Products of Pairs |
ユーザー |
![]() |
提出日時 | 2022-10-24 22:18:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 352 bytes |
コンパイル時間 | 1,490 ms |
コンパイル使用メモリ | 170,804 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 01:05:12 |
合計ジャッジ時間 | 4,090 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 21 |
ソースコード
#include <bits/stdc++.h>#include <vector>using namespace std;int main(){vector<int> a;int N,temp;scanf("%d",&N);for(int i=0;i<2*N;i++){scanf("%d",&temp);a.push_back(temp);}sort(a.begin(),a.end());int ans = 0;for(int i=0;i<2*N;i+=2){ans += a[i]*a[i+1];}printf("%d",ans);}