#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
#include "unique.h"
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))
template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }
vi PickUnique(int n){
vi ans(n, 0);
int prev = UniqueCount(0, n - 1);
int nm = prev;
int cnt = 0;
repn(i, 1, n){
int cur = UniqueCount(i, n - 1);
if((cnt + cur) < prev) ans[i - 1] = 1, cnt++;
prev = cur;
}
if(cnt < nm) ans[n - 1] = 1, cnt++;
cout << endl;
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
252 KB |
Correct : C = 2 |
2 |
Correct |
2 ms |
376 KB |
Correct : C = 5 |
3 |
Incorrect |
2 ms |
376 KB |
Wrong |
4 |
Halted |
0 ms |
0 KB |
- |