#include <iostream>
#include <algorithm>
#include <map>
#include "gondola.h"
using namespace std;
int arr[2500];
int valid(int n, int inputSeq[]){
map<int,int> m1;
int holdmin = 1e9;
int ind = 0;
for(int i=0;i<n;i++){
if(m1[inputSeq[i]] == 1){
return 0;
}
if(inputSeq[i]<holdmin){
holdmin = inputSeq[i];
ind = i;
}
m1[inputSeq[i]] = 1;
}
for(int i=ind;i<n;i++){
if(inputSeq[i]<=n && inputSeq[i]!=holdmin){
return 0;
}
holdmin++;
}
if(ind == 0){
return 1;
}
for(int i=0;i<ind;i++){
if(inputSeq[i]<=n && inputSeq[i]!=holdmin){
// cout<<inputSeq[i]<<endl;
return 0;
}
holdmin++;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
return 0;
}
int countReplacement(int n, int inputSeq[]){
return 0;
}
/*int main(){
int arr[8] = {2, 3, 4, 9, 6, 7, 1};
cout<<valid(7,arr)<<endl;
}*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
20 ms |
2552 KB |
Output is correct |
7 |
Correct |
14 ms |
1148 KB |
Output is correct |
8 |
Correct |
35 ms |
4344 KB |
Output is correct |
9 |
Correct |
12 ms |
1656 KB |
Output is correct |
10 |
Correct |
49 ms |
5080 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
20 ms |
2424 KB |
Output is correct |
7 |
Correct |
13 ms |
1272 KB |
Output is correct |
8 |
Correct |
35 ms |
4472 KB |
Output is correct |
9 |
Correct |
12 ms |
1676 KB |
Output is correct |
10 |
Correct |
47 ms |
4988 KB |
Output is correct |
11 |
Correct |
2 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
256 KB |
Output is correct |
13 |
Correct |
25 ms |
2428 KB |
Output is correct |
14 |
Correct |
2 ms |
376 KB |
Output is correct |
15 |
Correct |
59 ms |
5240 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
252 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |