結果

問題 No.723 2つの数の和
ユーザー kotatsugame
提出日時 2018-08-23 10:33:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 250 bytes
コンパイル時間 756 ms
コンパイル使用メモリ 70,916 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 17:05:22
合計ジャッジ時間 2,295 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int n,x,a[1<<17];
main(){
	cin>>n>>x;
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	long c=0;
	for(int i=0;i<n;i++)c+=upper_bound(a,a+n,x-a[i])-lower_bound(a,a+n,x-a[i]);
	cout<<c<<endl;
}
0