44682023-03-28 12:14:32AGergoHálózati átvitelcpp11Time limit exceeded 0/50649ms62516 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)
{
    if( szint <= H)
    {for(int y : graf[item])
        {
            if(y != koz)
            {
                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/03ms2084 KiB
2Time limit exceeded0/0600ms1720 KiB
3Wrong answer0/13ms2628 KiB
4Wrong answer0/13ms2740 KiB
5Time limit exceeded0/2649ms3052 KiB
6Time limit exceeded0/2551ms3096 KiB
7Time limit exceeded0/2564ms2572 KiB
8Time limit exceeded0/2575ms3460 KiB
9Time limit exceeded0/1564ms6800 KiB
10Time limit exceeded0/1575ms6820 KiB
11Time limit exceeded0/1555ms7132 KiB
12Time limit exceeded0/1555ms7576 KiB
13Time limit exceeded0/2648ms7632 KiB
14Time limit exceeded0/2559ms7588 KiB
15Time limit exceeded0/2578ms7700 KiB
16Time limit exceeded0/2640ms7620 KiB
17Time limit exceeded0/2569ms7784 KiB
18Time limit exceeded0/2564ms7792 KiB
19Time limit exceeded0/2555ms7784 KiB
20Time limit exceeded0/2560ms7884 KiB
21Runtime error0/127ms62516 KiB
22Runtime error0/126ms62280 KiB
23Runtime error0/132ms62140 KiB
24Runtime error0/127ms62116 KiB
25Runtime error0/227ms62088 KiB
26Runtime error0/230ms61928 KiB
27Runtime error0/227ms61920 KiB
28Runtime error0/232ms61828 KiB
29Runtime error0/226ms61820 KiB
30Runtime error0/230ms61796 KiB
31Runtime error0/230ms61792 KiB
32Runtime error0/230ms61776 KiB