Submission #410853

#TimeUsernameProblemLanguageResultExecution timeMemory
410853LouayFarahTropical 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(i, 0, m) { adj[r[i][0]].pb(r[i][1]); adj[r[i][1]].pb(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:28:9: error: 'i' was not declared in this scope
   28 |     FOR(i, 0, m)
      |         ^
garden.cpp:28:5: error: 'FOR' was not declared in this scope
   28 |     FOR(i, 0, m)
      |     ^~~
garden.cpp:47:9: error: 'answer' was not declared in this scope
   47 |         answer(res);
      |         ^~~~~~