結果
| 問題 | No.1564 Sum of Products of Pairs |
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2021-12-30 07:46:21 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 48 ms / 2,000 ms |
| + 908µs | |
| コード長 | 373 bytes |
| 記録 | |
| コンパイル時間 | 436 ms |
| コンパイル使用メモリ | 90,240 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-10 16:33:48 |
| 合計ジャッジ時間 | 3,962 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n;cin>>n;
vector<long long> A(2*n);
for(int i = 0; 2*n > i; i++){
cin>>A[i];
}
sort(A.begin(),A.end(),greater<long long>());
long long ans = 0;
for(int i = 0; n > i; i++){
ans += A[2*i]*A[2*i+1];
}
cout << ans << endl;
}