結果

問題 No.802 だいたい等差数列
ユーザー batasanblogbatasanblog
提出日時 2023-07-20 09:49:07
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,933 bytes
コンパイル時間 4,919 ms
コンパイル使用メモリ 270,772 KB
実行使用メモリ 11,564 KB
最終ジャッジ日時 2023-10-20 11:03:24
合計ジャッジ時間 10,841 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
//using mint = static_modint<998244353>;
using mint = static_modint<1000000007>;
ostream &operator<<(ostream &o,const mint &m){cout<<m.val();return o;}
using ll = long long;
using pl = pair<ll,ll>;
using vl = vector<ll>;
template<class T> using ve = vector<T>;
template<class T> using vv = vector<ve<T>>;
template<class T> using vvv = vector<vv<T>>;
#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 long long INF = 1e18;
#ifdef DEBUG
#include <debug.hpp>
random_device rd;
mt19937 gen(rd());
ll random(ll l,ll h){
	uniform_int_distribution<ll> dist(l,h);
	return dist(gen);
}
#endif

ll N,M,D1,D2;
void input(){
	cin>>N>>M>>D1>>D2;
}
#ifdef DEBUG
void showall(){
	show(N,M,D1,D2);
}
#endif
ll logic(){
	ve<mint> f(M+1,1); f.at(0)=0;
	vector<mint> g(D2+1,1);
	rep(i,D1)g.at(i)=0;
	int n=N-1;
	while(n){
		if(n & 1){
			f = convolution(f,g);
		}
		g = convolution(g,g);
		if(g.size()>M){
			g.resize(M);
		}
	#ifdef DEBUG
		show("n g.sz g",n,g.size(),g);
	#endif
		n >>= 1;
	}
	#ifdef DEBUG
	show("f2",f);
	#endif
	mint ans=0;
	rep(i,M+1){
		ans += f.at(i);
	}
	return ans.val();
}
#ifdef DEBUG
ll naive(){
	return 1;
}
#endif
int main(){
	input();
	#ifdef DEBUG
	showall();
	cout << "--- Logic ---" << endl;
	#endif
	ll ans=logic();
	cout<<ans<<endl;
	//if(logic())cout<<"Yes"<<endl;
	//else cout<<"No"<<endl;
	//while(input())logic();
	#ifdef DEBUG
	//show("naive=",naive());
	#endif
	#ifdef DEBUG
	/*
	rep(q,100){
		N=random(1LL,1000LL);
		showall();
		ll lans=logic(),nans=naive();
		if(lans!=nans){ show(" WA",lans,nans); break; }
		else{ show(" AC",lans,nans); }
	}
	*/
	#endif
	return 0;
}
//cout << fixed << setprecision(9);
0