#include "gondola.h"
#include <vector>
#include <algorithm>
using namespace std;
int valid(int n, int inputSeq[])
{
int min_val = 1000000, min_index = -1;
vector<int> L;
for (int i=0; i<n; i++){
L.push_back(inputSeq[i]);
if (min_val > inputSeq[i]){
min_index = i;
min_val = inputSeq[i];
}
}
sort(L.begin(), L.end());
for (int i=1; i<n; i++) {
if (L[i] == L[i-1]) return 0;
}
int mi = -1;
for (int i=0; i<n; i++){
if (L[i] > n && mi == -1) mi = i;
if (mi > -1 && L[i] != n+i-mi+1) return 0;
}
L.clear();
int bi = min_index;
for (int j=1; j<n; j++){
int i = (j + min_index) % n;
if (inputSeq[i] > n) continue;
if (inputSeq[i] < inputSeq[bi]) return 0;
bi = i;
}
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 |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
2 ms |
492 KB |
Output is correct |
4 |
Correct |
3 ms |
492 KB |
Output is correct |
5 |
Correct |
2 ms |
492 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
492 KB |
Output is correct |
2 |
Correct |
2 ms |
492 KB |
Output is correct |
3 |
Correct |
3 ms |
492 KB |
Output is correct |
4 |
Correct |
2 ms |
536 KB |
Output is correct |
5 |
Correct |
3 ms |
676 KB |
Output is correct |
6 |
Correct |
12 ms |
1132 KB |
Output is correct |
7 |
Correct |
21 ms |
1608 KB |
Output is correct |
8 |
Correct |
15 ms |
1608 KB |
Output is correct |
9 |
Correct |
8 ms |
1608 KB |
Output is correct |
10 |
Correct |
20 ms |
1608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1608 KB |
Output is correct |
2 |
Correct |
2 ms |
1608 KB |
Output is correct |
3 |
Correct |
2 ms |
1608 KB |
Output is correct |
4 |
Correct |
3 ms |
1608 KB |
Output is correct |
5 |
Correct |
2 ms |
1608 KB |
Output is correct |
6 |
Correct |
9 ms |
1608 KB |
Output is correct |
7 |
Correct |
25 ms |
1608 KB |
Output is correct |
8 |
Correct |
16 ms |
1608 KB |
Output is correct |
9 |
Correct |
8 ms |
1608 KB |
Output is correct |
10 |
Correct |
22 ms |
1608 KB |
Output is correct |
11 |
Correct |
2 ms |
1608 KB |
Output is correct |
12 |
Correct |
2 ms |
1608 KB |
Output is correct |
13 |
Correct |
11 ms |
1608 KB |
Output is correct |
14 |
Correct |
2 ms |
1608 KB |
Output is correct |
15 |
Correct |
23 ms |
1608 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1608 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1608 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |