#include "gondola.h"
#include <vector>
#include <algorithm>
using namespace std;
int valid(int n, int inputSeq[]) {
vector<int>vec(250009, 0);
for (int i = 0; i < n; i++) vec[inputSeq[i]]++;
for (int i = 0; i <= 250000; i++) { if (vec[i] >= 2) return 0; }
for (int i = 0; i < n; i++) { if (inputSeq[i] > n) inputSeq[i] = -1; }
int v = -1;
for (int i = 0; i < n; i++) {
if (inputSeq[i] != -1) {
int z = (inputSeq[i] - i + n) % n;
if (v == -1) v = z;
else if (v != z) return 0;
}
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
vector<int>vec(250009, 0); int maxn = 0;
for (int i = 0; i < n; i++) {
vec[gondolaSeq[i]]++; maxn = max(maxn, gondolaSeq[i]);
}
int r = 0;
for (int i = 1; i <= maxn; i++) { if (vec[i] == 0) { replacementSeq[r] = i; r++; } }
return r;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1272 KB |
Output is correct |
2 |
Correct |
3 ms |
1380 KB |
Output is correct |
3 |
Correct |
4 ms |
1456 KB |
Output is correct |
4 |
Correct |
3 ms |
1456 KB |
Output is correct |
5 |
Correct |
3 ms |
1456 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1532 KB |
Output is correct |
2 |
Correct |
3 ms |
1572 KB |
Output is correct |
3 |
Correct |
3 ms |
1572 KB |
Output is correct |
4 |
Correct |
3 ms |
1572 KB |
Output is correct |
5 |
Correct |
4 ms |
1644 KB |
Output is correct |
6 |
Correct |
10 ms |
1828 KB |
Output is correct |
7 |
Correct |
16 ms |
1916 KB |
Output is correct |
8 |
Correct |
16 ms |
1916 KB |
Output is correct |
9 |
Correct |
6 ms |
1916 KB |
Output is correct |
10 |
Correct |
14 ms |
1916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1916 KB |
Output is correct |
2 |
Correct |
3 ms |
1916 KB |
Output is correct |
3 |
Correct |
3 ms |
1916 KB |
Output is correct |
4 |
Correct |
4 ms |
1916 KB |
Output is correct |
5 |
Correct |
4 ms |
1916 KB |
Output is correct |
6 |
Correct |
9 ms |
1916 KB |
Output is correct |
7 |
Correct |
18 ms |
1916 KB |
Output is correct |
8 |
Correct |
15 ms |
1916 KB |
Output is correct |
9 |
Correct |
6 ms |
1916 KB |
Output is correct |
10 |
Correct |
16 ms |
1916 KB |
Output is correct |
11 |
Correct |
3 ms |
1916 KB |
Output is correct |
12 |
Correct |
3 ms |
1916 KB |
Output is correct |
13 |
Correct |
10 ms |
1916 KB |
Output is correct |
14 |
Correct |
4 ms |
1916 KB |
Output is correct |
15 |
Correct |
17 ms |
1916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
1916 KB |
Output is correct |
2 |
Correct |
4 ms |
1916 KB |
Output is correct |
3 |
Correct |
4 ms |
1916 KB |
Output is correct |
4 |
Correct |
3 ms |
1916 KB |
Output is correct |
5 |
Correct |
3 ms |
1916 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1916 KB |
Output is correct |
2 |
Correct |
3 ms |
1916 KB |
Output is correct |
3 |
Correct |
3 ms |
1916 KB |
Output is correct |
4 |
Correct |
4 ms |
1916 KB |
Output is correct |
5 |
Correct |
3 ms |
1916 KB |
Output is correct |
6 |
Correct |
3 ms |
1916 KB |
Output is correct |
7 |
Incorrect |
3 ms |
1916 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
1916 KB |
Output is correct |
2 |
Correct |
2 ms |
1916 KB |
Output is correct |
3 |
Correct |
3 ms |
1916 KB |
Output is correct |
4 |
Correct |
3 ms |
1916 KB |
Output is correct |
5 |
Correct |
3 ms |
1916 KB |
Output is correct |
6 |
Correct |
3 ms |
1916 KB |
Output is correct |
7 |
Incorrect |
4 ms |
1916 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
1916 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1916 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1916 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
1916 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |