답안 #1105202

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1105202 2024-10-25T17:33:37 Z jadai007 열대 식물원 (Tropical Garden) (IOI11_garden) C++17
컴파일 오류
0 ms 0 KB
#include "garden.h"
#include "gardenlib.h"
#include <bits/stdc++.h>

using namespace std;

int ans = 0;
vector<int> vc[200200]

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[]){
    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:10:1: error: expected initializer before 'void'
   10 | void dfs(int u, int k, int P){
      | ^~~~
garden.cpp: In function 'void count_routes(int, int, int, int (*)[2], int, int*)':
garden.cpp:16:32: error: 'vc' was not declared in this scope
   16 |     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]);
      |                                ^~
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:17:33: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
   17 |     for(int i = 1; i <= n; ++i) dfs(i, k, P);
      |                                 ^~~
      |                                 ffs