Submission #759918

#TimeUsernameProblemLanguageResultExecution timeMemory
759918denniskimList of Unique Integers (FXCUP4_unique)C++17
100 / 100
1 ms468 KiB
#include "unique.h"
#include <bits/stdc++.h>

using namespace std;
typedef int ll;
typedef __int128 lll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
#define MAX 9223372036854775807LL
#define MIN -9223372036854775807LL
#define INF 0x3f3f3f3f3f3f3f3f
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cout << fixed; cout.precision(10);
#define sp << " "
#define en << "\n"
#define compress(v) sort(v.begin(), v.end()), v.erase(unique(v.begin(), v.end()), v.end())

ll gap1[210], gap2[210];

vector<ll> PickUnique(ll N)
{
	vector<ll> ans;
	
	for(ll i = 0 ; i < N ; i++)
		ans.push_back(1);
	
	for(ll i = 0 ; i < N ; i++)
		gap1[i] = gap2[i] = 0;
	
	for(ll i = 0 ; i < N ; i++)
	{
		gap1[i] = UniqueCount(0, i);
		gap2[i] = UniqueCount(i, N - 1);
	}
	
	for(ll i = N - 2 ; i >= 0 ; i--)
	{
		ll delta = gap1[i] - gap1[i + 1];
		
		if(delta == 0)
			ans[i + 1] = 0;
		else if(delta == 1)
			ans[i + 1] = 0;
	}
	
	for(ll i = 0 ; i < N - 1 ; i++)
	{
		ll delta = gap2[i + 1] - gap2[i];
		
		if(delta == 0)
			ans[i] = 0;
		else if(delta == 1)
			ans[i] = 0;
	}
	
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...