#include "unique.h"
std::vector<int> PickUnique(int N) {
std::vector<int> res;
int total = UniqueCount(0, N-1);
int cur = total;
int prev = 0;
for (int i=0; i<N-1; i++) {
int next = UniqueCount(i+1, N-1);
int tmp = UniqueCount(0, i);
int ans = 0;
if (next < cur) {
if (tmp > prev) {
ans = 1;
}
}
res.push_back(ans);
cur = next;
prev = tmp;
}
int last = 0;
if (total > prev) {
last = 1;
}
res.push_back(last);
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
216 KB |
Correct : C = 3 |
2 |
Correct |
6 ms |
256 KB |
Correct : C = 9 |
3 |
Correct |
6 ms |
384 KB |
Correct : C = 49 |
4 |
Correct |
5 ms |
384 KB |
Correct : C = 99 |
5 |
Correct |
5 ms |
384 KB |
Correct : C = 99 |
6 |
Correct |
5 ms |
384 KB |
Correct : C = 153 |
7 |
Correct |
5 ms |
384 KB |
Correct : C = 199 |
8 |
Correct |
5 ms |
384 KB |
Correct : C = 299 |
9 |
Correct |
5 ms |
384 KB |
Correct : C = 355 |
10 |
Correct |
5 ms |
512 KB |
Correct : C = 399 |
11 |
Correct |
6 ms |
512 KB |
Correct : C = 399 |
12 |
Correct |
5 ms |
512 KB |
Correct : C = 399 |
13 |
Correct |
5 ms |
560 KB |
Correct : C = 399 |
14 |
Correct |
6 ms |
512 KB |
Correct : C = 399 |
15 |
Correct |
5 ms |
512 KB |
Correct : C = 399 |