# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148769 | Avengers (#200) | List of Unique Integers (FXCUP4_unique) | C++17 | 6 ms | 512 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>
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x),end(x)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
ll const inf = 1e9;
ll const mod = 1e9 + 7;
ld const eps = 1e-9;
#include "unique.h"
/*
int a[200];
int UniqueCount(int l, int r){
int cnt[201];
memset(cnt, 0, sizeof(cnt));
int ret = 0;
fr(i, l, r + 1){
if(cnt[a[i]] == 0) ret ++;
else if(cnt[a[i]] == 1) ret --;
cnt[a[i]] ++;
}
cout << l <<' '<<r<<' '<<ret<<endl;
return ret;
}*/
std::vector<int> PickUnique(int N) {
int l = UniqueCount(0, N - 1);
int r = 0;
vector <int> ret(N, 0);
fr(i, 0, N){
int nl = 0;
if(i < N - 1) nl = UniqueCount(0, N - 2 - i);
int nr = UniqueCount(N - 1 - i, N - 1);
if(nl == l - 1 && nr == r + 1){
ret[N - 1 - i] = 1;
}
else{
ret[N - 1 - i] = 0;
}
l = nl;
r = nr;
}
return ret;
}/*
int main(){
a[0] = 1;
a[1] = 2;
a[2] = 3;
a[3] = 1;
a[4] = 2;
vector<int> v = PickUnique(5);
for(auto u : v) cout << u << ' ';
cout << endl;
}*/
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |