Submission #149280

#TimeUsernameProblemLanguageResultExecution timeMemory
149280(대충 적당한 팀명) (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include "unique.h" #include <iostream> std::vector<int> PickUnique(int N) { std::vector<int> arr1, arr2, arr3, answer; int front = 0, end = N - 1; int count = UniqueCount(0, N-1); while (++front < N) { int ucount = UniqueCount(front, N-1); if (ucount >= count) { arr1.push_back(0); } else { arr1.push_back(1); } count = ucount; } arr1.push_back(1); count = UniqueCount(0, N-1); while (--end >= 0) { int ucount = UniqueCount(0, end); if (ucount >= count) { arr2.push_back(0); } else { arr2.push_back(1); } count = ucount; } arr2.push_back(1); while (!arr1.empty()) { arr3.push_back(arr1.back()); arr1.pop_back(); } while (!arr2.empty() && !arr3.empty()) { answer.push_back(arr2.back() && arr3.back()); arr2.pop_back(); arr3.pop_back(); } return answer; }
#Verdict Execution timeMemoryGrader output
Fetching results...