結果
| 問題 | No.1564 Sum of Products of Pairs |
| コンテスト | |
| ユーザー |
rieaaddlreiuu
|
| 提出日時 | 2022-10-24 22:23:00 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 27 ms / 2,000 ms |
| コード長 | 366 bytes |
| 記録 | |
| コンパイル時間 | 1,011 ms |
| コンパイル使用メモリ | 185,964 KB |
| 実行使用メモリ | 6,144 KB |
| 最終ジャッジ日時 | 2026-03-24 08:31:08 |
| 合計ジャッジ時間 | 2,537 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
vector<long> a;
int N;
long temp;
scanf("%d",&N);
for(int i=0;i<2*N;i++){
scanf("%ld",&temp);
a.push_back(temp);
}
sort(a.begin(),a.end());
long ans = 0;
for(int i=0;i<2*N;i+=2){
ans += a[i]*a[i+1];
}
printf("%ld",ans);
}
rieaaddlreiuu