有问题,求调
  • 板块P5461 赦免战俘
  • 楼主3_14
  • 当前回复1
  • 已保存回复1
  • 发布时间2024/7/19 10:32
  • 上次更新2024/7/19 11:12:28
查看原帖
有问题,求调
913288
3_14楼主2024/7/19 10:32

全TLE:

#include<bits/stdc++.h>
#define str to_string
using namespace std;
using ll=long long;
const int MAX=1e3+1;
bool mp[MAX][MAX];
void work(int x1,int y1,int x2,int y2){
	int bc=x2-x1+1;
	if(bc<=1)return;
	for(int i=x1;i<bc/2;i++)
		for(int j=y1;j<bc/2;j++)
			mp[i][j]=true;
	work(0,bc/2-1,bc/2-1,bc-1);
	work(bc/2,bc/2,bc-1,bc-1);
	work(bc/2-1,0,bc-1,bc/2-1);
}
int n;
int main(){
	cin>>n;
	int bc=int(pow(2,n));
	work(0,0,bc-1,bc-1);
	for(int i=0;i<bc;i++){
		for(int j=0;j<bc;j++)
			cout<<(mp[i][j]?0:1)<<' ';
		cout<<'\n';
	}
	return 0;
}
2024/7/19 10:32
加载中...