結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
rieaaddlreiuu
|
| 提出日時 | 2022-10-24 22:23:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 42 ms / 2,000 ms |
| コード長 | 366 bytes |
| コンパイル時間 | 1,695 ms |
| コンパイル使用メモリ | 172,572 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-03 01:07:45 |
| 合計ジャッジ時間 | 3,571 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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