// M
#include<bits/stdc++.h>
#include "unique.h"
using namespace std;
int n;
int Get(int l, int r)
{
l --; r --;
l = max(l, 0);
r = min(r, n - 1);
if (r < l)
return 0;
return UniqueCount(l, r);
}
vector < int > PickUnique(int _n)
{
n = _n;
vector < int > P(n + 2, 0), S(n + 2, 0);
for (int i = 1; i <= n; i ++)
P[i] = Get(1, i), S[i] = Get(i, n);
vector < int > Rs(n, 0);
for (int i = 1; i <= n; i ++)
if (P[i] == P[i - 1] + 1 && S[i] == S[i + 1] + 1)
Rs[i - 1] = 1;
return Rs;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
Correct : C = 4 |
2 |
Correct |
0 ms |
256 KB |
Correct : C = 10 |
3 |
Correct |
0 ms |
384 KB |
Correct : C = 50 |
4 |
Correct |
1 ms |
384 KB |
Correct : C = 100 |
5 |
Correct |
0 ms |
384 KB |
Correct : C = 100 |
6 |
Correct |
0 ms |
384 KB |
Correct : C = 154 |
7 |
Correct |
0 ms |
384 KB |
Correct : C = 200 |
8 |
Correct |
1 ms |
384 KB |
Correct : C = 300 |
9 |
Correct |
1 ms |
512 KB |
Correct : C = 356 |
10 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |
11 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |
12 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |
13 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |
14 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |
15 |
Correct |
1 ms |
512 KB |
Correct : C = 400 |