답안 #585133

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
585133 2022-06-28T10:41:54 Z krit3379 Fibonacci representations (CEOI18_fib) C++17
5 / 100
133 ms 1736 KB
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 25

int f[N];
map<int,int> mp;

int main(){
    int n,i,j,sum,x;
    scanf("%d",&n);
    assert(n<=15);
    f[0]=1;
    f[1]=2;
    for(i=2;i<=20;i++)f[i]=f[i-1]+f[i-2];
    for(i=0;i<(1<<20);i++){
        sum=0;
        for(j=0;j<20;j++)if(i&(1<<j))sum+=f[j];
        mp[sum]++;
    }
    sum=0;
    while(n--){
        scanf("%d",&x);
        sum+=f[x-1];
        printf("%d\n",mp[sum]);
    }
    return 0;
}

Compilation message

fib.cpp: In function 'int main()':
fib.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
fib.cpp:24:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         scanf("%d",&x);
      |         ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 1624 KB Output is correct
2 Correct 115 ms 1564 KB Output is correct
3 Correct 117 ms 1512 KB Output is correct
4 Correct 116 ms 1560 KB Output is correct
5 Correct 119 ms 1736 KB Output is correct
6 Correct 112 ms 1584 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 1624 KB Output is correct
2 Correct 115 ms 1564 KB Output is correct
3 Correct 117 ms 1512 KB Output is correct
4 Correct 116 ms 1560 KB Output is correct
5 Correct 119 ms 1736 KB Output is correct
6 Correct 112 ms 1584 KB Output is correct
7 Runtime error 1 ms 340 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 1624 KB Output is correct
2 Correct 115 ms 1564 KB Output is correct
3 Correct 117 ms 1512 KB Output is correct
4 Correct 116 ms 1560 KB Output is correct
5 Correct 119 ms 1736 KB Output is correct
6 Correct 112 ms 1584 KB Output is correct
7 Runtime error 1 ms 340 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 428 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 133 ms 1624 KB Output is correct
2 Correct 115 ms 1564 KB Output is correct
3 Correct 117 ms 1512 KB Output is correct
4 Correct 116 ms 1560 KB Output is correct
5 Correct 119 ms 1736 KB Output is correct
6 Correct 112 ms 1584 KB Output is correct
7 Runtime error 1 ms 340 KB Execution killed with signal 6
8 Halted 0 ms 0 KB -