Submission #410856

#TimeUsernameProblemLanguageResultExecution timeMemory
410856LouayFarahTropical Garden (IOI11_garden)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "garden.h" using namespace std; void dfs(vector<int> adj[], int u, int p, int k, int parent, int &res) { if(k==0) { if(u==p) res++; return; } if(adj[u].size()==1) dfs(adj, adj[u][0], p, k-1, u, res); else if(adj[u].size()>1) { if(adj[u][0]==parent) dfs(adj, adj[u][1], p, k-1, u, res); else dfs(adj, adj[u][0], p, k-1, u, res); } } void count_routes(int n, int m, int p, int r[][2], int q, int g[]) { vector<int> adj[n]; for(int i = 0; i<m; i++) { adj[r[i][0]].push_back(r[i][1]); adj[r[i][1]].push_back(r[i][0]); } for(int querie = 0; querie<q; querie++) { int k = g[querie]; int res = 0; for(int u = 0; u<n; u++) { if(u==p) continue; dfs(adj, u, p, k, -1, res); } answer(res); } }

Compilation message (stderr)

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