結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
mmn15277198
|
| 提出日時 | 2021-07-02 17:24:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 450 bytes |
| コンパイル時間 | 724 ms |
| コンパイル使用メモリ | 80,996 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 02:02:36 |
| 合計ジャッジ時間 | 3,616 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> a(2 * n);
for (int i = 0; i < 2 * n; i++) {
cin >> a[i];
}
sort(a.begin() , a.end());
long long b = 0;
for (int i = 0; i < a.size() - 1; i += 2) {
long long now = a[i] * a[i + 1];
//cout << now << endl;
b += now;
}
cout << b << endl;
return 0;
}
mmn15277198