#include "unique.h"
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
#include <assert.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = b - 1; i >= a; i--)
#define ll long long
#define x first
#define y second
#define vi vector<int>
#define pii pair<int, int>
#define SZ(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define mod 1000000007
#define inf 1000000007
#define DBG(x) cerr << (#x) << "=" << x << "\n";
#define N 100005
template<typename U, typename V> void Min(U &a, const V &b){if(a > b) a = b;}
template<typename U, typename V> void Max(U &a, const V &b){if(a < b) a = b;}
template<typename U, typename V> void add(U &a, const V &b){a = (a+b) % mod;}
std::vector<int> PickUnique(int n) {
if(n == 1){
return vi({0});
}
int x = UniqueCount(0, n-1), s = x;
vi ans(n, 0);
ans[n-1] = 1;
ans[0] = 1;
rep(i, 1, n){
int k = UniqueCount(i, n-1);
if(k == x - 1){
ans[i-1] |= 1;
}
else{
ans[i-1] |= 2;
}
x = k;
}
x = s;
per(i, 0, n-1){
int k = UniqueCount(0, i);
if(k == x - 1){
ans[i+1] |= 1;
}
else{
ans[i+1] |= 2;
}
x = k;
}
vi res(n);
rep(i, 0, n)if(ans[i] == 1)res[i] = 1;
else res[i] = 0;
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Correct : C = 3 |
2 |
Correct |
2 ms |
376 KB |
Correct : C = 9 |
3 |
Correct |
2 ms |
248 KB |
Correct : C = 49 |
4 |
Correct |
2 ms |
376 KB |
Correct : C = 99 |
5 |
Correct |
2 ms |
376 KB |
Correct : C = 99 |
6 |
Correct |
2 ms |
376 KB |
Correct : C = 153 |
7 |
Correct |
2 ms |
376 KB |
Correct : C = 199 |
8 |
Correct |
2 ms |
376 KB |
Correct : C = 299 |
9 |
Correct |
2 ms |
424 KB |
Correct : C = 355 |
10 |
Correct |
2 ms |
404 KB |
Correct : C = 399 |
11 |
Correct |
2 ms |
504 KB |
Correct : C = 399 |
12 |
Correct |
2 ms |
376 KB |
Correct : C = 399 |
13 |
Correct |
2 ms |
376 KB |
Correct : C = 399 |
14 |
Correct |
2 ms |
376 KB |
Correct : C = 399 |
15 |
Correct |
2 ms |
504 KB |
Correct : C = 399 |