Submission #839169

# Submission time Handle Problem Language Result Execution time Memory
839169 2023-08-28T23:09:37 Z asdfgrace Tropical Garden (IOI11_garden) C++17
Compilation error
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);
      |     ^~~~~~