九敏(救命)揪揪我(救救我)
查看原帖
九敏(救命)揪揪我(救救我)
980202
Ultimate_Cactus楼主2024/8/23 16:59
#include <bits/stdc++.h>
using namespace std;
const int dj=100005;
int t[dj];
int n,l;
struct name
{
	bool f;
	int a,b;
}x[dj];
int main()
{
	cin>>l>>n;
	t[0]=1;
	for(int i=1;i<=n;i++)
	{
		cin>>x[i].f>>x[i].a>>x[i].b;
		t[i]=1;
	}
	int cnt=0,cnt2=0;
	for(int i=1;i<=n;i++)
	{
		if(x[i].f)
		{
			for(int j=x[i].a;j<=x[i].b;j++)
			{
				if(t[j]!=1)
				{
					t[j]=2;
				}
			}
		}
		else
		{
			for(int j=x[i].a;j<=x[i].b;j++)
			{
				t[j]-1;
				if(t[j]==2)
				{
					cnt2++;
				}
			}
		}
	}
	for(int i=0;i<=l;i++)
	{
		if(i==2)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl<<cnt2<<endl;
	return 0;
}

为啥wa呀

2024/8/23 16:59
加载中...