結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2021-06-26 13:03:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 73 ms / 2,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 1,756 ms |
| コンパイル使用メモリ | 170,628 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-25 10:08:19 |
| 合計ジャッジ時間 | 4,021 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> A(N * 2);
for (int i = 0; i < N * 2; i++){
cin >> A[i];
}
sort(A.begin(), A.end());
long long ans = 0;
for (int i = 0; i < N * 2; i += 2){
ans += (long long) A[i] * A[i + 1];
}
cout << ans << endl;
}
SSRS