#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 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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
488 KB |
Output is correct |
3 |
Correct |
2 ms |
488 KB |
Output is correct |
4 |
Correct |
2 ms |
568 KB |
Output is correct |
5 |
Correct |
3 ms |
568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
568 KB |
Output is correct |
2 |
Correct |
2 ms |
568 KB |
Output is correct |
3 |
Correct |
2 ms |
588 KB |
Output is correct |
4 |
Correct |
2 ms |
588 KB |
Output is correct |
5 |
Correct |
3 ms |
588 KB |
Output is correct |
6 |
Correct |
12 ms |
1100 KB |
Output is correct |
7 |
Correct |
22 ms |
1568 KB |
Output is correct |
8 |
Correct |
18 ms |
1568 KB |
Output is correct |
9 |
Correct |
10 ms |
1568 KB |
Output is correct |
10 |
Correct |
23 ms |
1568 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1568 KB |
Output is correct |
2 |
Correct |
2 ms |
1568 KB |
Output is correct |
3 |
Correct |
2 ms |
1568 KB |
Output is correct |
4 |
Correct |
3 ms |
1568 KB |
Output is correct |
5 |
Correct |
2 ms |
1568 KB |
Output is correct |
6 |
Correct |
9 ms |
1568 KB |
Output is correct |
7 |
Correct |
19 ms |
1568 KB |
Output is correct |
8 |
Correct |
19 ms |
1568 KB |
Output is correct |
9 |
Correct |
8 ms |
1568 KB |
Output is correct |
10 |
Correct |
39 ms |
1568 KB |
Output is correct |
11 |
Correct |
2 ms |
1568 KB |
Output is correct |
12 |
Incorrect |
2 ms |
1568 KB |
Output isn't correct |
13 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1568 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |