# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
424639 | Rouge_Hugo | Fibonacci representations (CEOI18_fib) | C++14 | 4067 ms | 460 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>
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
const int N=15009;
int a[N],c[N],b[N];
vector<int>v;
void go(int x,int sum)
{
if(x==v.size())
{
if(sum>15000)return;
b[sum]++;
return;
}
go(x+1,sum);
go(x+1,sum+v[x]);
}
int main()
{
a[1]=1;a[2]=2;
v.pb(1);v.pb(2);
for(int i=3;i<=20;i++)
{
a[i]=a[i-1]+a[i-2];
v.pb(a[i]);
}
go(0,0);
int n;cin>>n;ll r=0;
for(int i=0;i<n;i++)cin>>c[i];
for(int i=0;i<n;i++)
{
r+=a[c[i]];
if(r>15000)while(1)r++;
cout<<b[r]<<endl;
}
}
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... |