Submission #121239

#TimeUsernameProblemLanguageResultExecution timeMemory
121239bekzhan29Fibonacci representations (CEOI18_fib)C++14
5 / 100
79 ms632 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...