# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
230537 | jiahng | List of Unique Integers (FXCUP4_unique) | C++17 | 5 ms | 384 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |