#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
set<int> visited;
int valid(int n,int input[]){
for(int i=0;i<n;i++)
if(visited.find(input[i])!=visited.end())
return 0;
else
visited.insert(input[i]);
int start = -1;
for(int i=0;i<n;i++)if(input[i]<=n){
start = i;
break;
}
if(start==-1)return 1;
int next = input[start];
int pos = start;
for(int i=0;i<n;i++){
if(input[pos]<=n&&input[pos]!=next)return 0;
pos++;
if(pos>=n)pos=0;
next++;
if(next>n)next=1;
}
return 1;
}
pair<int,int> x[200002];
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
int start = 0;
for(int i=0;i<n;i++){
if(gondolaSeq[i]<=n){start = i;break;}
}
int next = gondolaSeq[start]<=n?gondolaSeq[start]:1;
vector<pair<int,int>> vec;
int pos = start;
for(int i=0;i<n;i++){
x[i] = {gondolaSeq[pos],next};
pos++;
next++;
if(next>n)next = 1;
if(pos>=n)pos=0;
}
sort(x,x+n);
int last = n;
int l = 0;
for(int i=0;i<n;i++){
while(x[i].first != x[i].second){
replacementSeq[l++] = x[i].second;
x[i].second = ++last;
}
}
return l;
}
int countReplacement(int n, int inputSeq[]){
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
256 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
18 ms |
2304 KB |
Output is correct |
7 |
Correct |
16 ms |
640 KB |
Output is correct |
8 |
Correct |
31 ms |
3968 KB |
Output is correct |
9 |
Correct |
12 ms |
1536 KB |
Output is correct |
10 |
Correct |
38 ms |
4600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
19 ms |
2304 KB |
Output is correct |
7 |
Correct |
17 ms |
640 KB |
Output is correct |
8 |
Correct |
31 ms |
3968 KB |
Output is correct |
9 |
Correct |
13 ms |
1536 KB |
Output is correct |
10 |
Correct |
38 ms |
4592 KB |
Output is correct |
11 |
Correct |
4 ms |
384 KB |
Output is correct |
12 |
Correct |
4 ms |
384 KB |
Output is correct |
13 |
Correct |
23 ms |
2176 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
56 ms |
4728 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
17 ms |
1792 KB |
Output is correct |
12 |
Correct |
19 ms |
1920 KB |
Output is correct |
13 |
Correct |
19 ms |
1664 KB |
Output is correct |
14 |
Correct |
18 ms |
1664 KB |
Output is correct |
15 |
Correct |
26 ms |
2432 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |