Submission #148701

#TimeUsernameProblemLanguageResultExecution timeMemory
148701mit한의대지망생 (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include "unique.h" using namespace std; vector<int> PickUnique(int N) { vector<int> ans(N, 1), ucp(N), ucs(N); ucp[0] = 1; for(int i = 1; i < N; i++){ ucp[i] = UniqueCount(0, i); } ucs[N-1] = 1; for(int i = 0; i < N-1; i++){ ucs[i] = UniqueCount(i, N-1); } ans[0] = (ucs[0] == ucs[1] + 1); ans[N-1] = (ucp[N-1] == ucp[N-2] + 1); for(int i = 1; i < N-1; i++){ ans[i] = (ucs[i] == ucs[i+1] + 1) && (ucp[i] == ucp[i-1] + 1); } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...