답안 #148626

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
148626 2019-09-01T04:47:51 Z 본인 방금 올솔하는 상상함(#3610, gs18113, dennisstar, red1108) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 640 KB
#include "unique.h"


int dp[220][220];
int ask(int s, int e){
	if(dp[s][e]!=-1) return dp[s][e];
	return dp[s][e]=UniqueCount(s,e);
}
std::vector<int> PickUnique(int N) {
	std::vector<int> ret(N);
	for(int i=0;i<N;i++){
		for(int j=0;j<N;j++) dp[i][j]=-1;
	}
	for(int i=0;i<N;i++){
		if(i==0){
			int a = ask(1,N-1);
			int b = ask(0,N-1);
			if(a+1==b) ret[i]=1;
		}
		else if(i==N-1){
			int a = ask(0,N-2);
			int b = ask(0,N-1);
			if(a+1==b) ret[i]=1;
		}
		else{
			int a = ask(0,i-1);
			int aa = ask(0,i);
			int b = ask(i+1,N-1);
			int bb = ask(i,N-1);
			if(a+1==aa&&b+1==bb) ret[i]=1;
		}
	}
	return ret;
}




# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Correct : C = 3
2 Correct 5 ms 256 KB Correct : C = 9
3 Correct 5 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 6 ms 384 KB Correct : C = 153
7 Correct 5 ms 512 KB Correct : C = 199
8 Correct 6 ms 512 KB Correct : C = 299
9 Correct 6 ms 640 KB Correct : C = 355
10 Correct 5 ms 640 KB Correct : C = 399
11 Correct 6 ms 640 KB Correct : C = 399
12 Correct 6 ms 640 KB Correct : C = 399
13 Correct 6 ms 640 KB Correct : C = 399
14 Correct 5 ms 640 KB Correct : C = 399
15 Correct 6 ms 640 KB Correct : C = 399