#include<stdio.h>
#include<algorithm>
#include<set>
using namespace std;
set<int>q;
int n,m;
struct data{
int l,r,x;
bool operator<(const data&r)const{
return l<r.l;
}
}a[300010];
struct data2{
int l,r,x;
bool operator<(const data2&p)const{
return r<p.r;
}
}b[300010];
int main()
{
int i,j,p1=1,p2=1;
set<int>::iterator p;
scanf("%d %d",&n,&m);
for(i=1;i<=m;i++)
{
scanf("%d %d %d",&a[i].l,&a[i].r,&a[i].x);
b[i].l=a[i].l; b[i].r=a[i].r; b[i].x=a[i].x;
}
sort(a+1,a+m+1);
sort(b+1,b+m+1);
for(i=1;i<=n;i++)
{
for(j=p1;j<=m;j++)
{
if(a[j].l>i) break;
q.insert(a[j].x-a[j].l);
}
p1=j;
for(j=p2;j<=m;j++)
{
if(a[j].r>=i) break;
q.erase(a[j].x-a[j].l);
}
p2=j;
if(q.empty()){printf("0 "); continue;}
p=q.end(); p--;
printf("%d ",(*p)+i);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
8248 KB |
Output isn't correct |
7 |
Incorrect |
142 ms |
11548 KB |
Output isn't correct |
8 |
Incorrect |
162 ms |
11548 KB |
Output isn't correct |
9 |
Incorrect |
185 ms |
13396 KB |
Output isn't correct |
10 |
Incorrect |
222 ms |
15904 KB |
Output isn't correct |
11 |
Incorrect |
206 ms |
11284 KB |
Output isn't correct |
12 |
Incorrect |
286 ms |
16300 KB |
Output isn't correct |
13 |
Incorrect |
252 ms |
12604 KB |
Output isn't correct |
14 |
Incorrect |
250 ms |
13792 KB |
Output isn't correct |
15 |
Incorrect |
242 ms |
16036 KB |
Output isn't correct |
16 |
Incorrect |
323 ms |
13660 KB |
Output isn't correct |
17 |
Incorrect |
264 ms |
13792 KB |
Output isn't correct |
18 |
Incorrect |
255 ms |
14584 KB |
Output isn't correct |
19 |
Incorrect |
294 ms |
16432 KB |
Output isn't correct |
20 |
Incorrect |
332 ms |
16168 KB |
Output isn't correct |