#include <bits/stdc++.h>
#include "garden.h"
/// #pragma GCC optimize ("Ofast")
/// #pragma GCC target ("avx2")
/// #pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ii = pair<ll, ll>;
using vi = vector<int>;
#define ff first
#define ss second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lb lower_bound
const int MOD = 1000 * 1000 * 1000 + 7;
void answer(int X) {
cout << X << " ";
}
int to[150001][2];
set<int> D[150001];
map<int, int> vis[150001][2];
vector<array<int, 2>> adj[150001];
void dfs(int v, int p, int state, int dep = 0) {
if(dep >= 150000 || vis[v][dep][state]) return;
D[dep].insert(v); vis[v][dep][state] = 1;
for(auto u : adj[v]) {
if(u[0] != p && u[1] == 0)
dfs(u[0], v, 0, dep + 1);
else if(u[0] == p && u[1] == 1)
dfs(u[0], v, 1, dep + 1);
else if(u[0] == p && to[u[0]][1] == -1)
dfs(u[0], v, 0, dep + 1);
}
}
void count_routes(int N, int M, int P, int R[][2], int Q, int G[]) {
memset(to, -1, sizeof to);
for(int l = 0; l < M; l++) {
int u = R[l][0], v = R[l][1];
if(to[u][0] == -1) to[u][0] = v;
else if(to[u][0] != -1 && to[u][1] == -1) to[u][1] = v;
if(to[v][0] == -1) to[v][0] = u;
else if(to[v][0] != -1 && to[v][1] == -1) to[v][1] = u;
}
for(int l = 0; l < N; l++) {
if(to[l][0] != -1)
adj[to[l][0]].pb({l, 0});
if(to[l][1] != -1)
adj[to[l][1]].pb({l, 1});
}
dfs(P, P, 0, 0);
for(int l = 0; l < Q; l++) {
int v = G[l] % 150000;
answer(D[v].size());
}
}
Compilation message
/usr/bin/ld: /tmp/ccXdzPls.o: in function `answer(int)':
grader.cpp:(.text+0x130): multiple definition of `answer(int)'; /tmp/cct9d4zo.o:garden.cpp:(.text+0x4b0): first defined here
collect2: error: ld returned 1 exit status