#include<bits/stdc++.h>
using namespace std;
const int INF=1123456789,MAXN=112345;
#define debug(args...) //fprintf(stderr,args)
map<int,int> vld;
#include "gondola.h"
int valid(int n,int seq[])
{
int mn=INF,at=INF,at2=INF,id0=0;
int st=0;
bool vl=1;
for(int i=0;i<n;i++)
{
if(vl==0)debug("%d\n",i);
if(vld[seq[i]]>0)vl=0;
vld[seq[i]]++;
if(st==0)
{
if(seq[i]>n)continue;
if(seq[i]<at && at==INF)
{
at=seq[i];mn=seq[i];
id0=(i+1-mn+n)%n;
}
else if(seq[i]<at)
{
at2=seq[i];st=1;
if(at2>mn)vl=0;
}
else
{
if((id0+seq[i]-1)%n!=i)vl=0;
at=seq[i];
}
}
else
{
if(seq[i]>n)continue;
if(seq[i]<at2 || seq[i]>mn || seq[i]>at)vl=0;
if((id0+seq[i]-1)%n!=i)vl=0;
at2=seq[i];
}
debug("%d %d %d\n",i,id0,(id0+seq[i])%n);
}
return vl;
}
int replacement(int n,int gondolaseq[],int replacementseq[])
{
return 0;
}
int countReplacement(int n,int inputSeq[])
{
return 0;
}
/*int main()
{
int n;
int v[40];
scanf("%d",&n);
for(int i=0;i<n;i++)scanf("%d",&v[i]);
printf("%d\n",valid(n,v));
return 0;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
16 ms |
2276 KB |
Output is correct |
7 |
Correct |
41 ms |
3704 KB |
Output is correct |
8 |
Correct |
29 ms |
3960 KB |
Output is correct |
9 |
Correct |
10 ms |
1536 KB |
Output is correct |
10 |
Correct |
39 ms |
4600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
284 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
17 ms |
2256 KB |
Output is correct |
7 |
Correct |
40 ms |
3704 KB |
Output is correct |
8 |
Correct |
30 ms |
3960 KB |
Output is correct |
9 |
Correct |
9 ms |
1536 KB |
Output is correct |
10 |
Correct |
43 ms |
4608 KB |
Output is correct |
11 |
Correct |
3 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
20 ms |
2304 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
57 ms |
5240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |