249322026-02-16 22:16:01ercseferencHálózati átvitelcpp17Compilation error
#include <bits/stdc++.h>
using namespace std;
int n,m,k,h;
struct dupla{int a,b;};
struct csucs{vector<int>tav; vector<dupla>kim;};
int main()
{
    //ifstream f("szamok.txt");
    cin>>n>>m>>k>>h;
    vector<csucs>a(n+1);
    for(int i=1; i<=n; i++){
        a[i].tav.resize(h+1);
        fill(a[i].tav.begin(),a[i].tav.end(),-1);}
    for(int i=0; i<m; i++){
        int x,y,z; cin>>x>>y>>z;
        a[x].kim.push_back({y,z});
        a[y].kim.push_back({x,z});}
    vector<int>l1,l2; l1.push_back(k);
    for(int i=0; i<=h; i++)a[k].tav[i]=INT_MAX;
    for(int i=0; i<h; i++){
        for(int j:l1){
            for(dupla l:a[j].kim){
                if(a[l.a].tav[i+1]<min(l.b,a[j].tav[i])){
                    for(int o=i+1; o<=h; o++{
                        a[l.a].tav[o]=min(l.b,a[j].tav[i]);}
                        l2.push_back(l.a);}}}}
        l1=l2; l2.clear();}
    for(int i=1; i<=n; i++)
        if(i==k)cout<<0<<'\n';
        else cout<<a[i].tav[h]<<'\n';
    return 0;
}
Compilation error
open /var/local/lib/isolate/421/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:24:45: error: expected ')' before '{' token
   24 |                     for(int o=i+1; o<=h; o++{
      |                        ~                    ^
      |                                             )
main.cpp: At global scope:
main.cpp:28:5: error: expected unqualified-id before 'for'
   28 |     for(int i=1; i<=n; i++)
      |     ^~~
main.cpp:28:18: error: 'i' does not name a type
   28 |     for(int i=1; i<=n; i++)
      |                  ^
main.cpp:28:24: error: 'i' does not name a type
   28 |     for(int i=1; i<=n; i++)
      |                        ^
main.cpp:30:9: error: expected unqualified-id before 'else'
   30 |         else cout<<a[i].tav[h]<<'\n';
      |         ^~~~
main.cpp:31:5: error: expected unqualified-id before 'return'
   31 |     return 0;
      |     ^~~~~~
main.cpp:32:1: error: expected declaration before '}' token
   32 | }
      | ^