Submission #502084

# Submission time Handle Problem Language Result Execution time Memory
502084 2022-01-05T09:19:01 Z bigo CONSUL (info1cup19_consul) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "grader.h"
void solve(int n){
    map<int, int>his;
    set<int>vec;
    for (int i = 0; i < n; i++) {
        int k = kth(i);
        his[k]++;
        vec.insert(k);
    }
    for (auto u : vec) {
        if (his[u] >= n / 3)
            say_answer(u);
    }
    say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:4:5: error: 'map' was not declared in this scope; did you mean 'std::map'?
    4 |     map<int, int>his;
      |     ^~~
      |     std::map
In file included from /usr/include/c++/10/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from consul.cpp:1:
/usr/include/c++/10/bits/stl_map.h:100:11: note: 'std::map' declared here
  100 |     class map
      |           ^~~
consul.cpp:4:9: error: expected primary-expression before 'int'
    4 |     map<int, int>his;
      |         ^~~
consul.cpp:5:5: error: 'set' was not declared in this scope; did you mean 'std::set'?
    5 |     set<int>vec;
      |     ^~~
      |     std::set
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from consul.cpp:1:
/usr/include/c++/10/bits/stl_set.h:94:11: note: 'std::set' declared here
   94 |     class set
      |           ^~~
consul.cpp:5:9: error: expected primary-expression before 'int'
    5 |     set<int>vec;
      |         ^~~
consul.cpp:8:9: error: 'his' was not declared in this scope
    8 |         his[k]++;
      |         ^~~
consul.cpp:9:9: error: 'vec' was not declared in this scope
    9 |         vec.insert(k);
      |         ^~~
consul.cpp:11:19: error: 'vec' was not declared in this scope
   11 |     for (auto u : vec) {
      |                   ^~~
consul.cpp:12:13: error: 'his' was not declared in this scope
   12 |         if (his[u] >= n / 3)
      |             ^~~