// a >> b = a / pow(2,b)
// a << b = a * pow(2,b)
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define sz size()
#define ss second
#define ff first
#define N 200001
#define pii pair<int,int>
using namespace std;
int ans;
vector <pii> adj[N];
void dfs(int nd, int c, int k, int p){
if(c == k){
if(nd == p) ans++;
return;
}
bool a = 0;
if(adj[nd].sz == 1) a = 0;
else a = 1;
dfs(adj[nd][a].ss, c+1, k, p);
}
//int answer(int x){
// return x;
//}
vector<int> count_routes(int n, int m, int p, int r[N][2], int q, int g[2001]){
vector <int> answer;
for(int i = 0; i < m; i++){
adj[r[i][0]].pb({i,r[i][1]});
adj[r[i][1]].pb({i,r[i][0]});
}
for(int i = 0; i < n; i++) sort(adj[i].begin(), adj[i].end());
for(int i = 0; i < q; i++){
for(int j = 0; j < n; j++){
dfs(j,0,g[i],p);
}
answer.pb(ans);
ans = 0;
}
return answer;
}
int main(){
int n, m, p, r[N][2], q, g[q];
cin >> n >> m >> p;
for(int i = 0; i < m; i++) cin >> r[i][0] >> r[i][1];
cin >> q;
for(int i = 0; i < q; i++) cin >> g[i];
count_routes(n,m,p,r,q,g);
}
Compilation message
garden.cpp: In function 'int main()':
garden.cpp:51:30: warning: 'q' is used uninitialized in this function [-Wuninitialized]
51 | int n, m, p, r[N][2], q, g[q];
| ^
/usr/bin/ld: /tmp/cc60Oml1.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccOH5bo0.o:garden.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status