제출 #247089

#제출 시각아이디문제언어결과실행 시간메모리
247089errorgornList of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms512 KiB
#include <bits/stdc++.h>
#include "unique.h"
using namespace std;

#define rep(x,s,e) for (auto x=s-(s>e);x!=e-(s>e);(s<e?x++:x--))

std::vector<int> PickUnique(int n) {
	vector<int> res;
	
	rep(x,0,n){
		res.push_back(1);
	}
	
	int p=1,c;
	rep(x,1,n){
		c=UniqueCount(0,x);
		
		if (p>=c) res[x]=0;
		p=c;
	}
	
	p=1;
	rep(x,n-1,0){
		c=UniqueCount(x,n-1);
		
		if (p>=c) res[x]=0;
		p=c;
	}
	
	//rep(x,0,n) cout<<res[x]<<" ";cout<<endl;
	
	return res;
}
#Verdict Execution timeMemoryGrader output
Fetching results...