44672023-03-28 12:11:58AGergoHálózati átvitelcpp17Time limit exceeded 0/50652ms63056 KiB
#include <bits/stdc++.h>

using namespace std;
vector<int> T;
vector<vector<int>> graf;
vector<vector<int>> speed;
int csomo,vonal,koz,H;

void bejar(int item,int szint,int t)
{
    for(int y : graf[item])
    {
        if(y != koz && szint <= H)
        {
            if(t > speed[item][y])
            {
                if(speed[item][y] > T[y]){T[y] = speed[item][y];}
                bejar(y,szint+1,T[y]);
            }
            else
            {
                if(t > T[y]){T[y] = t;}
                bejar(y,szint+1,T[y]);
            }
        }
    }
}

int main()
{
    cin >> csomo >> vonal >> koz >> H ;

    T.resize(csomo+1);
    graf.resize(csomo+1);
    speed.resize(csomo+1,vector<int>(csomo+1,-1));
    int a,b;
    for(int i = 0; i < vonal;i++)
    {
        cin >> a >> b;
        graf[a].push_back(b);
        graf[b].push_back(a);
        //cout << 1;
        cin >> speed[a][b];
        //cout << 2;
        speed[b][a] = speed[a][b];
        //cout << 3;
    }

    for(int x : graf[koz])
    {
        //cout << x;
        T[x] = speed[koz][x];
        bejar(x,1,speed[koz][x]);
    }

    for(int i = 1; i < csomo+1; i++)
    {
        cout << T[i] << "\n";
    }

}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms2092 KiB
2Time limit exceeded0/0598ms2272 KiB
3Wrong answer0/13ms2308 KiB
4Wrong answer0/13ms2440 KiB
5Time limit exceeded0/2574ms2480 KiB
6Time limit exceeded0/2651ms2760 KiB
7Time limit exceeded0/2563ms2992 KiB
8Time limit exceeded0/2648ms2536 KiB
9Time limit exceeded0/1579ms6564 KiB
10Time limit exceeded0/1652ms6148 KiB
11Time limit exceeded0/1566ms6216 KiB
12Time limit exceeded0/1577ms6192 KiB
13Time limit exceeded0/2637ms6472 KiB
14Time limit exceeded0/2569ms6736 KiB
15Time limit exceeded0/2561ms6764 KiB
16Time limit exceeded0/2556ms6844 KiB
17Time limit exceeded0/2564ms6960 KiB
18Time limit exceeded0/2569ms7252 KiB
19Time limit exceeded0/2640ms7376 KiB
20Time limit exceeded0/2635ms7584 KiB
21Runtime error0/128ms63056 KiB
22Runtime error0/127ms63052 KiB
23Runtime error0/128ms63040 KiB
24Runtime error0/127ms62804 KiB
25Runtime error0/227ms62564 KiB
26Runtime error0/227ms62372 KiB
27Runtime error0/227ms62328 KiB
28Runtime error0/227ms62320 KiB
29Runtime error0/227ms62308 KiB
30Runtime error0/227ms62216 KiB
31Runtime error0/230ms62068 KiB
32Runtime error0/226ms62060 KiB