結果
| 問題 | No.1564 Sum of Products of Pairs | 
| コンテスト | |
| ユーザー |  forest3 | 
| 提出日時 | 2021-06-30 19:38:45 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 73 ms / 2,000 ms | 
| コード長 | 308 bytes | 
| コンパイル時間 | 1,631 ms | 
| コンパイル使用メモリ | 172,732 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-27 05:42:05 | 
| 合計ジャッジ時間 | 4,648 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 30 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	cin >> N;
	vector<long long> 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; i++ ) {
		ans += A[i * 2] * A[i * 2 + 1];
	}
	cout << ans << endl;
}
            
            
            
        