QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217132#6746. Merge the Rectangles1564269628AC ✓50ms39328kbC++178.8kb2023-10-16 15:28:142023-10-16 15:28:14

Judging History

你现在查看的是最新测评结果

  • [2023-10-16 15:28:14]
  • 评测
  • 测评结果:AC
  • 用时:50ms
  • 内存:39328kb
  • [2023-10-16 15:28:14]
  • 提交

answer

/*

hello world!

Just do it!

start time:2023-10-16 14:46:56.488761

*/

// #pragma GCC optimize (2) // O2
// #pragma GCC optimize(3,"Ofast","inline") // O3
#include <bits/stdc++.h>
using namespace std;
#define zero(x) memset(x, 0, sizeof(x));
#define one(x) memset(x, -1, sizeof(x));
#define m_inf(x) memset(x, 0x3f, sizeof(x));
#define m_f_inf(x) memset(x, -0x3f, sizeof(x));
#define all(x) x.begin(), x.end()
#define all1(x) (x.begin() + 1), x.end()
#define endl "\n" 
#define fi first
#define se second
#define lbt(x) ((x)&(-x))
#define eb emplace_back
#define pb push_back
#define ed end()
#define bg begin()
#define mine min_element
#define maxe max_element
#define ct continue;
#define lb lower_bound
#define ub upper_bound
#define foo(i,ooo) for(auto i=ooo.rbegin();i!=ooo.rend();++i)
#define foa(i,from,to) for(int i=(from),ooo=(to);i<=ooo;++i)
#define fos(i,from,to) for(int i=(from),ooo=(to);i>=ooo;--i)
#define in (getint())
#define ins (getstring())
#define lll __int128
#define fn(retur, name, ...) function<retur(__VA_ARGS__)> name = [&](__VA_ARGS__)->retur 
#define fna(nam, ...) auto nam = [&](__VA_ARGS__)
#define CODE_INIT const int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};long long inf=(((int)1e18>1e17)?0x3f3f3f3f3f3f3f3f:0x3f3f3f3f);inline long long getint(){long long x;cin>>x;return x;}inline string getstring(){string x;cin>>x;return x;}template<typename T>using pqg=priority_queue<T>;template<typename T>using pql=priority_queue<T,vector<T>,greater<T>>;template<class t,class u>bool ckmax(t&a,u b){return(a<b)?a=b,true:false;}template<class t,class u>bool ckmin(t&a,u b){return(a>b)?a=b,true:false;}inline long long gcd(long long x,long long y){return __gcd(x,y);}long long lcm(long long x,long long y){return x/__gcd(x,y)*y;} const double pi = acos(-1);\
	typedef long long ll;typedef unsigned long long ull;typedef pair<int,int>pii;typedef string str;typedef long double ld;typedef vector<int>vi;typedef vector<pair<int,int>>vii; template<typename T>void sortu(T&x,int y=0){sort(x.begin()+y,x.end());x.erase(unique(x.begin()+y,x.end()),x.end());} template<typename T>inline int sz(const T&x){return x.size();} \
	struct mint{int v;mint(int a=0){a%=mod;if(a<0)a+=mod;v=a;}operator int()const{return this->v;}friend mint operator+(mint a,mint b){return a.v+b.v;}template<typename T>friend mint operator+(mint a,T b){return(mint)a+(mint)b;}template<typename T>friend mint operator+(T a,mint b){return(mint)a+(mint)b;}friend mint operator-(mint a,mint b){return a.v-b.v;} \
	template<typename T>friend mint operator-(mint a,T b){return(mint)a-(mint)b;}template<typename T>friend mint operator-(T a,mint b){return(mint)a-(mint)b;}friend mint operator*(mint a,mint b){return(long long)a.v*b.v;}template<typename T>friend mint operator*(mint a,T b){return(mint)a*(mint)b;}template<typename T>friend mint operator*(T a,mint b){return(mint)a*(mint)b;} \
	friend mint operator^(mint a,int y){mint res(1),x=a;for(;y;x=x*x,y>>=1)if(y&1)res=res*x;return res;}template<typename T>friend mint operator^(mint a,T b){return(mint)a^(int)b;}template<typename T>friend mint operator^(T a,mint b){return(mint)a^(int)b;}mint inv(){return(*this)^(mod-2);}friend mint operator/(mint a,mint b){return a*b.inv();} \
	template<typename T>friend mint operator/(mint a,T b){return(mint)a/(mint)b;}template<typename T>friend mint operator/(T a,mint b){return(mint)a/(mint)b;}template<typename T>friend mint&operator+=(mint&a,T b){return a=a+b;}template<typename T>friend mint&operator-=(mint&a,T b){return a=a-b;}template<typename T>friend mint&operator*=(mint&a,T b){return a=a*b;} \
	template<typename T>friend mint&operator/=(mint&a,T b){return a=a/b;}mint&operator++(){return*this=*this+1;}mint operator++(sint){mint res=*this;*this=*this+1;return res;}mint&operator--(){return*this=*this-1;}mint operator--(sint){mint res=*this;*this=*this-1;return res;}friend istream&operator>>(istream&ist,mint&a){ist>>a.v;a.v=(mint)a.v;return ist;} \
	friend ostream&operator<<(ostream&ost,const mint&a){ost<<a.v;return ost;}friend bool operator==(const mint&a,const mint&b){return a.v==b.v;}}; \
	struct pccalc{vector<mint>inv,fac,invf;pccalc(int a=N){if(a<1)a=1;inv.resize(a+1);fac.resize(a+1);invf.resize(a+1);inv[1]=fac[0]=fac[1]=invf[0]=invf[1]=1;foa(i,2,a){inv[i]=(-mod/i)*inv[mod%i];fac[i]=fac[i-1]*i;invf[i]=invf[i-1]*inv[i];}}template<typename T,typename K>mint p(T a,K b){int x=a,y=b;if(x<y)return 0;return fac[x]*invf[x-y];} \
	template<typename T,typename K>mint fp(T a,K b){int x=a,y=b;if(x<y)return 0;mint res=1;fos(i,x,x-y+1)res*=i;return res;}template<typename T,typename K>mint a(T a,K b){return p(a,b);}template<typename T,typename K>mint fa(T a,K b){return fp(a,b);}template<typename T,typename K>mint c(T a,K b){int x=a,y=b;if(x<y)return 0;return fac[x]*invf[y]*invf[x-y];}template<typename T,typename K>mint fc(T a,K b){int x=a,y=b;if(x<y)return 0;return fp(x,y)/fp(y,y);}template<typename T,typename K>mint lucas(T a,K b){int x=a,y=b;if(x<y)return 0;if(x<mod&&y<mod)return c(x,y);return c(x%mod,y%mod)*lucas(x/mod,y/mod);}};

