답안 #149953

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149953 2019-09-01T07:27:20 Z 티셔츠 콜렉터(#3632, yoni, jisunchae, jsg1504) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 560 KB
#include "unique.h"

std::vector<int> PickUnique(int N) {
	std::vector<int> res;
	int total = UniqueCount(0, N-1);
	int cur = total;
	int prev = 0;
	for (int i=0; i<N-1; i++) {
		int next = UniqueCount(i+1, N-1);
		int tmp = UniqueCount(0, i);
		int ans = 0;
		if (next < cur) {
			if (tmp > prev) {
				ans = 1;
			}
		}
		res.push_back(ans);
		cur = next;
		prev = tmp;
	}
	int last = 0;
	if (total > prev) {
		last = 1;
	}
	res.push_back(last);
	
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 216 KB Correct : C = 3
2 Correct 6 ms 256 KB Correct : C = 9
3 Correct 6 ms 384 KB Correct : C = 49
4 Correct 5 ms 384 KB Correct : C = 99
5 Correct 5 ms 384 KB Correct : C = 99
6 Correct 5 ms 384 KB Correct : C = 153
7 Correct 5 ms 384 KB Correct : C = 199
8 Correct 5 ms 384 KB Correct : C = 299
9 Correct 5 ms 384 KB Correct : C = 355
10 Correct 5 ms 512 KB Correct : C = 399
11 Correct 6 ms 512 KB Correct : C = 399
12 Correct 5 ms 512 KB Correct : C = 399
13 Correct 5 ms 560 KB Correct : C = 399
14 Correct 6 ms 512 KB Correct : C = 399
15 Correct 5 ms 512 KB Correct : C = 399