#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int u[N],mx;
int id;
int mn = 1e9 + 7;
vector <int> v;
int valid(int n, int inputSeq[])
{
for (int i = 0; i < n; i ++) {
if (inputSeq[i] < mn)
mn = inputSeq[i],id = i;
mx = max(mx,inputSeq[i]);
}
if (mx > n)
return 1;
int o = mn;
for (int i = id - 1; i >= 0; i --) {
mn --;
if (mn == 0) mn = n;
if (inputSeq[i] > n)
continue;
if (mn != inputSeq[i])
return 0;
}
mn = o;
for (int i = id + 1; i < n; i ++) {
mn ++;
if (mn == n + 1) mn = 1;
if (inputSeq[i] > n)
continue;
if (mn != inputSeq[i])
return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
for (int i = 0; i < n; i ++) {
mx = max(mx,gondolaSeq[i]);
u[gondolaSeq[i]] = 1;
}
for (int i = 1; i <= mx; i ++) {
if (!u[i])
replacementSeq[id ++] = i;
}
return id;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
356 KB |
Output is correct |
3 |
Correct |
2 ms |
408 KB |
Output is correct |
4 |
Correct |
2 ms |
408 KB |
Output is correct |
5 |
Correct |
2 ms |
408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
Output is correct |
2 |
Correct |
2 ms |
468 KB |
Output is correct |
3 |
Correct |
2 ms |
544 KB |
Output is correct |
4 |
Correct |
3 ms |
544 KB |
Output is correct |
5 |
Correct |
3 ms |
544 KB |
Output is correct |
6 |
Correct |
8 ms |
800 KB |
Output is correct |
7 |
Correct |
16 ms |
816 KB |
Output is correct |
8 |
Correct |
24 ms |
816 KB |
Output is correct |
9 |
Correct |
5 ms |
816 KB |
Output is correct |
10 |
Correct |
26 ms |
816 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
816 KB |
Output is correct |
2 |
Correct |
2 ms |
816 KB |
Output is correct |
3 |
Correct |
2 ms |
816 KB |
Output is correct |
4 |
Correct |
2 ms |
816 KB |
Output is correct |
5 |
Correct |
2 ms |
816 KB |
Output is correct |
6 |
Correct |
6 ms |
816 KB |
Output is correct |
7 |
Correct |
16 ms |
868 KB |
Output is correct |
8 |
Correct |
11 ms |
868 KB |
Output is correct |
9 |
Correct |
6 ms |
868 KB |
Output is correct |
10 |
Correct |
13 ms |
868 KB |
Output is correct |
11 |
Incorrect |
2 ms |
868 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
868 KB |
Output is correct |
2 |
Correct |
2 ms |
868 KB |
Output is correct |
3 |
Correct |
2 ms |
868 KB |
Output is correct |
4 |
Correct |
2 ms |
868 KB |
Output is correct |
5 |
Correct |
2 ms |
868 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
868 KB |
Output is correct |
2 |
Correct |
2 ms |
868 KB |
Output is correct |
3 |
Correct |
2 ms |
868 KB |
Output is correct |
4 |
Correct |
2 ms |
868 KB |
Output is correct |
5 |
Correct |
2 ms |
868 KB |
Output is correct |
6 |
Correct |
2 ms |
868 KB |
Output is correct |
7 |
Incorrect |
2 ms |
868 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
868 KB |
Output is correct |
2 |
Correct |
2 ms |
868 KB |
Output is correct |
3 |
Correct |
2 ms |
868 KB |
Output is correct |
4 |
Correct |
2 ms |
868 KB |
Output is correct |
5 |
Correct |
3 ms |
868 KB |
Output is correct |
6 |
Correct |
3 ms |
868 KB |
Output is correct |
7 |
Incorrect |
4 ms |
868 KB |
Output isn't correct |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
868 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
868 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
868 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
868 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |