#include "gondola.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int b[N], ind[N], mx, sz;
int valid(int n, int a[]) {
int pos = -1;
for (int i = 0; i < n; i++) {
if (a[i] <= n) {
pos = i;
}
}
if (pos == -1) {
assert(0);
return 1;
} else {
int cn = a[pos];
for (int i = (pos + 1) % n; i != pos; i = (i + 1) % n) {
cn++;
if (cn > n)
cn -= n;
if (a[i] > n) {
continue;
}
if (a[i] != cn) {
return 0;
}
}
}
return 1;
}
int replacement(int n, int a[], int ans[]) {
memset(ind, -1, sizeof(ind));
int pos = -1;
for (int i = 0; i < n; i++) {
if (a[i] <= n) {
pos = i;
}
if (a[i] > a[mx]) {
mx = i;
}
ind[a[i]] = i;
}
if (pos == -1) {
for (int i = 0; i < n; i++) {
b[i] = i + 1;
}
}
else {
int cn = a[pos];
b[pos] = a[pos];
for (int i = (pos + 1) % n; i != pos; i = (i + 1) % n) {
cn++;
if (cn > n)
cn -= n;
b[i] = a[pos] + cn;
}
}
for (int i = n + 1; i <= a[mx]; i++) {
if (ind[i] == -1) {
ans[sz++] = b[mx];
b[mx] = i;
}
else {
ans[sz++] = b[ind[i]];
b[ind[i]] = i;
}
}
return sz;
}
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 |
296 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
380 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
7 ms |
504 KB |
Output is correct |
7 |
Correct |
14 ms |
632 KB |
Output is correct |
8 |
Correct |
12 ms |
760 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
13 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
7 ms |
504 KB |
Output is correct |
7 |
Correct |
13 ms |
632 KB |
Output is correct |
8 |
Correct |
11 ms |
636 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
13 ms |
632 KB |
Output is correct |
11 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
4216 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |