Submission #424625

# Submission time Handle Problem Language Result Execution time Memory
424625 2021-06-12T08:18:29 Z Rouge_Hugo Fibonacci representations (CEOI18_fib) C++14
0 / 100
1 ms 332 KB
#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<=15;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]];
        cout<<b[r]<<endl;
    }
}

Compilation message

fib.cpp: In function 'void go(int, int)':
fib.cpp:12:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     if(x==v.size())
      |        ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 332 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -