# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149686 | shdut0901 (#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 "unique.h"
#include <iostream>
#include <stdio.h>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <vector>
#include <queue>
#include <algorithm>
#include <assert.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = b - 1; i >= a; i--)
#define ll long long
#define x first
#define y second
#define vi vector<int>
#define pii pair<int, int>
#define SZ(x) (int)(x.size())
#define mp make_pair
#define pb push_back
#define all(x) x.begin(), x.end()
#define mod 1000000007
#define inf 1000000007
#define DBG(x) cerr << (#x) << "=" << x << "\n";
#define N 100005
template<typename U, typename V> void Min(U &a, const V &b){if(a > b) a = b;}
template<typename U, typename V> void Max(U &a, const V &b){if(a < b) a = b;}
template<typename U, typename V> void add(U &a, const V &b){a = (a+b) % mod;}
std::vector<int> PickUnique(int n) {
if(n == 1){
return vi({0});
}
int x = UniqueCount(0, n-1), s = x;
vi ans(n, 0);
ans[n-1] = 1;
ans[0] = 1;
rep(i, 1, n){
int k = UniqueCount(i, n-1);
if(k == x - 1){
ans[i-1] |= 1;
}
else{
ans[i-1] |= 2;
}
x = k;
}
x = s;
per(i, 0, n-1){
int k = UniqueCount(0, i);
if(k == x - 1){
ans[i+1] |= 1;
}
else{
ans[i+1] |= 2;
}
x = k;
}
vi res(n);
rep(i, 0, n)if(ans[i] == 1)res[i] = 1;
else res[i] = 0;
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |