| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 287542 | TadijaSebez | Fibonacci representations (CEOI18_fib) | C++11 | 4065 ms | 2484 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;}
map<int,int> cnt;
void Inc(int a){
cnt[a]++;
while(cnt[a-1]&&cnt[a]){
cnt[a-1]--;
cnt[a]--;
cnt[a+1]++;
a++;
if(!(cnt[a-1]&&cnt[a]))a++;
}
}
void Fix(){
if(cnt[1]>1){
cnt[1]-=2;
Inc(2);
}
if(cnt[2]>1){
cnt[2]-=2;
Inc(1);
Inc(3);
}
}
int main(){
int n;
scanf("%i",&n);
for(int i=1;i<=n;i++){
int a;
scanf("%i",&a);
Inc(a);
Fix();
int mx=0;
int dp[2]={1,0},las=0;
for(auto it:cnt){
int j=it.first;
if(!it.second)continue;
if(it.second==1){
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;
}else if(it.second==2){
int sz=j-las-1;
int d0=add(mul(dp[0],sz/2),mul(dp[1],(sz+1)/2));
dp[0]=d0;
dp[1]=0;
}else dp[0]=dp[1]=0;
}
int ans=add(dp[0],dp[1]);
printf("%i\n",ans);
}
return 0;
}
컴파일 시 표준 에러 (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... | ||||
