为什么这道题不开O2优化没事,开了RE啊(
  • 板块灌水区
  • 楼主ListentoRain
  • 当前回复4
  • 已保存回复4
  • 发布时间2022/8/6 06:36
  • 上次更新2023/10/27 16:48:41
查看原帖
为什么这道题不开O2优化没事,开了RE啊(
559037
ListentoRain楼主2022/8/6 06:36

蒟蒻求助 P5461 这道题过了,但是如果开氧气优化就过不了,会导致后九个点RE 代码在此

#include<iostream>
#include<math.h>
using namespace std;
int n,m[10000][10000],key;
int fillwe(int x1,int y1,int t){
	if(t==1){
		m[x1][y1+1]=1;
		m[x1+1][y1+1]=1;
		m[x1+1][y1]=1;
		return 0;
	}
	t--;
	fillwe(x1+pow(2,t),y1,t);
	fillwe(x1,y1+pow(2,t),t);
	fillwe(x1+pow(2,t),y1+pow(2,t),t);
}
int main(){
	cin>>n;
	int i,j;
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	fillwe(0,0,n);
	key=pow(2,n);
	for(i=0;i<key;i++){
		for(j=0;j<key;j++){
			cout<<m[i][j]<<' ';
		}
		cout<<endl;
	}
}
2022/8/6 06:36
加载中...