Submission #151962

#TimeUsernameProblemLanguageResultExecution timeMemory
151962minty99List of Unique Integers (FXCUP4_unique)C++17
100 / 100
2 ms632 KiB
#include "unique.h" std::vector<int> PickUnique(int N) { std::vector<int> U(N); int uc0[200], ucN[200]; for(int i = 0; i < N; i++) { uc0[i] = UniqueCount(0, i); ucN[i] = UniqueCount(i, N-1); } for(int i = 0; i < N; i++) { if(i == 0) U[i] = ucN[i] > ucN[i+1] ? 1 : 0; else if(i == N-1) U[i] = uc0[i] > uc0[i-1] ? 1 : 0; else U[i] = (uc0[i] > uc0[i-1] && ucN[i] > ucN[i+1]) ? 1 : 0; } return U; }
#Verdict Execution timeMemoryGrader output
Fetching results...