#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int arr[]) {
bool check = true;
for(int i=1;i<n;i++) {
if(arr[i] > n) continue;
else if(arr[i] == 1) {
if(arr[i-1] < n)
check = false;
}
else {
if(arr[i-1] <= n && arr[i-1] != arr[i] - 1) check = false;
}
}
sort(arr, arr+n);
for(int i=1;i<n;i++) {
if(arr[i] == arr[i-1]) check = false;
}
if(check) return 1;
else return 0;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
/*int main() {
int arr[] = {6, 6, 7, 7};
cout<<valid(4, arr);
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
416 KB |
Output is correct |
5 |
Correct |
3 ms |
436 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 |
2 ms |
568 KB |
Output is correct |
4 |
Correct |
2 ms |
588 KB |
Output is correct |
5 |
Correct |
2 ms |
588 KB |
Output is correct |
6 |
Correct |
11 ms |
716 KB |
Output is correct |
7 |
Correct |
24 ms |
848 KB |
Output is correct |
8 |
Correct |
16 ms |
884 KB |
Output is correct |
9 |
Correct |
10 ms |
884 KB |
Output is correct |
10 |
Correct |
20 ms |
884 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
884 KB |
Output is correct |
2 |
Correct |
3 ms |
884 KB |
Output is correct |
3 |
Correct |
3 ms |
884 KB |
Output is correct |
4 |
Correct |
2 ms |
884 KB |
Output is correct |
5 |
Correct |
2 ms |
884 KB |
Output is correct |
6 |
Correct |
10 ms |
884 KB |
Output is correct |
7 |
Correct |
22 ms |
888 KB |
Output is correct |
8 |
Correct |
13 ms |
932 KB |
Output is correct |
9 |
Correct |
9 ms |
932 KB |
Output is correct |
10 |
Correct |
34 ms |
932 KB |
Output is correct |
11 |
Correct |
2 ms |
932 KB |
Output is correct |
12 |
Correct |
3 ms |
932 KB |
Output is correct |
13 |
Correct |
12 ms |
932 KB |
Output is correct |
14 |
Correct |
3 ms |
1044 KB |
Output is correct |
15 |
Correct |
35 ms |
1712 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1712 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1712 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1712 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1712 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1712 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
1712 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1712 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |