#include <iostream>
#include <vector>
using namespace std;
using vi = vector<int>;
int main()
{
int N, M;
cin >> N >> M;
vi res(1+N, 1);
for(int j = 1; j <= M; j++)
{
int A, B, C;
cin >> A >> B >> C;
for(int z : {A, B})
res[z] = max(res[z], C);
}
for(int i = 1; i <= N; i++) cout << res[i] << ' ';
cout << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
288 KB |
Output is correct |
6 |
Correct |
2 ms |
416 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
2 ms |
288 KB |
Output is correct |
10 |
Correct |
7 ms |
696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
288 KB |
Output is correct |
6 |
Correct |
2 ms |
416 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
2 ms |
288 KB |
Output is correct |
10 |
Correct |
7 ms |
696 KB |
Output is correct |
11 |
Correct |
1 ms |
220 KB |
Output is correct |
12 |
Correct |
2 ms |
304 KB |
Output is correct |
13 |
Correct |
1 ms |
288 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
308 KB |
Output is correct |
2 |
Correct |
23 ms |
560 KB |
Output is correct |
3 |
Correct |
26 ms |
436 KB |
Output is correct |
4 |
Correct |
15 ms |
428 KB |
Output is correct |
5 |
Correct |
3 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
288 KB |
Output is correct |
6 |
Correct |
2 ms |
416 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
12 ms |
764 KB |
Output is correct |
9 |
Correct |
2 ms |
288 KB |
Output is correct |
10 |
Correct |
7 ms |
696 KB |
Output is correct |
11 |
Correct |
1 ms |
220 KB |
Output is correct |
12 |
Correct |
2 ms |
304 KB |
Output is correct |
13 |
Correct |
1 ms |
288 KB |
Output is correct |
14 |
Correct |
1 ms |
204 KB |
Output is correct |
15 |
Correct |
1 ms |
204 KB |
Output is correct |
16 |
Correct |
11 ms |
308 KB |
Output is correct |
17 |
Correct |
23 ms |
560 KB |
Output is correct |
18 |
Correct |
26 ms |
436 KB |
Output is correct |
19 |
Correct |
15 ms |
428 KB |
Output is correct |
20 |
Correct |
3 ms |
204 KB |
Output is correct |
21 |
Correct |
39 ms |
1392 KB |
Output is correct |
22 |
Correct |
48 ms |
1476 KB |
Output is correct |
23 |
Correct |
64 ms |
1560 KB |
Output is correct |
24 |
Correct |
60 ms |
1860 KB |
Output is correct |
25 |
Correct |
83 ms |
2548 KB |
Output is correct |