#ifndef LOCAL
#    define dbg(...) ;
#endif
typedef int sint;
#define int long long
int n, m; int test_cases = 1; void init(); void solve();

signed main()
{
	srand(time(0));
	
	std::ios::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
	
	cout << fixed << setprecision(15);

	// init();

    int num = 0;
    if (test_cases == 1) { // one test
		solve();
	}
    else if (test_cases == 0) { // multi tests
        int t = 0; cin >> t;
        while (t--) {
            // cout << "Case " << ++num << ": ";
            solve();
        }
    }
    else { // not sure
        while (cin >> n && n) {
            // cout << "Case " << ++num << ": ";
            solve();
        }
    }
    return 0;
}

int mod = (998244353 , 1e9 + 7 ); const double eps = 1e-8; 





















                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                int _test = (
test_cases = (-1 ,0 ,1 ) /* -1: not sure, 0: multi tests, 1: one test */                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        , 0); const long long 
N = 1500 + 10, M = 1e3 + 10                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ; CODE_INIT;

int ar[N][N], ac[N][N]
;
char c[N];
int dp(int r0, int c0, int r1, int c1)
{
	// dbg(r0, c0, r1, c1)
	if(r0 + 1 == r1 && c0 + 1 == c1) return 1;
	int has = 0;
	foa(r, r0 + 1, r1 - 1) {
		int t = ar[r][c1 - 1] - ar[r][c0 - 1];
		if(t) has = 1;
		if(t == c1 - c0) {
			return dp(r0, c0, r, c1) && dp(r, c0, r1, c1);
		}
	}
	foa(c, c0 + 1, c1 - 1) {
		int t = ac[r1 - 1][c] - ac[r0 - 1][c];
		if(t) has = 1;
		if(t == r1 - r0) {
			return dp(r0, c0, r1, c) && dp(r0, c, r1, c1);
		}
	}
	// dbg("0", r0, c0, r1, c1)
	return !has;
}
void solve()
{
	cin >> n >> m;
	foa(i, 1, n - 1) {
		cin >> c + 1;
		foa(j, 1, m) {
			if(c[j] == '1') {
				ar[i + 1][j] = 1;
			}
			ar[i + 1][j] += ar[i + 1][j - 1];
		}
	}
	foa(i, 1, n) {
		cin >> c + 1;
		foa(j, 1, m - 1) {
			if(c[j] == '1') {
				ac[i][j + 1] = 1;
			}
			ac[i][j + 1] += ac[i - 1][j + 1];
		}
	}
	cout << (dp(1, 1, n + 1, m + 1) ? "YES" : "NO") << endl;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3672kb

input:

3 4
0000
0111
101
101
110

output:

YES

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 0ms
memory: 3800kb

input:

3 3
110
011
01
11
10

output:

NO

result:

ok answer is NO

Test #3:

score: 0
Accepted
time: 7ms
memory: 39172kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #4:

score: 0
Accepted
time: 36ms
memory: 39252kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #5:

score: 0
Accepted
time: 13ms
memory: 39180kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #6:

score: 0
Accepted
time: 20ms
memory: 39164kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #7:

score: 0
Accepted
time: 21ms
memory: 39300kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #8:

score: 0
Accepted
time: 8ms
memory: 39168kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #9:

score: 0
Accepted
time: 8ms
memory: 39060kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #10:

score: 0
Accepted
time: 36ms
memory: 39324kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #11:

score: 0
Accepted
time: 46ms
memory: 39308kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #12:

score: 0
Accepted
time: 41ms
memory: 39212kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #13:

score: 0
Accepted
time: 15ms
memory: 39232kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #14:

score: 0
Accepted
time: 35ms
memory: 39192kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #15:

score: 0
Accepted
time: 40ms
memory: 39244kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #16:

score: 0
Accepted
time: 19ms
memory: 39260kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #17:

score: 0
Accepted
time: 20ms
memory: 39272kb

input:

1500 1500
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #18:

score: 0
Accepted
time: 50ms
memory: 39328kb

input:

1500 1500
10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #19:

score: 0
Accepted
time: 35ms
memory: 39304kb

input:

1500 1500
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #20:

score: 0
Accepted
time: 16ms
memory: 39260kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #21:

score: 0
Accepted
time: 15ms
memory: 39168kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #22:

score: 0
Accepted
time: 37ms
memory: 39304kb

input:

1500 1500
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #23:

score: 0
Accepted
time: 44ms
memory: 39236kb

input:

1500 1500
10111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #24:

score: 0
Accepted
time: 16ms
memory: 39184kb

input:

1500 1500
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #25:

score: 0
Accepted
time: 20ms
memory: 39240kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #26:

score: 0
Accepted
time: 28ms
memory: 39252kb

input:

1500 1500
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #27:

score: 0
Accepted
time: 42ms
memory: 39240kb

input:

1500 1500
11011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #28:

score: 0
Accepted
time: 20ms
memory: 39176kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #29:

score: 0
Accepted
time: 26ms
memory: 39264kb

input:

1500 1500
00010000000000011110111101011011110011001110011110011101111011110111000111000110001101111011110101100011011110111101000011110111101110011110000001111011110111101111011100111100110000010110101111011110110000000001100011101111011000011001111011100110001111011110011101111011110111100000011110...

output:

YES

result:

ok answer is YES

Test #30:

score: 0
Accepted
time: 12ms
memory: 39172kb

input:

1500 1500
11100111101111011110000101000011110011101111001000001101111011110111000100011110110100101000000011001110000110111101110011110111101111011110111001000011110110001111001010110000011011110110001111010010111101111011110111000000001110111101111001010111000111000000110000000011000111000001011110...

output:

YES

result:

ok answer is YES

Test #31:

score: 0
Accepted
time: 27ms
memory: 39160kb

input:

1500 1500
11110111101111011110111101111001110000000111011110111101110011100111101101011000111100000000000111101111011110000001110000010111101000011100111101101001100110001111011110100001111011110101101110011000000001110011110111101110001100111101111011110000100000011010111101111011010111101110000000...

output:

YES

result:

ok answer is YES

Test #32:

score: 0
Accepted
time: 15ms
memory: 39240kb

input:

1500 1500
11100000000000000011100000000000000000000001110000000000000000000000000000000000000000000000001110000000000000000000000000001110000000000000000000011100000000111100000011100000011100000000000000000000000000000000000000000011100000000000000000000000001111000000000000000000000000000000000000...

output:

NO

result:

ok answer is NO

Test #33:

score: 0
Accepted
time: 23ms
memory: 39048kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #34:

score: 0
Accepted
time: 22ms
memory: 39108kb

input:

1500 1500
00011100000001111000000000000011111100000000000000000000000000000000111000000011100000000001110000111111000000000000000001111000000000000000011110000000000000000000000000000000000000111111001110000000000000001111000000000000000111000000000000000000000000000000111000000000000111000000000000...

output:

YES

result:

ok answer is YES

Test #35:

score: 0
Accepted
time: 12ms
memory: 39116kb

input:

1500 1500
00000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000...

output:

NO

result:

ok answer is NO

Test #36:

score: 0
Accepted
time: 12ms
memory: 39160kb

input:

1500 1500
00000000011100111100000000000000000000000000000000000000000000000000000111000000000000001110001110000000000001111111101110000000000000000000001111000000011100000000000000000000000000000000000000000011100000111000000000000000001111000000000000000000000000000000000011111000000000000000000000...

output:

NO

result:

ok answer is NO

Test #37:

score: 0
Accepted
time: 23ms
memory: 39112kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000...

output:

YES

result:

ok answer is YES

Test #38:

score: 0
Accepted
time: 14ms
memory: 39188kb

input:

1500 1500
00001110000000000000000011100000000000000000000000000000000111100000000000001111000111000000000000000000000000111000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000111000000000000000000000011100000000011100000000000000001110000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #39:

score: 0
Accepted
time: 7ms
memory: 39044kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

NO

result:

ok answer is NO

Test #40:

score: 0
Accepted
time: 7ms
memory: 39188kb

input:

1500 1500
00000000000000011100000000000000000000000000000000000000011100000011100000000000000011100011100000000000000000000000000000000000000000000000000000111000000001111000000000000000000000000000001111000001110000000000000000001110000000000000000000000000000000000000001111011100011100000000000000...

output:

NO

result:

ok answer is NO

Test #41:

score: 0
Accepted
time: 16ms
memory: 39056kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #42:

score: 0
Accepted
time: 24ms
memory: 39188kb

input:

1500 1500
00011100000001111111000001111111000011110000000111000000000000011100000000111000000000000000001111000000000000000000000000000000011111000011110000000000000111100000000000001110000000011100001111000000001111000000000001111011110000000000000000000000000000011110000000000000000000000001110000...

output:

YES

result:

ok answer is YES

Test #43:

score: 0
Accepted
time: 19ms
memory: 39172kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

NO

result:

ok answer is NO

Test #44:

score: 0
Accepted
time: 16ms
memory: 39052kb

input:

1500 1500
00001110001110000011110000001111111000000000000111000001110000000000000000000000000000111000000000001110000000011111001111000000000000000000011110000000000111000000001111100000001111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000...

output:

NO

result:

ok answer is NO

Test #45:

score: 0
Accepted
time: 19ms
memory: 39048kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #46:

score: 0
Accepted
time: 24ms
memory: 39276kb

input:

1500 1500
00000000000000000000000000000000000001110000000000000000000000000000001110000000000000011100000000000000000111100000000000000000001111000000011100000000000000111100000000000000001110000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #47:

score: 0
Accepted
time: 4ms
memory: 39100kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000001110000000000001110000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100...

output:

NO

result:

ok answer is NO

Test #48:

score: 0
Accepted
time: 4ms
memory: 39112kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #49:

score: 0
Accepted
time: 8ms
memory: 39172kb

input:

1500 1500
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

YES

result:

ok answer is YES

Test #50:

score: 0
Accepted
time: 9ms
memory: 23412kb

input:

750 1500
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #51:

score: 0
Accepted
time: 15ms
memory: 34420kb

input:

1500 750
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

NO

result:

ok answer is NO

Test #52:

score: 0
Accepted
time: 16ms
memory: 22856kb

input:

750 1500
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #53:

score: 0
Accepted
time: 23ms
memory: 34700kb

input:

1500 750
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #54:

score: 0
Accepted
time: 16ms
memory: 39300kb

input:

1500 1500
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

YES

result:

ok answer is YES

Test #55:

score: 0
Accepted
time: 27ms
memory: 39156kb

input:

1500 1500
01010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101...

output:

YES

result:

ok answer is YES

Test #56:

score: 0
Accepted
time: 39ms
memory: 39192kb

input:

1500 1500
11111111111110110001100000101100100110111111010111111011000111100111111111101111111110011111111111110101111111111111011111111111111111111100001100000001011001011001100001111100110000000000111111111111111111111111111111111111110111111111111111111111111000111111111111000110000011111111100011...

output:

YES

result:

ok answer is YES

Test #57:

score: 0
Accepted
time: 27ms
memory: 39088kb

input:

1500 1500
01101111111000011111111111111111111110011110011101111110000111111001111111111111111111111111111101111011101101111110001101111100001111111111111111111111000001100000110111111111110011001101111111111011100001011111100111101100001111111111111111100001111111111111011111000111111111111111101110...

output:

YES

result:

ok answer is YES