#include<iostream>
using namespace std;
int main()
{
long int a, b, c, d;
while (cin >> a >> b >> c >> d) {
int f[2][b+1], h[2][b+1], e=0, i[a+1], m=0, n=0, num, bb=a;
while (1) {
i[a]=0;
a--;
if (a==0) {
i[a]=0;
break;
}
}
while (b--) {
cin >> f[0][m] >> h[0][m];
m++;
}
f[0][m+1] = 0; h[0][m+1] = 0;
m=0;
while (c--) {
cin >> f[1][m];
while (1) {
if (f[1][m]==f[0][n]&&i[f[0][n]]!=1) {
i[f[0][n]] = 1; i[h[0][n]] = 1;
num=n;
while (1) {
if (h[0][n]==f[0][e]&&i[f[0][e]]!=1) {
i[f[0][e]] = 1; i[h[0][e]] = 1;
n=e; e=0;
}
else if (h[0][n]==f[0][e]) {
i[h[0][e]] = 1;
e++;
}
else if (f[0][e]) {
e++;
}
else {
e=0; n=num; n++; break;
}
}
}
else if (f[1][m]==f[0][n]) {
i[h[0][n]] = 1;
n++;
}
else if (f[0][n]) {
n++;
}
else {
n=0; break;
}
}
m++;
}
while (1) {
a++;
if (a==bb) {
while (a--) {
i[a] =i[a-1];
}
break;
}
}
m=0;
while (d--) {
cin >> h[1][m];
if (i[h[1][m]]==1) {
cout << "TUIHUOOOOOO" << endl;
}
else {
cout << "YA~~" << endl;
}
}
}
}
請問哪裡導致 Segmentation fault (core dumped)