Submission #341976

#TimeUsernameProblemLanguageResultExecution timeMemory
341976cheissmartCONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#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 (stderr)

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;
      |             ^~~