結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
startcpp
|
| 提出日時 | 2021-06-26 13:07:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 74 ms / 2,000 ms |
| コード長 | 323 bytes |
| コンパイル時間 | 790 ms |
| コンパイル使用メモリ | 69,120 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 10:12:19 |
| 合計ジャッジ時間 | 3,319 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <algorithm>
#define int long long
using namespace std;
int n;
int a[200000];
signed main() {
int i;
cin >> n;
for (i = 0; i < 2 * n; i++) cin >> a[i];
sort(a, a + 2 * n);
int ans = 0;
for (i = 0; i < n; i++) {
ans += a[2 * i] * a[2 * i + 1];
}
cout << ans << endl;
return 0;
}
startcpp