TO ALL GOOD CODERS PLEASE HELP ME OUT
Hey guys, i have spent way too much time on upsolving this problem but i cant get what i am doing wrong
Problem --> 2109D - D/D/D
My code --> ` void dfs(int x , vector &visited , vector<vector>&adj , string &res , int &count , int &j){ if(count > j) return; if(count % 2 == j % 2) res[x-1] = '1'; visited[x] = true;
for(int neighbour : adj[x]){
if(!visited[neighbour]){
count++;
dfs(neighbour , visited , adj ,res , count , j);
}
}}
void solve(){ int n , m , l; cin >> n >> m >> l;
string res(n , '0');
vector<vector<int>>adj(n+1);
vector<int>a(l);
vector<int>visited(n , false);
//* members of multiset
for(int k = 0; k < l; k++){
cin >> a[k];
}
//* adj list
for(int k =0 ; k < m; k++){
int u , v;
cin >> u >> v;
adj[u].pb(v);
adj[v].pb(u);
}
res[0] = '1';
for(int k = 0; k < l; k++){
int count = 0, j = a[k];
dfs(1 , visited , adj ,res , count , j);
}
cout << res << endl;}
int main(){ int t; cin >> t;
while(t--){
solve();
}} `



