#include <bits/stdc++.h>
#define pb push_back
#define ll long long int
#define all(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
using namespace std;
int main() {
int n, m; cin >> n >> m;
map<int,vector<ll>> v;
while (m--) {
int a, b; ll c;
cin >> a >> b >> c;
a--; b--;
v[a].pb(c); v[b].pb(c);
}
for (int i = 0; i < n; i++) {
v[i].pb(1);
sort(all(v[i]));
cout << v[i][0] << " ";
}
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... |