Submission #1330260

#TimeUsernameProblemLanguageResultExecution timeMemory
1330260nguyenList of Unique Integers (FXCUP4_unique)C++20
0 / 100
0 ms344 KiB
#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> PickUnique(int n)
{
	vector<int> d(n,1);
	int prev = UniqueCount(0,n-1);
	cout<<prev<<endl;
	for(int i = n-2; i >= 0; i--)
	{
	    int d2 = UniqueCount(0,i);
		if(d2 >= prev) d[i+1] = 0;
		else d[i+1] = 1; 
		prev = d2;
	}
	prev = UniqueCount(0,n-1);
	for(int i = 1; i < n; i++)
	{
	    int d2 = UniqueCount(i,n-1);
		if(d2 >= prev) d[i-1] = d[i-1] & 0;
		else d[i-1] = d[i-1] & 1;
		d2 = prev;
	}
	return d;
}
#Verdict Execution timeMemoryGrader output
Fetching results...