Submission #62053745


Source Code Expand

Copy
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <functional>
#include <stack>
#include <map>
#include <random>
#include <ctime>
#include <set>
#include <map>
typedef long long LL;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <vector>
#include <queue>
#include <cstdlib>
#include <cstring>
#include <cstdint>
#include <functional>
#include <stack>
#include <map>
#include <random>
#include <ctime>
#include <set>
#include <map>

typedef long long LL;
typedef std::pair<int,int> PII;
typedef std::pair<LL,LL> PLL;
const int N = 200010;
const int M = 5000010;
const int mod = 1'000'000'007;

#define INF 0x3f3f3f3f
#define rep(i,l,r) for(auto i(l);i<=(r);++i)
#define per(i,r,l) for(auto i(r);i>=(l);--i)
#define rpp(i,l,r) for(auto i(l);i<(r);++i)
#define ppr(i,r,l) for(auto i(r);i>(l);--i)
#define lowbit(x) ((x)&-(x))
#define ls(p) ((p)<<1)
#define rs(p) ((p)<<1|1)

// char *p1,*p2,buf[100000];
// #define getchar() (p1==p2 && (p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++)
template<typename T>inline T max(T a,T b){return a>b?a:b;}
template<typename T>inline T min(T a,T b){return a<b?a:b;}
template<typename T>inline void read(T &x){
	x=0;
	char ch=getchar(),f=0;
	while(ch<'0' || ch>'9'){f=(ch=='-');ch=getchar();}
	while(ch<='9' && ch>='0'){x=x*10+(ch^48);ch=getchar();}
	f?x=-x:0;
}

template<std::size_t N>inline void read(char (&s)[N]){
	char *p=s,ch=getchar();
	while(isspace(ch)){ch=getchar();}
	while(!isspace(ch) && std::size_t(p-s+1)<N){*p=ch;++p;ch=getchar();}
	*p=0;
}
inline void read(char *s){
	char ch=getchar();
	while(isspace(ch)){ch=getchar();}
	while(!isspace(ch)){*s=ch;++s;ch=getchar();}
	*s=0;
}
inline void read(char &ch){ch=getchar();while(isspace(ch)){ch=getchar();}}
template<typename T,typename... Args>void read(T &x,Args&... args){read(x);read(args...);}
template<typename T>inline void write(T x){
	char s[40],*t=s;
	for(;1;++t,x/=10){
		if(x<0){putchar('-');x=-x;}
		if(x<10){*t=x^48;break;}
		*t=(x%10)^48;
	}
	while(t>=s){putchar(*t);--t;}
}
inline void write(char *s){while(*s){putchar(*s);++s;}}
inline void write(const char *s){while(*s){putchar(*s);++s;}}
inline void write(char ch){putchar(ch);}
template<typename T,typename... Args>void write(T x,Args ...args){write(x);write(args...);}
template<typename... Args>void writen(Args ...args){write(args...,'\n');}
template<typename... Args>void writes(Args ...args){write(args...,' ');}

int h,w;
char s[1010][1010];
int p1,p2,p3,p4;

int main(){
	read(h,w);
	p1=p2=-INF,p3=p4=INF;
	rep(i,1,h){
		read(s[i]+1);
		rep(j,1,w){
			if(s[i][j]=='#'){
				p1=max(p1,i);
				p2=max(p2,j);
				p3=min(p3,i);
				p4=min(p4,j);
			}
		}
	}
	// writen(p3,' ',p1,' ',p4,' ',p2);
	rep(i,p3,p1){
		rep(j,p4,p2){
			if(s[i][j]=='.'){puts("No");return 0;}
		}
	}
	puts("Yes");

	return 0;
}
/*
-std=c++14
-Wall -O2 -static
-Wall -O2 -fsanitize=address,undefined
LHY qingchunkeai,shanliangdafang,wengrouxianhui,meilidongren,chenyuluoyan,biyuexiuhua
*/

Submission Info

Submission Time
Task C - Paint to make a rectangle
User Xr0805
Language C++ 20 (gcc 12.2)
Score 300
Code Size 2924 Byte
Status AC
Exec Time 10 ms
Memory 4660 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 3676 KB
example_01.txt AC 1 ms 3488 KB
example_02.txt AC 1 ms 3472 KB
hand_00.txt AC 8 ms 4592 KB
hand_01.txt AC 7 ms 4400 KB
hand_02.txt AC 7 ms 4532 KB
hand_03.txt AC 7 ms 4488 KB
hand_04.txt AC 7 ms 4436 KB
hand_05.txt AC 1 ms 3476 KB
hand_06.txt AC 1 ms 3616 KB
hand_07.txt AC 1 ms 3476 KB
hand_08.txt AC 1 ms 4468 KB
hand_09.txt AC 7 ms 4476 KB
hand_10.txt AC 7 ms 4660 KB
hand_11.txt AC 7 ms 4476 KB
hand_12.txt AC 8 ms 4400 KB
random_00.txt AC 8 ms 4580 KB
random_01.txt AC 9 ms 4564 KB
random_02.txt AC 6 ms 4340 KB
random_03.txt AC 9 ms 4468 KB
random_04.txt AC 10 ms 4504 KB
random_05.txt AC 6 ms 4468 KB
random_06.txt AC 7 ms 4508 KB
random_07.txt AC 6 ms 4352 KB
random_08.txt AC 7 ms 4456 KB
random_09.txt AC 6 ms 4384 KB
random_10.txt AC 7 ms 4360 KB
random_11.txt AC 7 ms 4388 KB
random_12.txt AC 6 ms 4456 KB
random_13.txt AC 7 ms 4400 KB
random_14.txt AC 7 ms 4444 KB
random_15.txt AC 7 ms 4412 KB
random_16.txt AC 7 ms 4444 KB
random_17.txt AC 6 ms 4416 KB
random_18.txt AC 6 ms 4324 KB
random_19.txt AC 7 ms 4504 KB
random_20.txt AC 6 ms 4440 KB
random_21.txt AC 6 ms 4488 KB
random_22.txt AC 7 ms 4408 KB
random_23.txt AC 6 ms 4512 KB
random_24.txt AC 7 ms 4640 KB


2025-03-26 (Wed)
06:28:00 +00:00