11302022-03-12 15:37:34nmarciHálózati átvitelcpp11Wrong answer 6/5041ms6316 KiB
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <list>

using namespace std;
using ll = long long int;

int maxa[10010];
struct Edge
{
    int a, b, w;
};

int main()
{
    int n, m, k, h;
    cin >> n >> m >> k >> h;
    fill(maxa, maxa + n + 1, 0);
    maxa[k] = numeric_limits<int>::max();
    vector<Edge> v(m);
    for(auto& i : v){
        cin >> i.a >> i.b >> i.w;
    }
    for(int i = 0; i < h; ++i){
        for(auto e : v){
            maxa[e.a] = max(maxa[e.a], min(maxa[e.b], e.w));
            maxa[e.b] = max(maxa[e.b], min(maxa[e.a], e.w));
        }
    }
    for(int i = 1; i <= n; ++i){
        if(i == k) cout << 0 << endl;
        else if(maxa[i] == 0) cout << -1 << endl;
        else cout << maxa[i] << endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base6/50
1Accepted0/02ms1740 KiB
2Wrong answer0/01ms1784 KiB
3Wrong answer0/11ms1844 KiB
4Wrong answer0/11ms1848 KiB
5Wrong answer0/21ms1856 KiB
6Wrong answer0/21ms1864 KiB
7Wrong answer0/22ms1880 KiB
8Wrong answer0/22ms1900 KiB
9Wrong answer0/13ms1916 KiB
10Wrong answer0/13ms1936 KiB
11Accepted1/14ms1980 KiB
12Wrong answer0/17ms2176 KiB
13Wrong answer0/24ms2100 KiB
14Wrong answer0/27ms2296 KiB
15Wrong answer0/210ms2552 KiB
16Wrong answer0/29ms2548 KiB
17Wrong answer0/210ms2812 KiB
18Wrong answer0/210ms2948 KiB
19Wrong answer0/212ms3076 KiB
20Wrong answer0/210ms3204 KiB
21Accepted1/121ms3360 KiB
22Wrong answer0/128ms3556 KiB
23Accepted1/128ms3836 KiB
24Accepted1/132ms4104 KiB
25Wrong answer0/235ms4360 KiB
26Wrong answer0/232ms4648 KiB
27Accepted2/237ms5024 KiB
28Wrong answer0/237ms5232 KiB
29Wrong answer0/241ms5508 KiB
30Wrong answer0/239ms5784 KiB
31Wrong answer0/237ms6052 KiB
32Wrong answer0/239ms6316 KiB