# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
121239 | bekzhan29 | Fibonacci representations (CEOI18_fib) | C++14 | 79 ms | 632 KiB |
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>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define pb push_back
#define mp make_pair
#define INF 3e9
#define mod 1000000007
#define eps 1e-6
#define abs(x) ((x)>=0?(x):-(x))
#define y1 solai
#define fi first
#define se second
typedef long long ll;
void read(ll &x)
{
scanf("%lld",&x);
}
void read(ll &x, ll &y)
{
scanf("%lld%lld",&x,&y);
}
void read(ll &x, ll &y, ll &z)
{
scanf("%lld%lld%lld",&x,&y,&z);
}
void print(ll x)
{
printf("%lld ",x);
}
void println(ll x)
{
printf("%lld\n",x);
}
const ll N=300100;
ll n,f[N],cnt[N],s,ans,x;
int main()
{
f[1]=1;
f[2]=2;
for(ll i=3;i<=43;i++)
f[i]=f[i-1]+f[i-2];
for(ll i=0;i<(1<<20);i++)
{
s=0;
for(ll j=0;j<20;j++)
if((i>>j)&1)
s+=f[j+1];
cnt[s]++;
}
cin>>n;
if(n>15)
return 0;
s=0;
for(ll i=1;i<=n;i++)
{
read(x);
if(x>15)
break;
s+=f[x];
println(cnt[s]);
}
}
Compilation message (stderr)
# | 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... |