# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
287534 | TadijaSebez | Fibonacci representations (CEOI18_fib) | C++11 | 4046 ms | 1908 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |