#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> PickUnique(int n) {
vector<int> ans(n, 1);
int prev = -1;
for (int i = 0; i < n; i++) {
int cnt = UniqueCount(0, i);
// cout << i << " " << cnt << "\n";
if (cnt <= prev) {
ans[i] = 0;
}
prev = cnt;
}
prev = -1;
for (int i = n - 1; i >= 0; i--) {
int cnt = UniqueCount(i, n - 1);
// cout << i << " " << cnt << "\n";
if (cnt <= prev) {
ans[i] = 0;
}
prev = cnt;
}
// for (int i = 0; i < n; i++) cout << ans[i] << " \n"[i == n - 1];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |