結果

問題 No.1564 Sum of Products of Pairs
ユーザー もなもな
提出日時 2021-06-26 13:35:38
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 34 ms / 2,000 ms
コード長 958 bytes
コンパイル時間 2,196 ms
コンパイル使用メモリ 202,716 KB
実行使用メモリ 4,616 KB
最終ジャッジ日時 2023-09-07 16:31:39
合計ジャッジ時間 4,310 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 17 ms
4,380 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 22 ms
4,376 KB
testcase_06 AC 15 ms
4,376 KB
testcase_07 AC 11 ms
4,376 KB
testcase_08 AC 6 ms
4,376 KB
testcase_09 AC 10 ms
4,380 KB
testcase_10 AC 22 ms
4,376 KB
testcase_11 AC 25 ms
4,380 KB
testcase_12 AC 17 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 33 ms
4,584 KB
testcase_19 AC 31 ms
4,380 KB
testcase_20 AC 33 ms
4,532 KB
testcase_21 AC 34 ms
4,612 KB
testcase_22 AC 31 ms
4,380 KB
testcase_23 AC 34 ms
4,604 KB
testcase_24 AC 34 ms
4,592 KB
testcase_25 AC 34 ms
4,592 KB
testcase_26 AC 34 ms
4,540 KB
testcase_27 AC 34 ms
4,616 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define reps(i,s,n) for (int i = (int)(s); i < (int)(n); i++)
#define repit(i,C) for (auto i = (C).begin(); i != (C).end(); i++)
#define pr(a) cout << a
#define prl(a) cout << (a) << endl
#define prld(a) cout << setprecision(15)<< (a) << endl 
#define allrange(a) a.begin(),a.end()

int solve(){
    return 0;
}

int main(){
    std::cin.tie(0); // cinとcoutの同期を解除
    std::ios::sync_with_stdio(false);
    int64_t T;cin >> T;
//  int N,M;cin >> N>>M;
//  int N,M,K;cin >> N>>M>>K;
    vector<int64_t> A(2*T);
    rep(i,2*T) cin >> A[i];
    sort(allrange(A));
    reverse(allrange(A));

    int64_t ans=0;
    auto itr = A.begin();
    while(itr!=A.end()){
        int a = *itr;
        itr++;
        ans += a*(*itr);
        itr++;
    }

    prl(ans);
// if(flg) prl("Yes"); else prl("No");
}
// 
0