Submission #227624

#TimeUsernameProblemLanguageResultExecution timeMemory
227624bensonlzlList of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include <vector> #include "unique.h" using namespace std; vector<int> PickUnique(int n) { int pref[205], suff[205]; vector<int> u(n); for (int i = 0; i <= n+1; ++i){ pref[i] = suff[i] = 0; } for (int i = 1; i <= n; ++i){ pref[i] = UniqueCount(0, i-1); suff[i] = UniqueCount(i-1, n-1); } for (int i = 1; i <= n; ++i){ if (pref[i] > pref[i-1] && suff[i] > suff[i+1]) u[i-1] = 1; else u[i-1] = 0; } return u; }
#Verdict Execution timeMemoryGrader output
Fetching results...