Submission #637594

#TimeUsernameProblemLanguageResultExecution timeMemory
637594tvladm2009CONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <grader.h> using namespace std; void solve(int n) { srand(time(NULL)); map<int, int> mp; while (true) { int x = rand() % n + 1; if (mp.find(x)) { continue; } mp[x] = true; if (cnt(kth(x)) > n / 3) { say_answer(x); return; } } say_answer(-1); }

Compilation message (stderr)

consul.cpp: In function 'void solve(int)':
consul.cpp:8:5: error: 'map' was not declared in this scope
    8 |     map<int, int> mp;
      |     ^~~
consul.cpp:3:1: note: 'std::map' is defined in header '<map>'; did you forget to '#include <map>'?
    2 | #include <grader.h>
  +++ |+#include <map>
    3 | 
consul.cpp:8:9: error: expected primary-expression before 'int'
    8 |     map<int, int> mp;
      |         ^~~
consul.cpp:11:13: error: 'mp' was not declared in this scope
   11 |         if (mp.find(x)) {
      |             ^~
consul.cpp:14:9: error: 'mp' was not declared in this scope
   14 |         mp[x] = true;
      |         ^~