#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<<18)){
ll sum = 0;
rep(i,0,18){
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 |
Correct |
185 ms |
376 KB |
Output is correct |
2 |
Correct |
288 ms |
376 KB |
Output is correct |
3 |
Correct |
286 ms |
436 KB |
Output is correct |
4 |
Correct |
21 ms |
488 KB |
Output is correct |
5 |
Correct |
263 ms |
564 KB |
Output is correct |
6 |
Incorrect |
283 ms |
564 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
185 ms |
376 KB |
Output is correct |
2 |
Correct |
288 ms |
376 KB |
Output is correct |
3 |
Correct |
286 ms |
436 KB |
Output is correct |
4 |
Correct |
21 ms |
488 KB |
Output is correct |
5 |
Correct |
263 ms |
564 KB |
Output is correct |
6 |
Incorrect |
283 ms |
564 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
588 ms |
620 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
185 ms |
376 KB |
Output is correct |
2 |
Correct |
288 ms |
376 KB |
Output is correct |
3 |
Correct |
286 ms |
436 KB |
Output is correct |
4 |
Correct |
21 ms |
488 KB |
Output is correct |
5 |
Correct |
263 ms |
564 KB |
Output is correct |
6 |
Incorrect |
283 ms |
564 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
748 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
185 ms |
376 KB |
Output is correct |
2 |
Correct |
288 ms |
376 KB |
Output is correct |
3 |
Correct |
286 ms |
436 KB |
Output is correct |
4 |
Correct |
21 ms |
488 KB |
Output is correct |
5 |
Correct |
263 ms |
564 KB |
Output is correct |
6 |
Incorrect |
283 ms |
564 KB |
Output isn't correct |