#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
int valid(int n, int A[])
{
set<int> seen;
int six = -1;
for (int i = 0; i < n; ++i) {
if (seen.count(A[i])) return 0;
seen.insert(A[i]);
if (A[i] <= n) six = (i-(A[i]-1)+n)%n;
}
if (six == -1) return 1;
for (int i = 0; i < n; ++i) {
int j = (six+i)%n;
if (A[j] <= n && A[j] != i+1)
return false;
}
return 1;
}
//----------------------
int replacement(int n, int A[], int ret[])
{
int six = 0, mx = 0;
for (int i = 0; i < n; ++i) {
if (A[i] <= n) six = (i-(A[i]-1)+n)%n;
mx = max(mx, A[i]);
}
map<int, int> num;
for (int i = 0; i < n; ++i) {
int j = (six+i)%n;
if (A[j] > n)
num[A[j]] = i+1;
}
int cnt = 0, v = n;
for (auto p : num) {
int x = p.second, y = p.first;
while (x < y) {
ret[cnt++] = x;
x = ++v;
}
}
return cnt;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
3 ms |
484 KB |
Output is correct |
3 |
Correct |
2 ms |
484 KB |
Output is correct |
4 |
Correct |
2 ms |
484 KB |
Output is correct |
5 |
Correct |
3 ms |
536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
536 KB |
Output is correct |
2 |
Correct |
2 ms |
536 KB |
Output is correct |
3 |
Correct |
2 ms |
536 KB |
Output is correct |
4 |
Correct |
2 ms |
536 KB |
Output is correct |
5 |
Correct |
2 ms |
536 KB |
Output is correct |
6 |
Correct |
20 ms |
2440 KB |
Output is correct |
7 |
Correct |
17 ms |
2440 KB |
Output is correct |
8 |
Correct |
33 ms |
4124 KB |
Output is correct |
9 |
Correct |
12 ms |
4124 KB |
Output is correct |
10 |
Correct |
47 ms |
4936 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4936 KB |
Output is correct |
2 |
Correct |
2 ms |
4936 KB |
Output is correct |
3 |
Correct |
2 ms |
4936 KB |
Output is correct |
4 |
Correct |
2 ms |
4936 KB |
Output is correct |
5 |
Correct |
2 ms |
4936 KB |
Output is correct |
6 |
Correct |
27 ms |
4936 KB |
Output is correct |
7 |
Correct |
26 ms |
4936 KB |
Output is correct |
8 |
Correct |
38 ms |
4936 KB |
Output is correct |
9 |
Correct |
12 ms |
4936 KB |
Output is correct |
10 |
Correct |
48 ms |
4936 KB |
Output is correct |
11 |
Correct |
3 ms |
4936 KB |
Output is correct |
12 |
Correct |
2 ms |
4936 KB |
Output is correct |
13 |
Correct |
27 ms |
4936 KB |
Output is correct |
14 |
Correct |
3 ms |
4936 KB |
Output is correct |
15 |
Correct |
75 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
4988 KB |
Output is correct |
2 |
Correct |
2 ms |
4988 KB |
Output is correct |
3 |
Correct |
3 ms |
4988 KB |
Output is correct |
4 |
Correct |
2 ms |
4988 KB |
Output is correct |
5 |
Correct |
2 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4988 KB |
Output is correct |
2 |
Correct |
2 ms |
4988 KB |
Output is correct |
3 |
Correct |
2 ms |
4988 KB |
Output is correct |
4 |
Correct |
3 ms |
4988 KB |
Output is correct |
5 |
Correct |
3 ms |
4988 KB |
Output is correct |
6 |
Correct |
3 ms |
4988 KB |
Output is correct |
7 |
Correct |
3 ms |
4988 KB |
Output is correct |
8 |
Correct |
3 ms |
4988 KB |
Output is correct |
9 |
Correct |
4 ms |
4988 KB |
Output is correct |
10 |
Correct |
3 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4988 KB |
Output is correct |
2 |
Correct |
3 ms |
4988 KB |
Output is correct |
3 |
Correct |
3 ms |
4988 KB |
Output is correct |
4 |
Correct |
3 ms |
4988 KB |
Output is correct |
5 |
Correct |
4 ms |
4988 KB |
Output is correct |
6 |
Correct |
4 ms |
4988 KB |
Output is correct |
7 |
Correct |
4 ms |
4988 KB |
Output is correct |
8 |
Correct |
3 ms |
4988 KB |
Output is correct |
9 |
Correct |
4 ms |
4988 KB |
Output is correct |
10 |
Correct |
3 ms |
4988 KB |
Output is correct |
11 |
Correct |
26 ms |
4988 KB |
Output is correct |
12 |
Correct |
31 ms |
4988 KB |
Output is correct |
13 |
Correct |
28 ms |
4988 KB |
Output is correct |
14 |
Correct |
15 ms |
4988 KB |
Output is correct |
15 |
Correct |
28 ms |
4988 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4988 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
4988 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4988 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
4988 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |