Submission #151484

# Submission time Handle Problem Language Result Execution time Memory
151484 2019-09-03T11:36:32 Z leduykhongngu List of Unique Integers (FXCUP4_unique) C++17
Compilation error
0 ms 0 KB
#include <vector>
std::vector<int> PickUnique(int N)
{
	std::vector<int> res(N, 1);
	int preask = 1;
    for (int i = 1; i < N; ++i) {
		int ask = UniqueCount(0, i);
		if (ask <= preask) {
			res[i] = 0;
		}
		preask = ask;
	}
	preask = 1;
	for (int i = N - 2; i >= 0; --i) {
		int ask = UniqueCount(i, N - 1);
		if (ask <= preask) {
			res[i] = 0;
		}
		preask = ask;
	}
	return res;
}

Compilation message

unique.cpp: In function 'std::vector<int> PickUnique(int)':
unique.cpp:7:13: error: 'UniqueCount' was not declared in this scope
   int ask = UniqueCount(0, i);
             ^~~~~~~~~~~
unique.cpp:15:13: error: 'UniqueCount' was not declared in this scope
   int ask = UniqueCount(i, N - 1);
             ^~~~~~~~~~~