Submission #1105201

#TimeUsernameProblemLanguageResultExecution timeMemory
1105201jadai007Tropical Garden (IOI11_garden)C++17
Compilation error
0 ms0 KiB
#include "garden.h" #include "gardenlib.h" #include <bits/stdc++.h> using namespace std; int ans = 0; void dfs(int u, int k, int P){ if(u == P && k == 0) ans++; for(auto v:vc[u]) dfs(v, k - 1, P); } void count_routes(int N, int M, int P, int R[][2], int Q, int G[]){ vector<int> vc[200200], ans(Q, 0), dis(N, 0), vis(N, 0); for(int i = 0; i < M; ++i) vc[R[i][0]].push_back(R[i][1]), vc[R[i][1]].push_back(R[i][0]); for(int i = 1; i <= n; ++i) dfs(i, k, P); answer(ans); }

Compilation message (stderr)

garden.cpp: In function 'void dfs(int, int, int)':
garden.cpp:11:16: error: 'vc' was not declared in this scope; did you mean 'v'?
   11 |     for(auto v:vc[u]) dfs(v, k - 1, P);
      |                ^~
      |                v
garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:17:25: error: 'n' was not declared in this scope
   17 |     for(int i = 1; i <= n; ++i) dfs(i, k, P);
      |                         ^
garden.cpp:17:40: error: 'k' was not declared in this scope
   17 |     for(int i = 1; i <= n; ++i) dfs(i, k, P);
      |                                        ^
garden.cpp:18:12: error: cannot convert 'std::vector<int>' to 'int'
   18 |     answer(ans);
      |            ^~~
      |            |
      |            std::vector<int>
In file included from garden.cpp:2:
gardenlib.h:1:17: note:   initializing argument 1 of 'void answer(int)'
    1 | void answer(int x);
      |             ~~~~^