#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
int valid(int n, int inputSeq[]) {
for (int i = 0; i < n; i++) {
inputSeq[i]--;
}
pair<int, int> smallest = {1e9, -1};
for (int i = 0; i < n; i++) {
if (inputSeq[i] < smallest.first) {
smallest = {inputSeq[i], i};
}
}
set<int> seen;
if (smallest.first >= n) smallest.first = 0;
int next = smallest.first;
for (int i = smallest.second; i < n + smallest.second; i++) {
if (inputSeq[i % n] != next && (seen.count(inputSeq[i % n]) || inputSeq[i % n] < n)) {
return 0;
}
next = (next + 1) % n;
seen.insert(inputSeq[i % n]);
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
set<int> s;
int maxi = *max_element(gondolaSeq, gondolaSeq + n);
for (int i = 1; i <= maxi; i++) {
s.insert(i);
}
for (int i = 0; i < n; i++) {
s.erase(gondolaSeq[i]);
}
int i= 0;
for (auto elem: s) {
replacementSeq[i] = elem;
cerr << elem << " ";
i++;
}
return s.size();
}
int countReplacement(int n, int inputSeq[])
{return 0;}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
0 ms |
312 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
308 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
10 ms |
2372 KB |
Output is correct |
7 |
Correct |
8 ms |
1068 KB |
Output is correct |
8 |
Correct |
22 ms |
4268 KB |
Output is correct |
9 |
Correct |
6 ms |
1476 KB |
Output is correct |
10 |
Correct |
24 ms |
5000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
308 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
10 ms |
2388 KB |
Output is correct |
7 |
Correct |
8 ms |
1108 KB |
Output is correct |
8 |
Correct |
20 ms |
4308 KB |
Output is correct |
9 |
Correct |
7 ms |
1468 KB |
Output is correct |
10 |
Correct |
25 ms |
4960 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
4 ms |
612 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
8 ms |
1092 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
308 KB |
Output is correct |
4 |
Correct |
1 ms |
300 KB |
Output is correct |
5 |
Correct |
1 ms |
304 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
308 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
304 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
232 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
300 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
304 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |