Submission #149350

#TimeUsernameProblemLanguageResultExecution timeMemory
149350준표야 함수컵은 캐리해줄거지? (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include "unique.h" using namespace std; std::vector<int> PickUnique(int N) { int tot = UniqueCount(0, N - 1); vector<int> ret(N, 0); for(int i = 0, cur = tot; i < N - 1; i++){ int cnt = UniqueCount(i + 1, N - 1); if(cnt == cur - 1) ret[i]++; cur = cnt; } for(int i = N - 1, cur = tot; i > 0; i--){ int cnt = UniqueCount(0, i - 1); if(cnt == cur - 1) ret[i]++; cur = cnt; } for(int i = 1; i < N - 1; i++) ret[i] = (ret[i] == 2 ? 1 : 0); return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...