#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll maxn= 1e5 + 10;
ll mx[maxn];
int main() {
ll m, n;
cin >> n >> m;
for (int i = 0; i < m; i ++) {
ll a,b,c;
cin >> a >> b >> c; // min(x[a], x[b]) = c;
mx[a] = max(mx[a], c);
mx[b] = max(mx[b], c);
}
for (int i = 1; i <= n; i++) {
if (mx[i] > 0) {
cout << mx[i] << " ";
}
else {
cout << 1 << " ";
}
}
}
# | 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... |