#include <bits/stdc++.h>
#include "unique.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
#define f first
#define s second
#define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
#define DEC(i,s,e) for(ll i=s;i>=ll(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0)
std::vector<int> PickUnique(int N) {
vi ans;
int pre = 0;
int suff = UniqueCount(0,N-1);
FOR(i,0,N-1){
int yes = 0;
if (i == 0 || pre + 1 == UniqueCount(0,i)){
pre++;
yes++;
}else pre--;
if (i == N-1 || UniqueCount(i+1,N-1) + 1 == suff){
suff--;
yes++;
}else suff++;
if (yes == 2) ans.pb(1);
else ans.pb(0);
}
//aFOR(i,ans) cout<<i<<' ';
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Correct : C = 3 |
2 |
Correct |
5 ms |
384 KB |
Correct : C = 9 |
3 |
Incorrect |
5 ms |
384 KB |
Wrong |
4 |
Halted |
0 ms |
0 KB |
- |