13904 | 2025-01-09 09:50:45 | RRoli | Tom és Jerry 1 (80) | cpp17 | Forditási hiba |
#include <bits/stdc++.h>
using namespace std;
int n, m, t, p, e;
vector<int> tL;
vector<vector<int>> szom, tszom;
int main() {
cin >> n >> m >> t >> p >> e;
tL.resize(n+1, -1);
szom.resize(n+1, vector<int>(0));
tszom.resize(n+1, vector<int>(0));
for(int i = 0; i < m; i++) {
int a, b, c;
cin >> a >> b >> c;
szom[a].push_back(b);
szom[b].push_back(a);
if(c == 2) {
tszom[a].push_back(b);
tszom[b].push_back(a);
}
}
queue<int> sor;
sor.push(t);
tL[t] = 0;
while(!sor.empty()) {
for(auto i : tszom[sor.front()]) {
if(tL[i] == -1) {
tL[i] = tL[sor.front()]+1;
sor.push(i);
}
}
sor.pop();
}
for(int i = 0; i < p; i++) {
int k;
cin >> k;
queue<int> bsor;
vector<int> L(n+1, -1);
bsor.push(k);
L[k] = 0;
string jo = "NEM";
while(!bsor.empty()) {
if(bsor.front() == e) {
jo = "IGEN";
break;
}
for(auto i : szom[bsor.front()]) {
if(L[i] == -1 && (tL[i] == -1 || tL[i] > L[bsor.front()]+1)) {
L[i] = L[bsor.front()]+1;
bsor.push(i);
}
}
bsor.pop();
}
cout << jo << '\n';
}
open /var/local/lib/isolate/440/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:63:10: error: expected '}' at end of input
63 | }
| ^
main.cpp:8:12: note: to match this '{'
8 | int main() {
| ^