This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#define deb(x) cout << #x << ": " << x << endl
#define ll long long
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin>>n>>m;
vector<int> ans(n,1e9),inp2(m);
vector<pair<int,int>> inp(m);
for(int i=0;i<m;i++) cin>>inp[i].first>>inp[i].second>>inp2[i];
for(int i=0;i<m;i++){
if(ans[inp[i].first-1]<inp2[i]||ans[inp[i].first-1]==1e9) ans[inp[i].first-1]=inp2[i];
else if(ans[inp[i].second-1]<inp2[i]||ans[inp[i].second-1]==1e9) ans[inp[i].second-1]=inp2[i];
}
for(int i=0;i<n;i++) cout<<ans[i]<<" ";
return(0);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |