关于P1047
  • 板块灌水区
  • 楼主xuorange
  • 当前回复3
  • 已保存回复3
  • 发布时间2022/1/29 21:24
  • 上次更新2023/10/28 10:06:34
查看原帖
关于P1047
564964
xuorange楼主2022/1/29 21:24

原题

本来只是想刷个水题,结果#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;
}
2022/1/29 21:24
加载中...