結果
| 問題 |
No.1564 Sum of Products of Pairs
|
| コンテスト | |
| ユーザー |
chacoder1
|
| 提出日時 | 2021-12-30 19:07:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 89 ms / 2,000 ms |
| コード長 | 283 bytes |
| コンパイル時間 | 2,289 ms |
| コンパイル使用メモリ | 195,624 KB |
| 最終ジャッジ日時 | 2025-01-27 07:42:33 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
signed main(){
int n;cin>>n;
int a[2*n];
rep(i,n*2) cin>>a[i];
sort(a,a+2*n);
int ans=0;
rep(i,n){
ans+=(a[i*2]*a[i*2+1]);
}
cout<<ans<<endl;
return 0;
}
chacoder1