답안 #149055

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
149055 2019-09-01T05:39:11 Z GojekKawe(#3581, VinsenN, XxX, dexter) List of Unique Integers (FXCUP4_unique) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
int PickUnique (int N){
	int U[N];
	memset(U,0,N);
	if(UniqueCount(0,N-1)==UniqueCount(0,N-2)+1){
			U[N-1]=1;
		}
	if(UniqueCount(0,N-1)==UniqueCount(1,N-1)+1){
			U[0]=1;
		}
	for(int i=N-2; i>0;i--){
		if(UniqueCount(0,i)==UniqueCount(0,i-1)+1){
			if(UniqueCount(i,N-1)==UniqueCount(i+1,N-1)+1){
				U[i]=1;
			}
		}
	}
	return U;
}
int main(){
	int N;
	cin>>N;
	PickUnique(N);
}

Compilation message

unique.cpp: In function 'int PickUnique(int)':
unique.cpp:6:5: error: 'UniqueCount' was not declared in this scope
  if(UniqueCount(0,N-1)==UniqueCount(0,N-2)+1){
     ^~~~~~~~~~~
unique.cpp:9:5: error: 'UniqueCount' was not declared in this scope
  if(UniqueCount(0,N-1)==UniqueCount(1,N-1)+1){
     ^~~~~~~~~~~
unique.cpp:13:6: error: 'UniqueCount' was not declared in this scope
   if(UniqueCount(0,i)==UniqueCount(0,i-1)+1){
      ^~~~~~~~~~~
unique.cpp:19:9: error: invalid conversion from 'int*' to 'int' [-fpermissive]
  return U;
         ^
unique.cpp:4:6: warning: address of local variable 'U' returned [-Wreturn-local-addr]
  int U[N];
      ^