Submission #148826

#TimeUsernameProblemLanguageResultExecution timeMemory
14882620190901 (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
8 ms512 KiB
#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;
}
#Verdict Execution timeMemoryGrader output
Fetching results...