#include <bits/stdc++.h>
using namespace std;
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n,m;
cin >> n >> m;
int arr[n];
fill(arr,arr+n,-1);
for(int i = 0;i<m;i++){
int a,b,c;
cin >> a >> b >> c;
a--;b--;
arr[a]=max(arr[a],c);
arr[b]=max(arr[b],c);
}
for(int i = 0;i<n;i++){
if(arr[i]==-1){
cout << 1 << " ";
continue;
}
cout << arr[i] << " ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
352 KB |
Output is correct |
5 |
Correct |
1 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
352 KB |
Output is correct |
5 |
Correct |
1 ms |
352 KB |
Output is correct |
6 |
Correct |
2 ms |
352 KB |
Output is correct |
7 |
Correct |
2 ms |
352 KB |
Output is correct |
8 |
Correct |
5 ms |
864 KB |
Output is correct |
9 |
Correct |
2 ms |
508 KB |
Output is correct |
10 |
Correct |
5 ms |
864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
352 KB |
Output is correct |
5 |
Correct |
1 ms |
352 KB |
Output is correct |
6 |
Correct |
2 ms |
352 KB |
Output is correct |
7 |
Correct |
2 ms |
352 KB |
Output is correct |
8 |
Correct |
5 ms |
864 KB |
Output is correct |
9 |
Correct |
2 ms |
508 KB |
Output is correct |
10 |
Correct |
5 ms |
864 KB |
Output is correct |
11 |
Correct |
1 ms |
352 KB |
Output is correct |
12 |
Correct |
1 ms |
352 KB |
Output is correct |
13 |
Correct |
1 ms |
352 KB |
Output is correct |
14 |
Correct |
1 ms |
352 KB |
Output is correct |
15 |
Correct |
1 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
352 KB |
Output is correct |
2 |
Correct |
6 ms |
608 KB |
Output is correct |
3 |
Correct |
5 ms |
608 KB |
Output is correct |
4 |
Correct |
4 ms |
608 KB |
Output is correct |
5 |
Correct |
1 ms |
352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
352 KB |
Output is correct |
2 |
Correct |
1 ms |
504 KB |
Output is correct |
3 |
Correct |
1 ms |
352 KB |
Output is correct |
4 |
Correct |
1 ms |
352 KB |
Output is correct |
5 |
Correct |
1 ms |
352 KB |
Output is correct |
6 |
Correct |
2 ms |
352 KB |
Output is correct |
7 |
Correct |
2 ms |
352 KB |
Output is correct |
8 |
Correct |
5 ms |
864 KB |
Output is correct |
9 |
Correct |
2 ms |
508 KB |
Output is correct |
10 |
Correct |
5 ms |
864 KB |
Output is correct |
11 |
Correct |
1 ms |
352 KB |
Output is correct |
12 |
Correct |
1 ms |
352 KB |
Output is correct |
13 |
Correct |
1 ms |
352 KB |
Output is correct |
14 |
Correct |
1 ms |
352 KB |
Output is correct |
15 |
Correct |
1 ms |
352 KB |
Output is correct |
16 |
Correct |
3 ms |
352 KB |
Output is correct |
17 |
Correct |
6 ms |
608 KB |
Output is correct |
18 |
Correct |
5 ms |
608 KB |
Output is correct |
19 |
Correct |
4 ms |
608 KB |
Output is correct |
20 |
Correct |
1 ms |
352 KB |
Output is correct |
21 |
Correct |
9 ms |
1632 KB |
Output is correct |
22 |
Correct |
11 ms |
1632 KB |
Output is correct |
23 |
Correct |
12 ms |
1632 KB |
Output is correct |
24 |
Correct |
13 ms |
2144 KB |
Output is correct |
25 |
Correct |
25 ms |
2656 KB |
Output is correct |