結果
問題 |
No.1564 Sum of Products of Pairs
|
ユーザー |
![]() |
提出日時 | 2021-12-07 09:37:01 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 68 ms / 2,000 ms |
コード長 | 312 bytes |
コンパイル時間 | 1,692 ms |
コンパイル使用メモリ | 171,076 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 10:22:39 |
合計ジャッジ時間 | 3,491 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int N; cin >> N; vector<long int>A(2*N); for (int i=0; i<2*N; i++) { cin >> A[i]; } sort(A.begin(),A.end()); long int ans=0; for (int i=0; i<2*N; i+=2) { ans+=A[i]*A[i+1]; } cout << ans << endl; }