Submission #148537

#TimeUsernameProblemLanguageResultExecution timeMemory
148537TeamSUA (#200)List of Unique Integers (FXCUP4_unique)C++17
100 / 100
6 ms592 KiB
#include "unique.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

std::vector<int> PickUnique(int N) {
	int n = N;
	vector<int> f(n, 0);
	int total = UniqueCount(0, n - 1);
	int now = total;
	for (int i = 1; i < n; i++) {
		int tmp = UniqueCount(i, n - 1);
		if (now == tmp + 1) f[i - 1]++;
		now = tmp;
	}
	now = total;
	for (int i = n - 2; i >= 0; i--) {
		int tmp = UniqueCount(0, i);
		if (now == tmp + 1) f[i + 1]++;
		now = tmp;
	}
	f[n - 1]++;
	f[0]++;
	vector<int> ans;
	for (int i = 0; i < n; i++)
		if (f[i] == 2)
			ans.push_back(1);
		else ans.push_back(0);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...