結果

問題 No.723 2つの数の和
ユーザー batasanblog
提出日時 2025-09-13 20:24:19
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 2,651 bytes
コンパイル時間 5,407 ms
コンパイル使用メモリ 335,068 KB
実行使用メモリ 12,316 KB
最終ジャッジ日時 2025-09-13 20:24:27
合計ジャッジ時間 8,126 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using mint=static_modint<998244353>;
//using mint = modint;
//using mint=static_modint<1000000007>;
using ll=long long;
using ull=unsigned long long;
using pl=pair<ll,ll>;
using vl=vector<ll>;
#define rep(i,n) for(ll i=0;i<(ll)(n);++i)
#define reps(i,s,n) for(ll i=(s);i<(ll)(n);++i)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define be(v) (v).begin(),(v).end()
const ll INF=4e18;
template<typename T>inline ll at(T&w){return w.size();}
#ifdef DEBUG
template<typename T>
void check_range(T&w,auto&&a,const source_location& l){
	if(a<0||a>=at(w)){
		cerr<<"OORange! line "<<l.line()<<" col "<<l.column()<<" index "<<a<<" size "<<w.size()<<" func "<<l.function_name()<<endl;
		assert(false);
	}
}
template<typename T>
decltype(auto)at(T&w,auto&&a,const source_location&l=source_location::current()){
	check_range(w,a,l); // if slower, delete it.
	return w[a];
}
template<typename T>
decltype(auto)at(T&w,auto&&a,auto&&b,const source_location&l=source_location::current()){
	return at(at(w,a,l),b,l);
}
template<typename T>
decltype(auto)at(T&w,auto&&a,auto&&b,auto&&c,const source_location&l=source_location::current()){
	return at(at(w,a,b,l),c,l);
}
template<typename T>
decltype(auto)at(T&w,auto&&a,auto&&b,auto&&c,auto&&d,const source_location&l=source_location::current()){
	return at(at(w,a,b,c,l),d,l);
}
template<typename T>
decltype(auto)at(T&w,pl a,const source_location&l=source_location::current()){
	return at(w,a.fi,a.se,l);
}
#else
template<typename T>inline decltype(auto)at(T&w,auto&&a){return w[a];}
template<typename T>inline decltype(auto)at(T&w,auto&&a,auto&&b){return w[a][b];}
template<typename T>inline decltype(auto)at(T&w,auto&&a,auto&&b,auto&&c){return w[a][b][c];}
template<typename T>inline decltype(auto)at(T&w,auto&&a,auto&&b,auto&&c,auto&&d){return w[a][b][c][d];}
template<typename T>inline decltype(auto)at(T&w,pl a){return w[a.fi][a.se];}
#endif
#ifdef DEBUG
#include <debug.hpp>
#else
#define show(...)
#endif

auto logic(){
	ll N,X,mx=0;
	cin>>N>>X;
	vl A(N);
	rep(n,N){
		ll a;cin>>a;
		at(A,n)=a;
		mx=max(mx,a);
	}
	if(X>mx+mx)return 0ll;
	vl f(mx+1);
	for(auto a:A){
		at(f,a)++;
	}
	f=convolution_ll(f,f);
	return at(f,X);;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	ll t=1;
	//cin>>t;
	//rep(i,t)logic();
	//string a;rep(i,t)logic()?a+="Yes\n":a+="No\n";cout<<a;
	string a;rep(i,t){a+=to_string(logic())+"\n";}cout<<a;
	//string a;rep(i,t){a+=logic();}cout<<a;
	return 0;
}
//cout << fixed << setprecision(15);

0