제출 #502090

#제출 시각아이디문제언어결과실행 시간메모리
502090bigoCONSUL (info1cup19_consul)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "grader.h" #include <map> #include <set> 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); }

컴파일 시 표준 에러 (stderr) 메시지

consul.cpp: In function 'void solve(int)':
consul.cpp:6:5: error: 'map' was not declared in this scope; did you mean 'std::map'?
    6 |     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:6:9: error: expected primary-expression before 'int'
    6 |     map<int, int>his;
      |         ^~~
consul.cpp:7:5: error: 'set' was not declared in this scope; did you mean 'std::set'?
    7 |     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:7:9: error: expected primary-expression before 'int'
    7 |     set<int>vec;
      |         ^~~
consul.cpp:10:9: error: 'his' was not declared in this scope
   10 |         his[k]++;
      |         ^~~
consul.cpp:11:9: error: 'vec' was not declared in this scope
   11 |         vec.insert(k);
      |         ^~~
consul.cpp:13:19: error: 'vec' was not declared in this scope
   13 |     for (auto u : vec) {
      |                   ^~~
consul.cpp:14:13: error: 'his' was not declared in this scope
   14 |         if (his[u] >= n / 3)
      |             ^~~