답안 #424639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
424639 2021-06-12T08:26:28 Z Rouge_Hugo Fibonacci representations (CEOI18_fib) C++14
5 / 100
4000 ms 460 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<=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

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())
      |        ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 352 KB Output is correct
2 Correct 7 ms 356 KB Output is correct
3 Correct 7 ms 356 KB Output is correct
4 Correct 7 ms 360 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 352 KB Output is correct
2 Correct 7 ms 356 KB Output is correct
3 Correct 7 ms 356 KB Output is correct
4 Correct 7 ms 360 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
8 Execution timed out 4067 ms 332 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 352 KB Output is correct
2 Correct 7 ms 356 KB Output is correct
3 Correct 7 ms 356 KB Output is correct
4 Correct 7 ms 360 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
8 Execution timed out 4067 ms 332 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 460 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 352 KB Output is correct
2 Correct 7 ms 356 KB Output is correct
3 Correct 7 ms 356 KB Output is correct
4 Correct 7 ms 360 KB Output is correct
5 Correct 7 ms 332 KB Output is correct
6 Correct 7 ms 364 KB Output is correct
7 Correct 7 ms 364 KB Output is correct
8 Execution timed out 4067 ms 332 KB Time limit exceeded
9 Halted 0 ms 0 KB -