Submission #121239

# Submission time Handle Problem Language Result Execution time Memory
121239 2019-06-26T08:53:08 Z bekzhan29 Fibonacci representations (CEOI18_fib) C++14
5 / 100
79 ms 632 KB
#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

fib.cpp: In function 'void read(ll&)':
fib.cpp:22:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&x);
  ~~~~~^~~~~~~~~~~
fib.cpp: In function 'void read(ll&, ll&)':
fib.cpp:26:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld",&x,&y);
  ~~~~~^~~~~~~~~~~~~~~~~~
fib.cpp: In function 'void read(ll&, ll&, ll&)':
fib.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld",&x,&y,&z);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 69 ms 632 KB Output is correct
2 Correct 69 ms 504 KB Output is correct
3 Correct 70 ms 604 KB Output is correct
4 Correct 79 ms 504 KB Output is correct
5 Correct 71 ms 508 KB Output is correct
6 Correct 71 ms 520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 69 ms 632 KB Output is correct
2 Correct 69 ms 504 KB Output is correct
3 Correct 70 ms 604 KB Output is correct
4 Correct 79 ms 504 KB Output is correct
5 Correct 71 ms 508 KB Output is correct
6 Correct 71 ms 520 KB Output is correct
7 Incorrect 71 ms 596 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 632 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 632 KB Output is correct
2 Correct 69 ms 504 KB Output is correct
3 Correct 70 ms 604 KB Output is correct
4 Correct 79 ms 504 KB Output is correct
5 Correct 71 ms 508 KB Output is correct
6 Correct 71 ms 520 KB Output is correct
7 Incorrect 71 ms 596 KB Output isn't correct
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 75 ms 584 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 632 KB Output is correct
2 Correct 69 ms 504 KB Output is correct
3 Correct 70 ms 604 KB Output is correct
4 Correct 79 ms 504 KB Output is correct
5 Correct 71 ms 508 KB Output is correct
6 Correct 71 ms 520 KB Output is correct
7 Incorrect 71 ms 596 KB Output isn't correct
8 Halted 0 ms 0 KB -