记录编号 | 343285 | 评测结果 | AAAAAAAAAA | ||
---|---|---|---|---|---|
题目名称 | 2527.Color the Axis | 最终得分 | 100 | ||
用户昵称 | 是否通过 | 通过 | |||
代码语言 | C++ | 运行时间 | 1.260 s | ||
提交时间 | 2016-11-09 07:29:55 | 内存使用 | 0.86 MiB | ||
#include<cstdio> #include<iostream> using namespace std; int n,m,l,r; int a[200005],cnt; int main() { freopen("axis.in","r",stdin); freopen("axis.out","w",stdout); scanf("%d%d",&n,&m); cnt=n; for(int i=1;i<=m;i++) { scanf("%d%d",&l,&r); if(cnt!=0) for(int j=l;j<=r;j++) { if(a[j]==0) a[j]=r+1,cnt--; else { int x=a[j];j=x-1; } } printf("%d\n",cnt); } return 0; }