WA
查看原帖
WA
1460207
F_F_M_YC楼主2024/11/24 11:08
#include<bits/stdc++.h>
using namespace std;
int n;
int main() {
	cin>>n;
	while(n--){
		int x,y,b[105][105]={0};
		char a[105][105];
		cin>>x>>y;
		for(int i=1;i<=x;i++){
			for(int j=1;j<=y;j++){
				cin>>a[i][j];
				b[i][j]=b[i][j-1]+(a[i][j]-'0');
			}
		}
		if(x<4||y<4){
			cout<<"No\n";
		}
		else{
			for(int i=1;i<=x-4;i++){
				for(int j=1;j<=y-4;j++){
					if(b[i][j+3]-b[i][j-1]!=0||
				        b[i+3][j+3]-b[i+3][j-1]!=0){
//						cout<<"No\n";
//						continue;
					}else
					if(a[i+1][j]=='0'&&a[i+1][j+1]=='1'&&
					    a[i+1][j+2]=='1'&&a[i+1][j+3]=='0'&&
					    a[i+2][j]=='0'&&a[i+2][j+1]=='1'&&
					    a[i+2][j+2]=='1'&&a[i+2][j+3]=='0'){
						cout<<"Yes\n";
						break;
					}
				}
			}
			cout<<"No\n";
		}
	}


	return 0;
}

求调

2024/11/24 11:08
加载中...