답안 #331965

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
331965 2020-11-30T21:02:24 Z LushoPlusPlus 늑대인간 (IOI18_werewolf) C++14
컴파일 오류
0 ms 0 KB
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:1:16: error: 'vector' was not declared in this scope
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                ^~~~~~
werewolf.cpp:1:23: error: 'vector' was not declared in this scope
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                       ^~~~~~
werewolf.cpp:1:30: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                              ^~~
werewolf.cpp:1:43: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                           ^~~
werewolf.cpp:1:50: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                  ^~~
werewolf.cpp:1:61: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                             ^~~
werewolf.cpp:1:70: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                      ^~~
werewolf.cpp:1:78: error: expected primary-expression before 'int'
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                              ^~~
werewolf.cpp:1:84: error: expression list treated as compound expression in initializer [-fpermissive]
    1 | bool reachable(vector<vector<int> >& adj, int N, int start, int end, int lo, int hi) {
      |                                                                                    ^