Submission #149033

#TimeUsernameProblemLanguageResultExecution timeMemory
149033dragoon (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include "unique.h" #include<vector> #include<stdio.h> using namespace std; std::vector<int> PickUnique(int N) { vector<int> V(N), pre(N + 2), suf(N + 2); for (int i = 0; i < N; i++) { pre[i] = UniqueCount(0, i); suf[i] = UniqueCount(i, N - 1); } for (int i = 0; i < N; i++) { int p = (i ? pre[i - 1] : 0); int s = (i == N - 1 ? 0 : suf[i + 1]); //printf("%d %d %d %d\n", pre[i], p, suf[i], s); V[i] = ((pre[i] - 1 == p) && (suf[i] - 1 == s)) ? 1 : 0; } return V; }
#Verdict Execution timeMemoryGrader output
Fetching results...