#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
786 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
786 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2445 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
786 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
692 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
786 ms |
324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |