Submission #637595

#TimeUsernameProblemLanguageResultExecution timeMemory
637595tvladm2009CONSUL (info1cup19_consul)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #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:11:20: error: could not convert 'mp.std::map<int, int>::find(x)' from 'std::map<int, int>::iterator' {aka 'std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator'} to 'bool'
   11 |         if (mp.find(x)) {
      |             ~~~~~~~^~~
      |                    |
      |                    std::map<int, int>::iterator {aka std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::iterator}