Submission #149364

# Submission time Handle Problem Language Result Execution time Memory
149364 2019-09-01T06:19:58 Z Ragtag Volunteers(#3721, spellstaker, iamssk, ParaSpawn) List of Unique Integers (FXCUP4_unique) C++17
100 / 100
6 ms 640 KB
#include "unique.h"

std::vector<std::vector<int> > mem;
int querry(int l, int r) {
	if (r < l) return 0;
	if (r == l) return 1;
	int &res = mem[l][r];
	if (res != -1) return res;
	res = UniqueCount(l, r);
	return res;
}

std::vector<int> PickUnique(int n) {
	mem.assign(n, std::vector<int>(n, -1));
	std::vector<int> res(n);
	for (int i = 0; i < n; i++) {
		const int del_l = querry(0, i) - querry(0, i - 1),
			del_r = querry(i, n - 1) - querry(i + 1, n - 1);
		res[i] = del_l == 1 and del_r == 1;
	}

	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 304 KB Correct : C = 1
2 Correct 5 ms 256 KB Correct : C = 7
3 Correct 5 ms 384 KB Correct : C = 47
4 Correct 5 ms 256 KB Correct : C = 97
5 Correct 5 ms 256 KB Correct : C = 97
6 Correct 5 ms 256 KB Correct : C = 151
7 Correct 6 ms 384 KB Correct : C = 197
8 Correct 5 ms 512 KB Correct : C = 297
9 Correct 6 ms 640 KB Correct : C = 353
10 Correct 6 ms 640 KB Correct : C = 397
11 Correct 5 ms 640 KB Correct : C = 397
12 Correct 6 ms 640 KB Correct : C = 397
13 Correct 6 ms 640 KB Correct : C = 397
14 Correct 6 ms 640 KB Correct : C = 397
15 Correct 6 ms 640 KB Correct : C = 397