# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
149586 | 티셔츠 콜렉터 (#200) | List of Unique Integers (FXCUP4_unique) | C++17 | 0 ms | 0 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"
int min (int x, int y) {
return x < y ? x : y;
}
std::vector<int> PickUnique(int N) {
int result[N];
int leftIndex = 0;
int rightIndex = N-1;
while (leftIndex < rightIndex) {
int totalUniqueCount = UniqueCount(0, N-1);
int prevCount = UniqueCount(leftIndex, rightIndex);
int minCount = min(totalUniqueCount, prevCount)
int leftUniqueCount = UniqueCount(leftIndex + 1, rightIndex);
int rightUniqueCount = UniqueCount(leftIndex, rightIndex - 1);
if (minCount <= leftUniqueCount && ) {
result[leftIndex] = 0;
} else if (minCount <= rightUniqueCount) {
result[rightIndex] = 0;
} else {
if (minCount > leftUniqueCount) {
result[leftIndex] = 1;
}
if (minCount > rightUniqueCount) {
result[rightIndex] = 1;
}
}
leftIndex++;
rightIndex--;
}
std::vector<int> output;
for (int i = 0; i < N; i++) {
output.push_back(result[i]);
}
return output;
}