Submission #148372

#TimeUsernameProblemLanguageResultExecution timeMemory
148372본인 하지만 안 어림 ㅋㅋ (#200)List of Unique Integers (FXCUP4_unique)C++17
35 / 100
6 ms512 KiB
#include "unique.h" using namespace std; vector<int> PickUnique(int N) { if(N == 1) return vector<int>(1, 1); vector<int> ans(N, 0); int total = UniqueCount(0, N - 1); for(int i = 0; i < N; i++){ if(i == 0){ int right = UniqueCount(1, N - 1); if(total > right) ans[0] = 1; } else if(i == N - 1){ int left = UniqueCount(0, N - 2); if(total > left) ans[N - 1] = 1; } else{ int leftExcept = UniqueCount(0, i - 1); int leftContain = UniqueCount(0, i); bool notInLeft = leftContain > leftExcept; int rightExcept = UniqueCount(i + 1, N - 1); int rightContain = UniqueCount(i, N - 1); bool notInRight = rightContain > rightExcept; if(notInLeft && notInRight) ans[i] = 1; } } return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...