| 21089 | 2026-01-12 11:26:49 | csdavid | Hálózati átvitel | cpp17 | Compilation error |
#include <iostream>
#include <vector>
using namespace std;
struct node{
int maxi=-1;
int speed[101] = {-1};
};
node a[10000];
int n, k, h;
void bejar(int x, int tav){
a[x].maxi=max(a[x].maxi, a[x].speed[tav]);
if(tav==h){
return;
}
//cout << "\n\nx: " << x << "\ntav: " << tav;
for(pair<int, int> i: a[x].szomszed){
if(x==3&&i.first==2){
//cout << "\n\na[x].speed[tav]: " << a[x].speed[tav];
//cout << "a[i.first].speed[tav+1]): " << a[i.first].speed[tav+1];
}
if(min(a[x].speed[tav], i.second)>a[i.first].speed[tav+1]){
a[i.first].speed[tav+1]=min(a[x].speed[tav], i.second);
bejar(i.first, tav+1);
}
}
}
int main()
{
pair<int, int> x;
int k, b, c, y, m;
cin >> n >> m >> k >> h;
k--;
while(m--){
cin >> b >> c >> y;
b--;
c--;
a[c].szomszed.push_back(make_pair(b, y));
a[b].szomszed.push_back(make_pair(c, y));
}
a[k].speed[0]=9999999;
bejar(k, 0);
a[k].maxi=0;
for(int i=0; i<n; i++){
cout << a[i].maxi << '\n';
}
return 0;
}
open /var/local/lib/isolate/421/box/a.out: no such file or directory
main.cpp: In function 'void bejar(int, int)':
main.cpp:18:32: error: 'struct node' has no member named 'szomszed'
18 | for(pair<int, int> i: a[x].szomszed){
| ^~~~~~~~
main.cpp: In function 'int main()':
main.cpp:40:14: error: 'struct node' has no member named 'szomszed'
40 | a[c].szomszed.push_back(make_pair(b, y));
| ^~~~~~~~
main.cpp:41:14: error: 'struct node' has no member named 'szomszed'
41 | a[b].szomszed.push_back(make_pair(c, y));
| ^~~~~~~~