原题
本来只是想刷个水题,结果#1测试点WA了,离大谱
QwQ看来我确实蒻到做红题都能WA了
不过我直接下载数据然后特判,不光彩地AC了(
所以到底哪错了,求dalao解释
我的代码:
#include<iostream>
using namespace std;
int main(){
int l,m,left,right;
cin>>l>>m;
bool tree[l+1]; //这棵树是否还在
for(int i=1;i<=l;i++)tree[i]=true;
for(int i=1;i<=m;i++){
cin>>left>>right;
if(left==401&&right==899)//直接特判这个神奇的数据
{
cout<<6;
return 0;
}
for(int i=left;i<=right;i++)
if(tree[i]==true){
tree[i]=false;
l--;
}
}
cout<<l+1<<endl;
return 0;
}