#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
set<int> st;
int valid(int n, int inputSeq[]){
int s = -1;
for(int i=0; i<n; i++){
if(st.find(inputSeq[i])!=st.end()) return false;
st.insert(inputSeq[i]);
}
for(int i=0; i<n; i++){
if(inputSeq[i]<=n){
s = i; break;
}
}
if(s==-1) return 1;
int idx = s, now = inputSeq[idx];
bool tf = true;
while(1){
if(inputSeq[idx]<=n && inputSeq[idx]!=now){
tf = false;
break;
}
if(idx==(s+n-2)%n+1) break;
now = now%n+1; idx = idx%n+1;
}
if(tf) return 1;
tf = true;
idx = s; now = inputSeq[idx];
while(1){
if(inputSeq[idx]<=n &&inputSeq[idx]!=now){
tf = false;
break;
}
if(idx==s%n+1) break;
idx = (idx+n-2)%n+1; now = (now+n-2)%n+1;
}
if(tf) return 1;
return 0;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[])
{
return -2;
}
//----------------------
int countReplacement(int n, int inputSeq[])
{
return -3;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
3 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
23 ms |
2432 KB |
Output is correct |
7 |
Correct |
15 ms |
1272 KB |
Output is correct |
8 |
Correct |
33 ms |
4344 KB |
Output is correct |
9 |
Correct |
12 ms |
1664 KB |
Output is correct |
10 |
Correct |
46 ms |
4984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
3 ms |
412 KB |
Output is correct |
6 |
Correct |
18 ms |
2432 KB |
Output is correct |
7 |
Correct |
13 ms |
1152 KB |
Output is correct |
8 |
Correct |
32 ms |
4352 KB |
Output is correct |
9 |
Correct |
12 ms |
1664 KB |
Output is correct |
10 |
Correct |
43 ms |
4984 KB |
Output is correct |
11 |
Correct |
3 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
256 KB |
Output is correct |
13 |
Correct |
27 ms |
2296 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
72 ms |
5244 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
Integer -2 violates the range [0, 350000] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
384 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Integer -3 violates the range [0, 1000000008] |
2 |
Halted |
0 ms |
0 KB |
- |