#include "unique.h"
std::vector<int> PickUnique (int N){
int U[N];
int left[N];
int right[N];
for(int i=0;i<N;i++){
left[i]=0;
}
for(int i=0;i<N;i++){
right[i]=0;
}
int k=UniqueCount(0,N-1);
for(int i=1;i<N-1;i++){
left[i]=UniqueCount(0,i);
}
for(int i=1;i<N-1;i++){
right[i]=UniqueCount(i,N-1);
}
right[N-1]=1;
right[0]=k;
left[0]=1;
left[N-1]=k;
for(int i=0;i<N;i++){
U[i]=0;
}
if(k==left[N-2]+1){
U[N-1]=1;
};
if(k==right[1]+1){
U[0]=1;
};
for(int i=N-2; i>0;i--){
if(right[i]==right[i+1]+1){
if(left[i]==left[i-1]+1)
U[i]=1;
}
};
std::vector<int> vect(U, U + sizeof(U)/sizeof(U[0]));
return vect;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Correct : C = 1 |
2 |
Correct |
5 ms |
256 KB |
Correct : C = 7 |
3 |
Correct |
5 ms |
384 KB |
Correct : C = 47 |
4 |
Correct |
5 ms |
384 KB |
Correct : C = 97 |
5 |
Correct |
6 ms |
256 KB |
Correct : C = 97 |
6 |
Correct |
5 ms |
364 KB |
Correct : C = 151 |
7 |
Correct |
6 ms |
384 KB |
Correct : C = 197 |
8 |
Correct |
6 ms |
384 KB |
Correct : C = 297 |
9 |
Correct |
6 ms |
512 KB |
Correct : C = 353 |
10 |
Correct |
5 ms |
408 KB |
Correct : C = 397 |
11 |
Correct |
6 ms |
512 KB |
Correct : C = 397 |
12 |
Correct |
5 ms |
512 KB |
Correct : C = 397 |
13 |
Correct |
5 ms |
384 KB |
Correct : C = 397 |
14 |
Correct |
6 ms |
512 KB |
Correct : C = 397 |
15 |
Correct |
6 ms |
512 KB |
Correct : C = 397 |