Submission #341976

# Submission time Handle Problem Language Result Execution time Memory
341976 2020-12-31T21:16:22 Z cheissmart CONSUL (info1cup19_consul) C++14
Compilation error
0 ms 0 KB
#include "grader.h"
#ifdef CHEISSMART
#include "grader.cpp"
#endif

void solve(int n) {
	set<int> asked;
	int qry = 0;
	auto is = [&] (int i) {
		int x = kth(i);
		qry++;
		if(asked.count(x)) return -1;
		asked.insert(x);
		qry++;
		if(cnt(x) * 3 > n) return x;
		else return -1;
	};
	mt19937 rng(time(0));
	while(qry + 2 <= 60) {
		int pos = rng() % n + 1;
		int r = is(pos);
		if(r != -1) say_answer(r);
	}
 	say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:7:2: error: 'set' was not declared in this scope
    7 |  set<int> asked;
      |  ^~~
consul.cpp:7:6: error: expected primary-expression before 'int'
    7 |  set<int> asked;
      |      ^~~
consul.cpp: In lambda function:
consul.cpp:12:6: error: 'asked' was not declared in this scope
   12 |   if(asked.count(x)) return -1;
      |      ^~~~~
consul.cpp:13:3: error: 'asked' was not declared in this scope
   13 |   asked.insert(x);
      |   ^~~~~
consul.cpp: In function 'void solve(int)':
consul.cpp:18:2: error: 'mt19937' was not declared in this scope
   18 |  mt19937 rng(time(0));
      |  ^~~~~~~
consul.cpp:20:13: error: 'rng' was not declared in this scope
   20 |   int pos = rng() % n + 1;
      |             ^~~