Submission #69099749


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int n,m,w[4][2]={{0,1},{1,0},{0,-1},{-1,0}}; 
char a[105][105];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j)cin>>a[i][j];
	}
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			if(a[i][j]!='#')continue;
			int c=0;
			for(int k=0;k<4;++k){
				int x=i+w[k][0],y=j+w[k][1];
				if(x>=1&&x<=n&&y>=1&&y<=m&&a[x][y]=='#')++c;
			}
			if(c!=2&&c!=4)return cout<<"No",0;
		}
	}
	cout<<"Yes";
	return 0;
}

Submission Info

Submission Time
Task B - Looped Rope
User Cute_yhb
Language C++ 20 (gcc 12.2)
Score 200
Code Size 492 Byte
Status AC
Exec Time 1 ms
Memory 3656 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 25
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 02_handmade_14.txt, 02_handmade_15.txt, 02_handmade_16.txt, 02_handmade_17.txt, 02_handmade_18.txt, 02_handmade_19.txt, 02_handmade_20.txt, 02_handmade_21.txt, 02_handmade_22.txt, 02_handmade_23.txt, 02_handmade_24.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3500 KiB
00_sample_01.txt AC 1 ms 3500 KiB
00_sample_02.txt AC 1 ms 3512 KiB
00_sample_03.txt AC 1 ms 3652 KiB
01_random_04.txt AC 1 ms 3380 KiB
01_random_05.txt AC 1 ms 3496 KiB
01_random_06.txt AC 1 ms 3460 KiB
01_random_07.txt AC 1 ms 3576 KiB
01_random_08.txt AC 1 ms 3456 KiB
01_random_09.txt AC 1 ms 3464 KiB
01_random_10.txt AC 1 ms 3656 KiB
01_random_11.txt AC 1 ms 3492 KiB
01_random_12.txt AC 1 ms 3496 KiB
01_random_13.txt AC 1 ms 3656 KiB
02_handmade_14.txt AC 1 ms 3440 KiB
02_handmade_15.txt AC 1 ms 3476 KiB
02_handmade_16.txt AC 1 ms 3496 KiB
02_handmade_17.txt AC 1 ms 3444 KiB
02_handmade_18.txt AC 1 ms 3460 KiB
02_handmade_19.txt AC 1 ms 3468 KiB
02_handmade_20.txt AC 1 ms 3452 KiB
02_handmade_21.txt AC 1 ms 3492 KiB
02_handmade_22.txt AC 1 ms 3460 KiB
02_handmade_23.txt AC 1 ms 3512 KiB
02_handmade_24.txt AC 1 ms 3452 KiB