# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
148403 | 본인 하지만 안 어림 ㅋㅋ (#200) | List of Unique Integers (FXCUP4_unique) | C++17 | 6 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "unique.h"
using namespace std;
int leftCount[202]; // [ 0, i ]
int rightCount[202]; // [ i, N - 1 ]
vector<int> PickUnique(int N) {
if(N == 1) return vector<int>(1, 1);
vector<int> ans(N, 0);
int total = UniqueCount(0, N - 1);
leftCount[N - 1] = total;
rightCount[0] = total;
leftCount[0] = 1;
rightCount[N - 1] = 1;
for(int i = 1; i < N - 1; i++){
leftCount[i] = UniqueCount(0, i);
rightCount[i] = UniqueCount(i, N - 1);
}
for(int i = 0; i < N; i++){
// 1. i번 뒤에 같은 수가 없어야 함.
bool notInRight = i == N - 1 || rightCount[i + 1] < rightCount[i];
bool notInLeft = i == 0 || leftCount[i - 1] < leftCount[i];
ans[i] = notInRight && notInLeft;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |