Submission #746517

# Submission time Handle Problem Language Result Execution time Memory
746517 2023-05-22T15:50:55 Z vjudge1 Fibonacci representations (CEOI18_fib) C++17
0 / 100
1 ms 340 KB
#include<bits/stdc++.h>
using namespace std;

long long mod=1e9+7;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	vector<long long>now;
	now.push_back(0);
	int n;
	cin>>n;
	vector<int>all(n);
	for(int i=0;i<n;i++){
		cin>>all[i];
	}
	for(int asd=0;asd<n;asd++){
		now.push_back(all[asd]);
		while(true){
			sort(now.begin(),now.end());
			int f=-1;
			for(int i=1;i<(int)now.size()-1;i++){
				if(now[i]==now[i+1]-1){
					f=i;
				}
			}
			if(f!=-1){
				vector<long long>fn;
				for(int i=0;i<(int)now.size();i++){
					if(i==f||i==f+1){
						continue;
					}
					fn.push_back(now[i]);
				}
				fn.push_back(now[f]+2);
				now=fn;
			}
			else{
				break;
			}
		}
		vector<pair<int,int>>dp(asd+3);
//		cout<<asd<<": ";
//		for(auto x:now){
//			cout<<x<<" ";
//		}
//		cout<<"\n";
		int len=0;
		dp[0]=make_pair(1,0);
		for(int i=1;i<(int)now.size();i++){
			len=now[i]-now[i-1]-1;
			if(now[i-1]%2!=now[i]%2){
				dp[i]=make_pair(dp[i-1].first+dp[i-1].second,(dp[i-1].first+dp[i-1].second)*(len/2));
			}
			else{
				dp[i]=make_pair(dp[i-1].first+dp[i-1].second,(dp[i-1].first+dp[i-1].second)*(len/2)+dp[i-1].second);
			}
			dp[i].first%=mod;
			dp[i].second%=mod;
		}
		long long res=dp[(int)now.size()-1].first+dp[(int)now.size()-1].second;
		res%=mod;
		cout<<res<<"\n";
	}	
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -