#include "gondola.h"
#include <iostream>
#include <algorithm>
int valid(int n, int a[])
{
bool visited[250010] = { 0 };
int remember = -1;
for (int i = 0; i < n; ++i)
{
--a[i];
if (visited[a[i]])
return 0;
else
visited[a[i]] = 1;
if (a[i] < n)
{
if (remember == -1)
remember = i;
else
{
int val1 = a[remember];
int val2 = a[i];
if (val1 > val2)
{
if (remember == (i + (val1 - val2)) % n)
continue;
else
return 0;
}
else
{
if (i == (remember + (val2 - val1)) % n)
continue;
else
return 0;
}
}
}
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
504 KB |
Output is correct |
2 |
Correct |
3 ms |
744 KB |
Output is correct |
3 |
Correct |
2 ms |
744 KB |
Output is correct |
4 |
Correct |
3 ms |
744 KB |
Output is correct |
5 |
Correct |
3 ms |
756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
756 KB |
Output is correct |
2 |
Correct |
3 ms |
800 KB |
Output is correct |
3 |
Correct |
3 ms |
824 KB |
Output is correct |
4 |
Correct |
3 ms |
824 KB |
Output is correct |
5 |
Correct |
2 ms |
824 KB |
Output is correct |
6 |
Correct |
9 ms |
872 KB |
Output is correct |
7 |
Correct |
17 ms |
1124 KB |
Output is correct |
8 |
Correct |
13 ms |
1124 KB |
Output is correct |
9 |
Correct |
7 ms |
1124 KB |
Output is correct |
10 |
Correct |
15 ms |
1244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
1244 KB |
Output is correct |
2 |
Correct |
3 ms |
1244 KB |
Output is correct |
3 |
Correct |
4 ms |
1244 KB |
Output is correct |
4 |
Correct |
3 ms |
1244 KB |
Output is correct |
5 |
Correct |
3 ms |
1244 KB |
Output is correct |
6 |
Correct |
8 ms |
1244 KB |
Output is correct |
7 |
Correct |
16 ms |
1260 KB |
Output is correct |
8 |
Correct |
13 ms |
1260 KB |
Output is correct |
9 |
Correct |
9 ms |
1260 KB |
Output is correct |
10 |
Correct |
15 ms |
1260 KB |
Output is correct |
11 |
Correct |
2 ms |
1260 KB |
Output is correct |
12 |
Correct |
3 ms |
1260 KB |
Output is correct |
13 |
Correct |
7 ms |
1260 KB |
Output is correct |
14 |
Correct |
2 ms |
1260 KB |
Output is correct |
15 |
Correct |
14 ms |
1260 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1260 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |