#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
#include "gondola.h"
int valid(int N, int inputSeq[]) {
vi a;
for (int i = 0; i < N; i++) {
a.pb(inputSeq[i] - 1);
}
int fpos = -1; // fixed position
int fval = -1; // fixed val at position
for (int i = 0; i < N; i++) {
if (a[i] < N) {
fpos = i;
fval = a[i];
}
}
vi b;
if (fval > fpos) {
int s = fval - fpos;
for (int i = N - s; i < N; i++) {
b.pb(a[i]);
}
for (int i = 0; i < N - s; i++) {
b.pb(a[i]);
}
}
else {
int s = fpos - fval;
for (int i = s; i < N; i++) {
b.pb(a[i]);
}
for (int i = 0; i < s; i++) {
b.pb(a[i]);
}
}
for (int i = 0; i < N; i++) {
if (b[i] < N) {
if (b[i] != i)
return 0;
}
}
return 1;
}
int replacement(int N, int gondolaSeq[], int replacementSeq[]) {
return -2;
}
int countReplacement(int N, int inputSeq[]) {
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
444 KB |
Output is correct |
4 |
Correct |
0 ms |
448 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
4 ms |
1748 KB |
Output is correct |
7 |
Correct |
7 ms |
3280 KB |
Output is correct |
8 |
Correct |
6 ms |
3024 KB |
Output is correct |
9 |
Correct |
2 ms |
1116 KB |
Output is correct |
10 |
Correct |
7 ms |
3280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
6 ms |
1748 KB |
Output is correct |
7 |
Correct |
7 ms |
3280 KB |
Output is correct |
8 |
Correct |
6 ms |
3132 KB |
Output is correct |
9 |
Correct |
3 ms |
1116 KB |
Output is correct |
10 |
Correct |
12 ms |
3280 KB |
Output is correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |