답안 #331966

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331966 2020-11-30T21:03:21 Z LushoPlusPlus 늑대인간 (IOI18_werewolf) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
  // Can we go from start to end using vertices in range [lo, hi]?
  queue<int> que;
  vector<bool> vis(N);
  if (lo <= start && start <= hi) {
    que.push(start);
    vis[start] = true;
  }

  while (!que.empty()) {
    int v = que.front();
    que.pop();
    for (int u : adj[v]) {
      if (lo <= u && u <= hi && !vis[u]) {
        que.push(u);
        vis[u] = true;
      }
    }
  }

  return vis[end];
}

Compilation message

werewolf.cpp:2:16: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                ^~~~~~
      |                std::vector
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from werewolf.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
werewolf.cpp:2:23: error: 'vector' was not declared in this scope; did you mean 'std::vector'?
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                       ^~~~~~
      |                       std::vector
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from werewolf.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:386:11: note: 'std::vector' declared here
  386 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
werewolf.cpp:2:30: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                              ^~~
werewolf.cpp:2:43: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                           ^~~
werewolf.cpp:2:50: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                  ^~~
werewolf.cpp:2:61: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                             ^~~
werewolf.cpp:2:70: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                      ^~~
werewolf.cpp:2:78: error: expected primary-expression before 'int'
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                              ^~~
werewolf.cpp:2:84: error: expression list treated as compound expression in initializer [-fpermissive]
    2 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                                    ^