結果

問題 No.1564 Sum of Products of Pairs
ユーザー hatsuka_iwa
提出日時 2021-08-21 20:29:43
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 281 bytes
コンパイル時間 1,710 ms
コンパイル使用メモリ 171,268 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-15 11:16:07
合計ジャッジ時間 4,857 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
  int N;
  int64_t sum = 0;
  cin >> N;
  vector<int> A(N * 2);
  for (int &a : A) cin >> a;
  sort(A.begin(), A.end());

  for (int i = 0; i < N * 2 - 1; i += 2)
    sum += A.at(i) * A.at(i + 1);
  cout << sum << endl;
}
0