44032023-03-27 17:15:08horvathabelHálózati átvitelcpp17Wrong answer 3/5050ms5280 KiB
#include <bits/stdc++.h>
using namespace std;
vector<pair<pair<int, int>,int>> g;
bool seen[100001];

int main() {
	int n,m,k,h;
	cin>>n>>m>>k>>h;
	for (int i=0; i<m;i++){
		int x,y,c;
		cin>>x>>y>>c; 
		g.push_back({{x,y},c});
	}
	vector<int> dp;
	dp.resize(n+1,0);
	dp[k]=1e9;
	for (int j=1; j<=h;j++){
			for (pair<pair<int,int>, int> edge:g){
				dp[edge.first.first]=max(dp[edge.first.first],min(dp[edge.first.second],edge.second));
				dp[edge.first.second]=max(dp[edge.first.second],min(dp[edge.first.first],edge.second));
		}
	}
	for (int i=1; i<=n;i++){
		if (i==k) cout<<0<<endl; 
		else{
		 cout<<dp[i]<<endl;
		}
	} 
}
SubtaskSumTestVerdictTimeMemory
base3/50
1Accepted0/03ms1692 KiB
2Wrong answer0/03ms1860 KiB
3Wrong answer0/13ms2092 KiB
4Wrong answer0/13ms2156 KiB
5Wrong answer0/23ms2432 KiB
6Wrong answer0/23ms2508 KiB
7Wrong answer0/23ms2600 KiB
8Wrong answer0/23ms2812 KiB
9Wrong answer0/14ms2908 KiB
10Wrong answer0/16ms2972 KiB
11Accepted1/17ms3216 KiB
12Wrong answer0/18ms3340 KiB
13Wrong answer0/28ms3428 KiB
14Wrong answer0/28ms3680 KiB
15Wrong answer0/214ms4144 KiB
16Wrong answer0/213ms4072 KiB
17Wrong answer0/213ms4064 KiB
18Wrong answer0/214ms4320 KiB
19Wrong answer0/214ms4276 KiB
20Wrong answer0/214ms4280 KiB
21Wrong answer0/125ms4320 KiB
22Wrong answer0/139ms4616 KiB
23Wrong answer0/148ms4748 KiB
24Wrong answer0/143ms5140 KiB
25Wrong answer0/239ms5132 KiB
26Wrong answer0/250ms4952 KiB
27Accepted2/243ms5108 KiB
28Wrong answer0/241ms5204 KiB
29Wrong answer0/237ms5204 KiB
30Wrong answer0/246ms5280 KiB
31Wrong answer0/237ms5280 KiB
32Wrong answer0/239ms5168 KiB