結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-08-07 11:27:01 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 608 bytes |
| コンパイル時間 | 1,359 ms |
| コンパイル使用メモリ | 118,336 KB |
| 最終ジャッジ日時 | 2025-01-23 16:38:11 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 9 WA * 21 |
ソースコード
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
int main() {
int32_t n;
cin >> n;
vector<int32_t> as(2 * n);
for (auto &&a : as) {
cin >> a;
}
sort(as.begin(), as.end());
int64_t ans = 0;
for (auto i = 0; i < n; ++i) {
ans += as[i * 2] * as[i * 2 + 1];
}
cout << ans << endl;
return 0;
}