이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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(25);
F[1] = 1;
F[2] = 2;
rep(i,3,25) 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... |