Submission #287534

#TimeUsernameProblemLanguageResultExecution timeMemory
287534TadijaSebezFibonacci representations (CEOI18_fib)C++11
15 / 100
4046 ms1908 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int mod=1e9+7; int add(int x,int y){x+=y;return x>=mod?x-mod:x;} int mul(int x,int y){return (ll)x*y%mod;} set<int> f; int main(){ int n; scanf("%i",&n); for(int i=1;i<=n;i++){ int a; scanf("%i",&a); f.insert(a); int dp[2]={1,0},las=0; for(int j:f){ int d0=add(dp[1],dp[0]); int sz=j-las-1; int d1=mul(dp[0],sz/2); sz++; d1=add(d1,mul(dp[1],sz/2)); las=j; dp[0]=d0; dp[1]=d1; } int ans=add(dp[0],dp[1]); printf("%i\n",ans); } return 0; }

Compilation message (stderr)

fib.cpp: In function 'int main()':
fib.cpp:10:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |  scanf("%i",&n);
      |  ~~~~~^~~~~~~~~
fib.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |   scanf("%i",&a);
      |   ~~~~~^~~~~~~~~
#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...