답안 #151962

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
151962 2019-09-05T17:01:27 Z minty99 List of Unique Integers (FXCUP4_unique) C++17
100 / 100
2 ms 632 KB
#include "unique.h"

std::vector<int> PickUnique(int N) {
	std::vector<int> U(N);

	int uc0[200], ucN[200];
	for(int i = 0; i < N; i++)
	{
		uc0[i] = UniqueCount(0, i);
		ucN[i] = UniqueCount(i, N-1);
	}

	for(int i = 0; i < N; i++)
	{
		if(i == 0)
			U[i] = ucN[i] > ucN[i+1] ? 1 : 0;
		else if(i == N-1)
			U[i] = uc0[i] > uc0[i-1] ? 1 : 0;
		else
			U[i] = (uc0[i] > uc0[i-1] && ucN[i] > ucN[i+1]) ? 1 : 0;
	}
	return U;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Correct : C = 4
2 Correct 2 ms 300 KB Correct : C = 10
3 Correct 2 ms 376 KB Correct : C = 50
4 Correct 2 ms 248 KB Correct : C = 100
5 Correct 2 ms 376 KB Correct : C = 100
6 Correct 2 ms 376 KB Correct : C = 154
7 Correct 2 ms 376 KB Correct : C = 200
8 Correct 2 ms 504 KB Correct : C = 300
9 Correct 2 ms 376 KB Correct : C = 356
10 Correct 2 ms 376 KB Correct : C = 400
11 Correct 2 ms 376 KB Correct : C = 400
12 Correct 2 ms 504 KB Correct : C = 400
13 Correct 2 ms 632 KB Correct : C = 400
14 Correct 2 ms 376 KB Correct : C = 400
15 Correct 2 ms 376 KB Correct : C = 400