Submission #149546

# Submission time Handle Problem Language Result Execution time Memory
149546 2019-09-01T06:42:22 Z 티셔츠 콜렉터(#3632, yoni, jisunchae, jsg1504) List of Unique Integers (FXCUP4_unique) C++17
0 / 100
5 ms 256 KB
#include "unique.h"

std::vector<int> PickUnique(int N) {
    int result[N];
    int leftIndex = 0;
    int rightIndex = N-1;
    while (leftIndex < rightIndex) {
        int totalUniqueCount = UniqueCount(leftIndex, rightIndex);
        int leftUniqueCount = UniqueCount(leftIndex + 1, rightIndex);
        int rightUniqueCount = UniqueCount(leftIndex, rightIndex - 1);
        
        if (totalUniqueCount <= leftUniqueCount) {
            result[leftIndex] = 0;
        } else if (totalUniqueCount <= rightUniqueCount) {
            result[rightIndex] = 0;
        } else {
            if (totalUniqueCount > leftUniqueCount) {
                result[leftIndex] = 1;
            }
            if (totalUniqueCount > rightUniqueCount) {
                result[rightIndex] = 1;
            }
        }
        leftIndex++;
        rightIndex--;
    }

    std::vector<int> output;
    for (int i = 0; i < N; i++) {
        output.push_back(result[i]);
    }
	return output;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Correct : C = 3
2 Incorrect 5 ms 256 KB Wrong
3 Halted 0 ms 0 KB -