104582024-04-02 23:12:23111Fibonacci Sequencescpp17Wrong answer 0/100177ms19564 KiB
#include<bits/stdc++.h>
using namespace std;

#define int long long

vector<int>f,v,F;

map<int,int>m;

void solve(int x,int i,int c,int d){
	if(x>1000000000){
		return;
	}
	if(d){
		int ans=1;
		v.push_back(c);
		int dd=d;
		for(int j:v){
			ans*=F[dd]/F[j]/F[dd-j];
			dd-=j;
		}
		m[x]+=ans;
		v.pop_back();
	}
	for(int j=i;j<f.size();j++){
		if(j==i){
			solve(x*f[j],j,c+1,d+1);
		}
		else{
			v.push_back(c);
			solve(x*f[j],j,1,d+1);
			v.pop_back();
		}
	}
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	f.push_back(1);
	f.push_back(2);
	F.push_back(1);
	for(int i=0;i<42;i++){
		f.push_back(*--f.end()+*----f.end());
		F.push_back(F.back()*(i+1));
	}
	cout<<f.back()<<endl;
	solve(1,1,0,0);
	int T;
	cin>>T;
	while(T--){
		int M;
		cin>>M;
		if(M==1){
			cout<<1<<'\n';
			continue;
		}
		cout<<m[M]<<'\n';
	}
	return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Wrong answer112ms11608 KiB
2Wrong answer111ms11796 KiB
subtask20/25
3Wrong answer122ms12028 KiB
4Wrong answer112ms12096 KiB
5Wrong answer111ms12324 KiB
6Wrong answer111ms12328 KiB
subtask30/25
7Wrong answer112ms12832 KiB
8Wrong answer112ms12924 KiB
9Wrong answer111ms13060 KiB
10Wrong answer111ms13312 KiB
subtask40/25
11Wrong answer167ms19288 KiB
12Wrong answer166ms19416 KiB
subtask50/25
13Wrong answer177ms19544 KiB
14Wrong answer175ms19564 KiB