Submission #148537

# Submission time Handle Problem Language Result Execution time Memory
148537 2019-09-01T04:37:27 Z TeamSUA(#3565, zimpha, sfiction, JTJL) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 592 KB
#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 time Memory Grader output
1 Correct 5 ms 256 KB Correct : C = 3
2 Correct 5 ms 384 KB Correct : C = 9
3 Correct 6 ms 344 KB Correct : C = 49
4 Correct 5 ms 384 KB Correct : C = 99
5 Correct 5 ms 384 KB Correct : C = 99
6 Correct 5 ms 384 KB Correct : C = 153
7 Correct 5 ms 384 KB Correct : C = 199
8 Correct 5 ms 512 KB Correct : C = 299
9 Correct 6 ms 512 KB Correct : C = 355
10 Correct 6 ms 512 KB Correct : C = 399
11 Correct 6 ms 472 KB Correct : C = 399
12 Correct 6 ms 592 KB Correct : C = 399
13 Correct 5 ms 512 KB Correct : C = 399
14 Correct 5 ms 512 KB Correct : C = 399
15 Correct 6 ms 512 KB Correct : C = 399