#include "gondola.h"
#include <algorithm>
int arr[250001];
int now[250001];
int valid(int n, int inputSeq[])
{
int i,j;
for(i=0;i<n;i++)if(inputSeq[i]<=n)break;
if(i<n)for(j=0;j<n;j++)if(inputSeq[i]<=n&&(inputSeq[j]+i)%n!=(inputSeq[i]+j)%n)return 0;
std::sort(inputSeq,inputSeq+n);
for(i=1;i<n;i++)if(inputSeq[i-1]==inputSeq[i])return 0;
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
int i,j;
for(i=1;i<=250000;i++)arr[i]=-1;
for(i=0;i<n;i++)arr[gondolaSeq[i]]=i;
for(i=0;i<n;i++)if(gondolaSeq[i]<=n)break;
for(j=0;j<n;j++)now[j]=(gondolaSeq[i]+j-i+n-1)%n+1;
j=0;
for(i=0;i<n;i++)if(gondolaSeq[i]>j)j=gondolaSeq[i];
for(i=n+1;i<=j;i++)
{
replacementSeq[i-n-1]=arr[i]>=0?now[arr[i]]:now[arr[j]];
now[replacementSeq[i-n-1]]=i;
}
return j-n;
}
int countReplacement(int n, int inputSeq[])
{
return -1;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
6 |
Correct |
4 ms |
4408 KB |
Output is correct |
7 |
Correct |
4 ms |
4408 KB |
Output is correct |
8 |
Correct |
16 ms |
4408 KB |
Output is correct |
9 |
Correct |
0 ms |
4408 KB |
Output is correct |
10 |
Correct |
16 ms |
4408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
6 |
Correct |
8 ms |
4408 KB |
Output is correct |
7 |
Correct |
8 ms |
4408 KB |
Output is correct |
8 |
Correct |
16 ms |
4408 KB |
Output is correct |
9 |
Correct |
0 ms |
4408 KB |
Output is correct |
10 |
Correct |
16 ms |
4408 KB |
Output is correct |
11 |
Correct |
0 ms |
4408 KB |
Output is correct |
12 |
Correct |
0 ms |
4408 KB |
Output is correct |
13 |
Correct |
4 ms |
4408 KB |
Output is correct |
14 |
Correct |
0 ms |
4408 KB |
Output is correct |
15 |
Correct |
8 ms |
4408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
6 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
4408 KB |
Output is correct |
2 |
Correct |
0 ms |
4408 KB |
Output is correct |
3 |
Correct |
0 ms |
4408 KB |
Output is correct |
4 |
Correct |
0 ms |
4408 KB |
Output is correct |
5 |
Correct |
0 ms |
4408 KB |
Output is correct |
6 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct - Integer -1 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct - Integer -1 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct - Integer -1 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
4408 KB |
Output isn't correct - Integer -1 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |