11 条题解

  • 0
    @ 2025-1-23 11:37:56
    #include<iomanip>
    #include<cmath>
    #include<cstring>
    using namespace std;
    const int N=1e5+10;
    const int INF=0x3f3f3f3f;
    int l,m,x,y,ans;
    bool a[N];
    int main()
    {
    	cin>>l>>m;
    	while(m--)
    	{
    		cin>>x>>y;
    		for(int i=x;i<=y;i++)
    		a[i]=1;
    	}
    	for(int i=0;i<=l;i++)
    	{
    		if(!a[i])
    		ans++;
    	}
    	cout<<ans;
        return 0;
    }
    

    信息

    ID
    677
    时间
    1000ms
    内存
    256MiB
    难度
    6
    标签
    递交数
    926
    已通过
    262
    上传者