# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
151004 | JustInCase | List of Unique Integers (FXCUP4_unique) | C++17 | 2 ms | 508 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>
#ifdef LOCAL
#include "grader.cpp"
#else
#include "unique.h"
#endif
#define pick_unique PickUnique
#define unique_count UniqueCount
#define int32_t int
#define int64_t long long
std::vector< int32_t > pick_unique(int32_t n) {
std::vector< int32_t > cntFront(n), cntBack(n), res(n, 0);
for(int32_t i = 0; i < n; i++) {
cntFront[i] = unique_count(0, i);
cntBack[i] = unique_count(i, n - 1);
}
for(int32_t i = 0; i < n; i++) {
if(i == 0) {
if(cntBack[i] > cntBack[i + 1]) {
res[i] = 1;
}
}
else if(i == n - 1) {
if(cntFront[i] > cntFront[i - 1]) {
res[i] = 1;
}
}
else {
if(cntFront[i] > cntFront[i - 1] && cntBack[i] > cntBack[i + 1]) {
res[i] = 1;
}
}
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |