結果

問題 No.1564 Sum of Products of Pairs
ユーザー kotatsugame
提出日時 2021-06-29 20:07:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 938 ms
コンパイル使用メモリ 74,584 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-25 22:32:33
合計ジャッジ時間 3,716 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
main()
{
	cin>>N;
	vector<long>A(2*N);
	for(long&a:A)cin>>a;
	sort(A.begin(),A.end());
	long ans=0;
	for(int i=0;i<N;i++)ans+=A[i*2]*A[i*2+1];
	cout<<ans<<endl;
}
0