为啥不能O2优化?
查看原帖
为啥不能O2优化?
1266130
zsx_herobrine楼主2024/7/14 18:40
#include<bits/stdc++.h>
                       #pragma GCC optimize(2)
using namespace std;
int n,m,s=0;
bool l[10005];
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	cin>>n>>m;
	int a[m],b[m];
	for(int i=1;i<=m;++i)
	{
		cin>>a[i]>>b[i];
		for(int j=0;j<=b[i]-a[i];++j)
		{
			l[j+a[i]]=1;
		}
	}
	for(int i=0;i<=n;++i)
	{
		if(l[i]==0)s++;
	}cout<<s;
	return 0;
}




多写了个O2优化就不行了?删了后AC,有点迷惑
2024/7/14 18:40
加载中...