Submission #149710

#TimeUsernameProblemLanguageResultExecution timeMemory
149710usa1+samsung2 (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
7 ms512 KiB
#include "unique.h" std::vector<int> PickUnique(int N) { int c = UniqueCount(0, N - 1); std::vector<int>L(N); std::vector<int>R(N); L[N-1] = R[0] = c; for (int i = 1; i < N - 1; i++)L[i] = UniqueCount(0, i); for (int j = N - 2; j >= 0; j--)R[j] = UniqueCount(j, N - 1); std::vector <int> out(N); out[0] = R[0] > R[1]; for (int i = 1; i < N-1; i++) { if (R[i] > R[i + 1] && L[i - 1] < L[i])out[i] = 1; } out[N - 1] = L[N - 1] > L[N - 2]; return out; }
#Verdict Execution timeMemoryGrader output
Fetching results...