Submission #1105201

# Submission time Handle Problem Language Result Execution time Memory
1105201 2024-10-25T17:33:12 Z jadai007 Tropical Garden (IOI11_garden) C++17
Compilation error
0 ms 0 KB
#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

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);
      |             ~~~~^