This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;
const ll mod = 1e9+7;
ll n;
vi a;
vi F;
ll solve(ll k){
/*map<ll,ll> m;
rep(i,0,k){
m[a[i]]++;
}
for(auto it = m.begin(); it!=m.end();it++){
if(it->second>1&&it!=m.begin()&&prev(it)->second==1){
}
if(it->second>1) return 0;
}*/
ll p = 0;
rep(i,0,k) p += F[a[i]];
ll ans = 0;
rep(mask,0,(1<<20)){
ll sum = 0;
rep(i,0,20){
if((1<<i)&mask){
sum+=F[i+1];
}
}
ans+=(sum==p);
}
return ans;
}
int main(){
cin.sync_with_stdio(false);
ll n; cin>>n;
a.resize(n);
rep(i,0,n){
cin>>a[i];
}
F.resize(20);
F[1] = 1;
F[2] = 2;
rep(i,3,20) F[i] = F[i-2]+F[i-1];
rep(i,0,n) cout<<solve(i+1)<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |