# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
428377 | Amylopectin | Gondola (IOI14_gondola) | C++14 | 1084 ms | 2636 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include "gondola.h"
//#include "grader.cpp"
using namespace std;
const long long mxn = 4e5 + 10,mo = 1e9 + 9;
struct we
{
long long stn,thn;
};
bool cmp(const struct we &l,const struct we &r)
{
return l.thn < r.thn;
}
struct we so[mxn] = {};
int valid(int n, int inp[])
{
long long i,j,m,stp = -1,of = 0;
for(i=0; i<n; i++)
{
if(stp == -1 && inp[i] <= n)
{
stp = i - inp[i] + 1;
if(stp < 0)
{
stp += n;
}
}
if(stp >= 0 && inp[i] <= n)
{
if((stp + inp[i] - 1) % n != i)
{
of = 1;
break;
}
}
}
if(of == 0)
{
return 1;
}
return 0;
}
int replacement(int n, int inp[], int ans[])
{
long long i,j,ru = 0,stp = -1,fr,ba,rua = 0;
for(i=0; i<n; i++)
{
if(stp == -1 && inp[i] <= n)
{
stp = i - inp[i] + 1;
if(stp < 0)
{
stp += n;
}
break;
}
}
if(stp == -1)
{
stp = 0;
}
for(i=0; i<n; i++)
{
if(inp[i] > n)
{
so[ru] = {(i + n - stp) % n + 1,inp[i]};
ru ++;
}
}
sort(so,so+ru,cmp);
fr = 0;
ba = 0;
// while(ba < ru)
// {
// }
for(i=n+1; i<=so[ru-1].thn; i++)
{
if(i == so[fr].thn)
{
ans[rua] = so[fr].stn;
rua ++;
fr ++;
// if(ba < fr)
// {
// ba = fr;
// }
}
else
{
ans[rua] = so[fr].stn;
so[fr].stn = i;
rua ++;
}
}
return rua;
}
int countReplacement(int n, int inp[])
{
long long i,j,m,stp = -1,of = 0,ans = 1,be,ru = 0,off = 0;
for(i=0; i<n; i++)
{
if(stp == -1 && inp[i] <= n)
{
stp = i - inp[i] + 1;
if(stp < 0)
{
stp += n;
}
}
if(stp >= 0 && inp[i] <= n)
{
if((stp + inp[i] - 1) % n != i)
{
of = 1;
break;
}
}
}
if(of == 1)
{
return 0;
}
if(stp == -1)
{
off = 1;
ans *= n;
stp = 0;
}
for(i=0; i<n; i++)
{
if(inp[i] > n)
{
so[ru] = {(i + n - stp) % n + 1,inp[i]};
ru ++;
}
}
sort(so,so+ru,cmp);
be = n;
for(i=0; i<ru; i++)
{
for(j=be+1; j<so[i].thn; j++)
{
ans *= ru-i;
ans %= mo;
}
be = so[i].thn;
}
return ans;
// return -3;
}
//int main()
//{
//
// 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... |
# | 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... |