This is my code.
#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define pb push_back;
#define rep(i,j,k) for(int i = j;i < k; i++)
vector<int> r;
bool bad[10006];
bool track(int y){
if(bad[y]) return 1;
rep(i,0,(int)r[y].size()){
if(track(r[y][i])) return 1;
}
return 0;
}
int main(){
IOS
int n,m,l,q;
cin >> n >> m >> l >> q;
rep(i,0,m){
int a,b; cin >> a >> b;
r[b].pb(a);
}
rep(i,0,l){
int x; cin >> x;
bad[x] = 1;
}
rep(i,0,q){
int y; cin >> y;
if(track(y)){
cout << "TUIHUOOOOOO\n";
}
else{
cout << "YA~~\n";
}
}
return 0;
}
Dev c++ kept saying that rep(i,0,(int)r[y].size()) has invalid type int[int]. I don't understand why this is invalid. I have searched for this problem but don't get any answer. The problem I only think of is that I used the same name to announce different data type, but I think I don't make this mistake.