답안 #148826

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148826 2019-09-01T05:12:03 Z 20190901(#3597, tongnamuu, jf297, upple1) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
8 ms 512 KB
#include "unique.h"
std::vector<int> PickUnique(int N) {
	std::vector<int> res(N, 0);

	int cnt = UniqueCount(0, N-1);
	int real_count=0;
	int count=cnt;
	int l=0, r=cnt;
	for (int i = 1; i < N; i++)
	{
		int new_l = UniqueCount(0, i-1);
		int new_r = UniqueCount(i, N-1);
		if(new_l > l && new_r<r)
		{
			res[i-1]=1;
			real_count++;
			count--;
		}
		
		l=new_l, r=new_r;
	}

	if(count) res[N-1]=1;
	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 216 KB Correct : C = 3
2 Correct 8 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 6 ms 384 KB Correct : C = 99
6 Correct 5 ms 436 KB Correct : C = 153
7 Correct 5 ms 384 KB Correct : C = 199
8 Correct 5 ms 384 KB Correct : C = 299
9 Correct 6 ms 476 KB Correct : C = 355
10 Correct 6 ms 512 KB Correct : C = 399
11 Correct 8 ms 512 KB Correct : C = 399
12 Correct 6 ms 512 KB Correct : C = 399
13 Correct 5 ms 512 KB Correct : C = 399
14 Correct 6 ms 512 KB Correct : C = 399
15 Correct 5 ms 512 KB Correct : C = 399