#include <iostream>
using namespace std;
#define pb push_back
#define fr first
#define endl '\n'
#define sc second
const int N = 3e5 + 1;
int a[N], n, m;
void fill(int l, int r, int x)
{
for(int i = l; i <= r; i++)
{
a[i] = max(a[i], x++);
}
}
main()
{
cin >> n >> m;
for(int i = 1; i <= m; i++)
{
int l, r, x;
cin >> l >> r >> x;
fill(l, r, x);
}
for(int i = 1; i <= n; i++)
cout << a[i] << " ";
}
/**
5 2
1 3 2
2 4 6
**/
Compilation message
trading.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main()
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
4 ms |
664 KB |
Output is correct |
6 |
Correct |
5 ms |
664 KB |
Output is correct |
7 |
Correct |
1430 ms |
4764 KB |
Output is correct |
8 |
Execution timed out |
2060 ms |
7300 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |