92362024-02-19 10:42:44TuruTamasHálózati átvitelcpp17Wrong answer 0/5014ms7080 KiB
#include <bits/stdc++.h>
using namespace std;

#ifdef DEBUG
ifstream in_file("minta/be2.txt");
#define input in_file
#define INTHENAMEOFGOD
#else
#define input cin
#define INTHENAMEOFGOD \
    ios::sync_with_stdio(0); \
    cin.tie(0); \
    cout.tie(0);
#endif
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef pair<ll, ll> pii;

ll N, M, H, K, a, b, c;
vector<vector<pii>> G;
vi s;

struct P {
    ll ind, seb, tav;
};

void bfs() {
    queue<P> q;
    q.push((P) {
        .ind = K,
        .seb = LLONG_MAX,
        .tav = 0,
    });
    while (!q.empty()) {
        P c = move(q.front());
        q.pop();
        if (c.tav == H) {
            continue;
        }
        // cout << "asd" << "\n";
        for (pii &next : G[c.ind]) {
            s[next.first] = max(s[next.first], min(c.seb, next.second));
            q.push((P) {
                .ind = next.first,
                .seb = min(c.seb, next.second),
                .tav = c.tav+1
            });
        }
    }
}

int main() {
    INTHENAMEOFGOD
    input >> N >> M >> K >> H;
    K--;
    G.resize(N);
    s.assign(N, -1);
    
    for (ll m = 0; m < M; m++) {
        input >> a >> b >> c;
        a--; b--;
        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
    }

    // bfs();
    s[K] = 0;

    for (ll val : s) {
        cout << val << "\n";
    }
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Wrong answer0/03ms1832 KiB
2Wrong answer0/03ms2216 KiB
3Wrong answer0/13ms2276 KiB
4Wrong answer0/13ms2320 KiB
5Wrong answer0/23ms2612 KiB
6Wrong answer0/23ms2444 KiB
7Wrong answer0/23ms2740 KiB
8Wrong answer0/23ms2948 KiB
9Wrong answer0/13ms3172 KiB
10Wrong answer0/13ms3288 KiB
11Wrong answer0/14ms3644 KiB
12Wrong answer0/14ms4124 KiB
13Wrong answer0/24ms4068 KiB
14Wrong answer0/24ms4044 KiB
15Wrong answer0/27ms4812 KiB
16Wrong answer0/27ms5116 KiB
17Wrong answer0/27ms5064 KiB
18Wrong answer0/27ms4980 KiB
19Wrong answer0/27ms5036 KiB
20Wrong answer0/27ms5028 KiB
21Wrong answer0/18ms5280 KiB
22Wrong answer0/18ms5796 KiB
23Wrong answer0/110ms6272 KiB
24Wrong answer0/112ms6484 KiB
25Wrong answer0/213ms6484 KiB
26Wrong answer0/213ms6484 KiB
27Wrong answer0/214ms7080 KiB
28Wrong answer0/212ms6632 KiB
29Wrong answer0/212ms6712 KiB
30Wrong answer0/212ms6936 KiB
31Wrong answer0/210ms6796 KiB
32Wrong answer0/212ms6904 KiB