Submission #1060955

# Submission time Handle Problem Language Result Execution time Memory
1060955 2024-08-16T04:59:01 Z thieunguyenhuy Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
Compilation error
0 ms 0 KB
vector<int> get_set(int x) {
	vector<vector<int>> all_sets;
	for (int mask = 0; mask < MASK(12); ++mask) {
		if (popcount(mask) != 6) continue;
		vector<int> cur_set;
		for (int i = 0; i < 12; ++i) if (BIT(mask, i)) {
			cur_set.emplace_back(i);
		}
		sort (cur_set.begin(), cur_set.end());
		all_sets.emplace_back(cur_set);
	}

	sort (all_sets.begin(), all_sets.end());
	return all_sets[x - 1];
}

int encoder(int n, int x, int y) {
	vector<int> X = get_set(x), Y = get_set(y);
	vector<bool> mark(12, false);
	for (auto it : Y) mark[it] = true;
	for (auto it : X) if (!mark[it]) return it + 1;
	assert(false); return -1;
}
vector<int> get_set(int x) {
	vector<vector<int>> all_sets;
	for (int mask = 0; mask < MASK(12); ++mask) {
		if (popcount(mask) != 6) continue;
		vector<int> cur_set;
		for (int i = 0; i < 12; ++i) if (BIT(mask, i)) {
			cur_set.emplace_back(i);
		}
		sort (cur_set.begin(), cur_set.end());
		all_sets.emplace_back(cur_set);
	}

	sort (all_sets.begin(), all_sets.end());
	return all_sets[x - 1];
}

int decode(int n, int q, int h) {
	vector<int> Q = get_set(q); --h;
	for (auto it : Q) if (it == h) return 1;
	return 0;
}

Compilation message

encoder.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> get_set(int x) {
      | ^~~~~~
encoder.cpp: In function 'int encoder(int, int, int)':
encoder.cpp:18:2: error: 'vector' was not declared in this scope
   18 |  vector<int> X = get_set(x), Y = get_set(y);
      |  ^~~~~~
encoder.cpp:18:9: error: expected primary-expression before 'int'
   18 |  vector<int> X = get_set(x), Y = get_set(y);
      |         ^~~
encoder.cpp:19:9: error: expected primary-expression before 'bool'
   19 |  vector<bool> mark(12, false);
      |         ^~~~
encoder.cpp:20:17: error: 'Y' was not declared in this scope
   20 |  for (auto it : Y) mark[it] = true;
      |                 ^
encoder.cpp:20:20: error: 'mark' was not declared in this scope
   20 |  for (auto it : Y) mark[it] = true;
      |                    ^~~~
encoder.cpp:21:17: error: 'X' was not declared in this scope
   21 |  for (auto it : X) if (!mark[it]) return it + 1;
      |                 ^
encoder.cpp:21:25: error: 'mark' was not declared in this scope
   21 |  for (auto it : X) if (!mark[it]) return it + 1;
      |                         ^~~~
encoder.cpp:22:2: error: 'assert' was not declared in this scope
   22 |  assert(false); return -1;
      |  ^~~~~~
encoder.cpp:1:1: note: 'assert' is defined in header '<cassert>'; did you forget to '#include <cassert>'?
  +++ |+#include <cassert>
    1 | vector<int> get_set(int x) {

decoder.cpp:1:1: error: 'vector' does not name a type
    1 | vector<int> get_set(int x) {
      | ^~~~~~
decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:18:2: error: 'vector' was not declared in this scope
   18 |  vector<int> Q = get_set(q); --h;
      |  ^~~~~~
decoder.cpp:18:9: error: expected primary-expression before 'int'
   18 |  vector<int> Q = get_set(q); --h;
      |         ^~~
decoder.cpp:19:17: error: 'Q' was not declared in this scope
   19 |  for (auto it : Q) if (it == h) return 1;
      |                 ^