답안 #839169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839169 2023-08-28T23:09:37 Z asdfgrace 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "garden.h"
using namespace std;

void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
  vector<vector<int>> edges(N);
  for (int i = 0; i < M; ++i) {
    edges[R[i][0]].push_back(R[i][1]);
    edges[R[i][1]].push_back(R[i][0]);
  }
  for (int q = 0; q < Q; ++q) {
    int ans = 0;
    for (int i = 0; i < N; ++i) {
      int cur = i, prev = i;
      for (int it = 0; it < G[q]; ++it) {
        if (prev != edges[cur][0] || (int) edges[cur].size() == 1) {
          prev = cur;
          cur = edges[cur][0];
        } else {
          prev = cur;
          cur = edges[cur][1];
        }
      }
      if (cur == P) {
        ++ans;
      }
    }
    answer(ans);
  }
}

Compilation message

garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:28:5: error: 'answer' was not declared in this scope
   28 |     answer(ans);
      |     ^~~~~~