Submission #62063357


Source Code Expand

Copy
#include<iostream>
using namespace std;
char a[1010][1010];
int main(){
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>a[i][j];
}
}
int x1=0,y1=0,x2=n-1,y2=m-1;
while(1){
int tg=0;
for(int i=0;i<m;i++){
if(a[x1][i]=='#')tg=1;
}
if(tg)break;
x1++;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include<iostream>
using namespace std;

char a[1010][1010];

int main(){
	int n,m;
	cin>>n>>m;
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>a[i][j];
		}
	}
	int x1=0,y1=0,x2=n-1,y2=m-1;
	while(1){
		int tg=0;
		for(int i=0;i<m;i++){
			if(a[x1][i]=='#')tg=1;
		}
		if(tg)break;
		x1++;
	}
	while(1){
		int tg=0;
		for(int i=0;i<m;i++){
			if(a[x2][i]=='#')tg=1;
		}
		if(tg)break;
		x2--;
	}
	while(1){
		int tg=0;
		for(int i=0;i<n;i++){
			if(a[i][y1]=='#')tg=1;
		}
		if(tg)break;
		y1++;
	}
	while(1){
		int tg=0;
		for(int i=0;i<n;i++){
			if(a[i][y2]=='#')tg=1;
		}
		if(tg)break;
		y2--;
	}
	for(int i=x1;i<=x2;i++){
		for(int j=y1;j<=y2;j++){
			if(a[i][j]=='.'){
				cout<<"No";
				exit(0);
			}
		}
	}
	cout<<"Yes";
}

Submission Info

Submission Time
Task C - Paint to make a rectangle
User n_ni
Language C++ 20 (gcc 12.2)
Score 300
Code Size 794 Byte
Status AC
Exec Time 39 ms
Memory 4588 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 41
Set Name Test Cases
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3540 KB
example_01.txt AC 1 ms 3464 KB
example_02.txt AC 1 ms 3500 KB
hand_00.txt AC 33 ms 4412 KB
hand_01.txt AC 34 ms 4476 KB
hand_02.txt AC 34 ms 4480 KB
hand_03.txt AC 33 ms 4520 KB
hand_04.txt AC 34 ms 4512 KB
hand_05.txt AC 1 ms 3608 KB
hand_06.txt AC 1 ms 3504 KB
hand_07.txt AC 1 ms 3492 KB
hand_08.txt AC 1 ms 4472 KB
hand_09.txt AC 33 ms 4588 KB
hand_10.txt AC 33 ms 4476 KB
hand_11.txt AC 33 ms 4464 KB
hand_12.txt AC 34 ms 4588 KB
random_00.txt AC 33 ms 4516 KB
random_01.txt AC 31 ms 4388 KB
random_02.txt AC 30 ms 4380 KB
random_03.txt AC 31 ms 4472 KB
random_04.txt AC 39 ms 4492 KB
random_05.txt AC 30 ms 4440 KB
random_06.txt AC 34 ms 4512 KB
random_07.txt AC 31 ms 4544 KB
random_08.txt AC 33 ms 4460 KB
random_09.txt AC 30 ms 4428 KB
random_10.txt AC 28 ms 4400 KB
random_11.txt AC 34 ms 4464 KB
random_12.txt AC 31 ms 4328 KB
random_13.txt AC 33 ms 4484 KB
random_14.txt AC 32 ms 4452 KB
random_15.txt AC 32 ms 4424 KB
random_16.txt AC 29 ms 4584 KB
random_17.txt AC 32 ms 4460 KB
random_18.txt AC 28 ms 4404 KB
random_19.txt AC 33 ms 4452 KB
random_20.txt AC 30 ms 4492 KB
random_21.txt AC 30 ms 4484 KB
random_22.txt AC 30 ms 4432 KB
random_23.txt AC 35 ms 4464 KB
random_24.txt AC 32 ms 4504 KB


2025-03-29 (Sat)
02:40:20 +00:00