#include "bits/stdc++.h"
#include "gondola.h"
using namespace std;
#define pb push_back
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return 1;
}
int countReplacement(int n, int inputSeq[])
{
return 1;
}
vector<int> book;
vector<int> r;
int valid(int n, int inputSeq[])
{
if(n==1)
return 1;
book.assign(250001, 0);
for(int i = 0; i<n; i++)
{
book[inputSeq[i]]++;
if(book[inputSeq[i]]>1)
{
return 0;
}
}
int counter = 0;
int curr = 0;
for(int i = 0; i<n; i++)
{
if(inputSeq[i]<=n)
{
curr = inputSeq[i];
break;
}
counter++;
}
if(curr==0)
return 1;
int temp = curr;
for(int i = counter; i<n; i++)
{
if(inputSeq[i]>n)
{
temp++;
if(temp>n)
temp = 1;
}
else
{
if(inputSeq[i]!=temp)
return 0;
temp++;
if(temp>n)
temp = 1;
}
}
temp = curr;
for(int i = counter; i>=0; i--)
{
if(inputSeq[i]>n)
{
temp--;
if(temp==0)
temp = n;
}
else
{
if(inputSeq[i]!=temp)
return 0;
temp--;
if(temp==0)
temp = n;
}
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1308 KB |
Output is correct |
2 |
Correct |
2 ms |
1236 KB |
Output is correct |
3 |
Correct |
1 ms |
1236 KB |
Output is correct |
4 |
Correct |
1 ms |
1200 KB |
Output is correct |
5 |
Correct |
1 ms |
1196 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1228 KB |
Output is correct |
2 |
Correct |
2 ms |
1192 KB |
Output is correct |
3 |
Correct |
2 ms |
1228 KB |
Output is correct |
4 |
Correct |
2 ms |
1228 KB |
Output is correct |
5 |
Correct |
1 ms |
1228 KB |
Output is correct |
6 |
Correct |
7 ms |
1484 KB |
Output is correct |
7 |
Correct |
15 ms |
1656 KB |
Output is correct |
8 |
Correct |
9 ms |
1612 KB |
Output is correct |
9 |
Correct |
5 ms |
1472 KB |
Output is correct |
10 |
Correct |
12 ms |
1740 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
1228 KB |
Output is correct |
2 |
Correct |
1 ms |
1228 KB |
Output is correct |
3 |
Correct |
2 ms |
1196 KB |
Output is correct |
4 |
Correct |
3 ms |
1228 KB |
Output is correct |
5 |
Correct |
2 ms |
1228 KB |
Output is correct |
6 |
Correct |
8 ms |
1484 KB |
Output is correct |
7 |
Correct |
12 ms |
1732 KB |
Output is correct |
8 |
Correct |
10 ms |
1612 KB |
Output is correct |
9 |
Correct |
5 ms |
1392 KB |
Output is correct |
10 |
Correct |
16 ms |
1724 KB |
Output is correct |
11 |
Correct |
2 ms |
1240 KB |
Output is correct |
12 |
Correct |
2 ms |
1232 KB |
Output is correct |
13 |
Correct |
6 ms |
1604 KB |
Output is correct |
14 |
Correct |
2 ms |
1236 KB |
Output is correct |
15 |
Correct |
14 ms |
2124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
296 KB |
Integer 0 violates the range [1, 76] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
280 KB |
Output is correct |
2 |
Correct |
2 ms |
212 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
296 KB |
Output is correct |
3 |
Correct |
1 ms |
300 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
2 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
6 |
Halted |
0 ms |
0 KB |
- |