| 记录编号 | 582058 | 评测结果 | AAAAAAAAAA | ||
|---|---|---|---|---|---|
| 题目名称 | 2527.Color the Axis | 最终得分 | 100 | ||
| 用户昵称 | 是否通过 | 通过 | |||
| 代码语言 | C++ | 运行时间 | 3.135 s | ||
| 提交时间 | 2023-09-01 21:01:29 | 内存使用 | 4.55 MiB | ||
#include<bits/stdc++.h>
using namespace std;
int m,n,l,s;
int a[200005],ant;
int main()
{
freopen("axis.in","r",stdin);
freopen("axis.out","w",stdout);
cin>>m>>n;
ant=m;
for(int i=1;i<=n;i++)
{
cin>>l>>s;
if(ant!=0)
for(int j=l;j<=s;j++)
{
if(a[j]==0)
{
a[j]=s+1;
ant--;
}
else
{
int x=a[j];
j=x-1;
}
}
cout<<ant<<endl;
}
return 0;
}