結果
| 問題 | 
                            No.1564 Sum of Products of Pairs
                             | 
                    
| コンテスト | |
| ユーザー | 
                             para_math
                         | 
                    
| 提出日時 | 2021-06-26 14:43:14 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 305 bytes | 
| コンパイル時間 | 1,698 ms | 
| コンパイル使用メモリ | 170,828 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-06-25 10:36:23 | 
| 合計ジャッジ時間 | 3,946 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 9 WA * 21 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(2*n);
  for(int i = 0; i < 2*n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  long long ans = 0;
  for(int i = 0; i < n; i++) ans += a[2*i]*a[2*i+1];
  cout << ans << endl;
} 
            
            
            
        
            
para_math