#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
template<class T, class U>
void ckmin(T &a, U b)
{
if (a > b) a = b;
}
template<class T, class U>
void ckmax(T &a, U b)
{
if (a < b) a = b;
}
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define SZ(x) ((int) (x).size())
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (auto i = (a); i < (b); i++)
#define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--)
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef vector<pll> vpl;
int N;
vi ans, pref, suf;
vi PickUnique(int n)
{
N = n; ans.resize(N);
pref.resize(N); suf.resize(N);
FOR(i, 0, N)
{
pref[i] = UniqueCount(0, i);
suf[i] = UniqueCount(i, N - 1);
}
FOR(i, 0, N)
{
ans[i] = 1;
if (i != 0 && pref[i - 1] >= pref[i]) ans[i] = 0;
if (i != N - 1 && suf[i + 1] >= suf[i]) ans[i] = 0;
// cerr << ans[i] << ' ';
}
// cerr << endl;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
256 KB |
Correct : C = 4 |
2 |
Correct |
4 ms |
384 KB |
Correct : C = 10 |
3 |
Correct |
4 ms |
384 KB |
Correct : C = 50 |
4 |
Correct |
4 ms |
384 KB |
Correct : C = 100 |
5 |
Correct |
5 ms |
384 KB |
Correct : C = 100 |
6 |
Correct |
5 ms |
384 KB |
Correct : C = 154 |
7 |
Correct |
5 ms |
384 KB |
Correct : C = 200 |
8 |
Correct |
5 ms |
384 KB |
Correct : C = 300 |
9 |
Correct |
5 ms |
384 KB |
Correct : C = 356 |
10 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |
11 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |
12 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |
13 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |
14 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |
15 |
Correct |
5 ms |
512 KB |
Correct : C = 400 |