QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418081#6504. Flower's Land 2EXODUSAC ✓963ms129476kbC++1718.9kb2024-05-23 10:12:422024-11-22 20:46:20

Judging History

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

  • [2024-11-22 20:46:20]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:963ms
  • 内存:129476kb
  • [2024-11-22 20:26:09]
  • hack成功,自动添加数据
  • (/hack/1243)
  • [2024-05-23 10:12:43]
  • 评测
  • 测评结果:100
  • 用时:1839ms
  • 内存:129496kb
  • [2024-05-23 10:12:42]
  • 提交

answer


#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <set>
#include <functional>
#include <cstring>

#include <vector>
#include <algorithm>
#include <cassert>
namespace exodus{
	namespace internal{
		class nothing{
		public:
			nothing(){}
			friend nothing operator +(const nothing&,const nothing&){return nothing();}
		};
	}
	template<class info=internal::nothing>
	struct dsu{
	public:
		struct node{
		public:
			node(){anc=-1,siz=1,ifo=info();}
			int anc,siz;
			info ifo;
		};
		dsu():_n(0){}
		explicit dsu(int n){
			_n=n;node.resize(n);
			for(int i=0;i<n;i++)
				node[i].anc=i;
		}
		void build(int n){
			_n=n;
			node.clear();
			node.resize(n);
			for(int i=0;i<n;i++)
				node[i].anc=i;
		}
		int find(int u){
			assert(0<=u&&u<_n);
			return __find(u);
		}
		void merge(int u,int v){
			assert(0<=u&&u<_n);
			assert(0<=v&&v<_n);
			u=__find(u),v=__find(v);
			if(node[u].siz<node[v].siz)std::swap(u,v);
			node[v].anc=u;
			node[u].ifo=node[u].ifo+node[v].ifo;
		}
		bool check(int u,int v){
			assert(0<=u&&u<_n);
			assert(0<=v&&v<_n);
			u=__find(u),v=__find(v);
			return u==v;
		}
	private:
		int _n;
		std::vector<node>node;
		int __find(int u){
			return u==node[u].anc?u:node[u].anc=__find(node[u].anc);
		}
	};
}


#include<string>
namespace exodus{
    namespace internal{
        const std::basic_string<char>Alpha{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
        const std::basic_string<char>alpha{'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
        const std::basic_string<char>digit{'0','1','2','3','4','5','6','7','8','9'};
    }
}


namespace exodus{
	using internal::Alpha;
    using internal::alpha;
    using internal::digit;
	struct randlib{
	public:
		randlib(long long seed=std::chrono::steady_clock::now().time_since_epoch().count()):g(seed){}
		/**
		 *  @brief This function returns a random integer in the range [l,r].
		 *  @param l The left bound of the value.
		 *  @param r The right bound of the value.
		*/
		template<typename T>
		T rnd(T l,T r){return std::uniform_int_distribution<T>(l,r)(g);}
		/**
		 *  @brief This function returns a random string of length len in the sigma character set.
		 *  @param len The length of the string.
		 *  @param sigma The character set.
		*/
		std::string rnd_string(const int len,const std::basic_string<char>&sigma){
			std::string result;
			result.resize(len);
			int sigma_size=sigma.size();
			for(auto &c:result)c=sigma[rnd<int>(0,sigma_size-1)];
			return result;
		}
		/**
		 *  @brief This function will return a tree with n vertices that has an expected tree height of O(log(n)).
		 *  @param n The number of node in tree.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		std::vector<std::pair<int,int>>rnd_log_tree(int n,bool unordered=true){
			std::vector<std::pair<int,int>>result,edge;
			for(int i=1;i<n;i++)
				edge.emplace_back(i,rnd<int>(0,i-1));
			if(unordered){
				std::vector<int>ord(n);
				std::iota(ord.begin(),ord.end(),1);
				std::shuffle(ord.begin(),ord.end(),g);
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}else{
				std::vector<int>ord(n);
				std::iota(ord.begin(),ord.end(),1);
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}
			std::shuffle(result.begin(),result.end(),g);
			return result;
		}
		/**
		 *  @brief This function will return a weighted tree with n vertices that has an expected tree height of O(log(n)).
		 *  @param n The number of node in tree.
		 *  @param L The left bound of the weight.
		 *  @param R The right bound of the weight.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		template<typename Weight>
		std::vector<std::tuple<int,int,Weight>>rnd_log_weighted_tree(int n,Weight L,Weight R,bool unordered=true){
			auto edge=rnd_log_tree(n,unordered);
			std::vector<std::tuple<int,int,Weight>>result;
			for(auto [u,v]:edge)result.emplace_back(u,v,rnd<Weight>(L,R));
			return result;
		}
		/**
		 *  @brief This function will return a tree with n vertices that has an expected tree height of O(sqrt(n)).
		 *  @param n The number of node in tree.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		std::vector<std::pair<int,int>>rnd_sqrt_tree(int n,bool unordered=true){
			dsu dsu(n);
			std::vector<std::pair<int,int>>result,edge;
			for(;(int)edge.size()<n;){
				int u=rnd<int>(0,n-1),v=rnd<int>(0,n-1);
				if(dsu.check(u,v))continue;
				dsu.merge(u,v);
				edge.emplace_back(u,v);
			}
			if(unordered){
				std::vector<int>ord(n);
				std::iota(ord.begin(),ord.end(),1);
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}else{
				std::vector<std::vector<int>>e(n);
				for(auto [u,v]:edge)
					e[u].emplace_back(v),e[v].emplace_back(u);
				std::vector<int>ord(n);
				int ord_cnt=0;
				std::function<void(int)>dfs=[&](int u){
					ord[u]=++ord_cnt;
					for(auto v:e[u]){
						e[v].erase(std::find(e[v].begin(),e[v].end(),u));
						dfs(v);
					}
				};
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}
			std::shuffle(result.begin(),result.end(),g);
			return result;
		}
		/**
		 *  @brief This function will return a weighted tree with n vertices that has an expected tree height of O(sqrt(n)).
		 *  @param n The number of node in tree.
		 *  @param L The left bound of the weight.
		 *  @param R The right bound of the weight.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		template<typename Weight>
		std::vector<std::tuple<int,int,Weight>>rnd_sqrt_weighted_tree(int n,Weight L,Weight R,bool unordered=true){
			auto edge=rnd_sqrt_tree(n,unordered);
			std::vector<std::tuple<int,int,Weight>>result;
			for(auto [u,v]:edge)result.emplace_back(u,v,rnd<Weight>(L,R));
			return result;
		}
		/**
		 *  @brief This function will return a tree with n vertices that has an expected tree height of O(n).
		 *  @param n The number of node in tree.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		std::vector<std::pair<int,int>>rnd_linear_tree(int n,bool unordered=true){
			std::vector<std::pair<int,int>>edge,result;
			int dep=rnd<int>(n/3,2*n/3);
			for(int i=1;i<dep;i++)
				edge.emplace_back(i,i-1);
			for(int i=dep;i<n;i++)
				edge.emplace_back(i,rnd<int>(0,i-1));
			if(unordered){
				std::vector<int>ord(n);
				std::iota(ord.begin(),ord.end(),1);
				std::shuffle(ord.begin(),ord.end(),g);
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}else{
				std::vector<int>ord(n);
				std::iota(ord.begin(),ord.end(),1);
				for(auto [u,v]:edge)
					result.emplace_back(ord[u],ord[v]);
			}
			std::shuffle(result.begin(),result.end(),g);
			return result;
		}
		/**
		 *  @brief This function will return a tree with n vertices that has an expected tree height of O(n).
		 *  @param n The number of node in tree.
		 *  @param L The left bound of the weight.
		 *  @param R The right bound of the weight.
		 *  @param unordered The function will shuffle the order of the nodes if unordered is true.
		*/
		template<typename Weight>
		std::vector<std::tuple<int,int,Weight>>rnd_linear_weighted_tree(int n,Weight L,Weight R,bool unordered=true){
			auto edge=rnd_linear_tree(n,unordered);
			std::vector<std::tuple<int,int,Weight>>result;
			for(auto [u,v]:edge)result.emplace_back(u,v,rnd<Weight>(L,R));
			return result;
		}
		/**
		 *  @brief This function will return a graph with n vertices and m edges.
		 *  @param n The number of node in graph.
		 *  @param m The number of edge in graph.
		 *  @param connected The function will return a connected graph if connected is true.
		*/
		std::vector<std::pair<int,int>>rnd_graph(int n,int m,bool connected=true){
			std::vector<std::pair<int,int>>result;
			if(connected){
				assert(m>=n-1);
				auto edges=rnd_sqrt_tree(n);
				result=edges;
				std::set<std::pair<int,int>>visit;
				for(auto [u,v]:edges)
					visit.emplace(u,v),visit.emplace(v,u);
				for(int i=n,u,v;i<=m;i++){
					do{u=rnd(1,n),v=rnd(1,n);}while(!visit.count(std::make_pair(u,v)));
					visit.emplace(u,v),visit.emplace(v,u);
					result.emplace_back(u,v);
				}
				return result;
			}else{
				std::set<std::pair<int,int>>visit;
				for(int i=1,u,v;i<=m;i++){
					do{u=rnd(1,n),v=rnd(1,n);}while(!visit.count(std::make_pair(u,v)));
					visit.emplace(u,v),visit.emplace(v,u);
					result.emplace_back(u,v);
				}
				return result;
			}
		}
	private:
		std::mt19937_64 g;
	};
}



#include <vector>
#include <cassert>
#include <algorithm>
#include <cstdio>

namespace exodus{
    namespace internal{
        static constexpr int unroll_step=8;
        template<int R, int L = 0, int M = (L + R) / 2, class F>__attribute__((always_inline))
        inline void unroll(int i, F lambda) { if (R - L == 1)lambda(i + L); else unroll<M, L>(i, lambda), unroll<R, M>(i, lambda); }
    }
}


namespace exodus{
	typedef unsigned long long ull;
	template<typename T>
	struct base_matrix{
	public:
		base_matrix(){std::memset(mat,0,sizeof(mat));}
		explicit base_matrix(int _deg):deg(_deg){std::memset(mat,0,sizeof(mat));}
		T* operator [](int p){return mat[p];}
		const T* operator [](int p)const{return mat[p];}
		int get_deg()const{return deg;}
		void set_deg(int _deg){deg=_deg;std::memset(mat,0,sizeof(deg));}
		bool operator ==(const base_matrix& rhs){
			if(get_deg()!=rhs.get_deg())
				return false;
			for(int i=0;i<get_deg();i++)
				for(int j=0;j<get_deg();j++)
					if((*this)[i][j]!=rhs[i][j])
						return false;
			return true;
		}
		bool operator !=(const base_matrix& rhs){
			return !((*this)==rhs);
		}
	private:
		int deg;
		T mat[2][2];
	};
	template<unsigned int mod>
	struct mod_matrix:public base_matrix<int>{
	public:
		mod_matrix(){}
		explicit mod_matrix(int _deg):base_matrix<int>(_deg){}
		mod_matrix operator +(const mod_matrix& rhs)const{
			int deg=this->get_deg();
			mod_matrix res(deg);
			for(int i=0;i<deg;i++)
				for(int j=0;j<deg;j++)
					res[i][j]=(*this)[i][j]+rhs[i][j];
			return res;
		}
		mod_matrix operator *(const mod_matrix& rhs)const{
			int deg=this->get_deg();
			mod_matrix res(deg);
			for(int i=0;i<deg;i++)
				for(int k=0;k<deg;k++)
					for(int j=0;j<deg;j++)
						res[i][j]+=(*this)[i][k]*rhs[k][j];
			return res;
		}
		friend mod_matrix& operator +=(mod_matrix& lhs,const mod_matrix& rhs){
			lhs=lhs+rhs;
			return lhs;
		}
		friend mod_matrix& operator *=(mod_matrix& lhs,const mod_matrix& rhs){
			lhs=lhs*rhs;
			return lhs;
		}
		void print(){
			printf("mod_matrix\n");
			printf("============\n");
			int curdeg=this->get_deg();
			for(int i=0;i<curdeg;i++){
				for(int j=0;j<curdeg;j++)
					printf("%d ",(*this)[i][j]);
				printf("\n");
			}
			printf("============\n");
		}
	};
	template<typename T>
	struct base_vector{
	public:
		base_vector(){}
		explicit base_vector(int _deg,bool _tp):deg(_deg),tp(_tp){vec.resize(deg,T());}
		T& operator [](int p){return vec[p];}
		const T& operator [](int p)const{return vec[p];}
		int get_deg()const{return deg;}
		bool get_tp()const{return tp;}
		void set_deg(int _deg){
			deg=_deg;
			vec.resize(deg);
			fill(vec.begin(),vec.end(),T());
		}
	private:
		int deg;
		bool tp;
		std::vector<T>vec;
	};
	template<unsigned int mod>
	struct mod_vector:public base_vector<int>{
	public:
		mod_vector(){}
		explicit mod_vector(int _deg,bool _tp):base_vector<int>(_deg,_tp){}
		friend mod_vector operator +(const mod_vector& lhs,const mod_vector& rhs){
			assert(lhs.get_deg()==rhs.get_deg()&&lhs.get_tp()==rhs.get_tp());
			int deg=lhs.get_deg(),tp=lhs.get_tp();
			mod_vector res(deg,tp);
			auto add=[&](int& x,int y){x+=y-mod,x+=x>>31&mod;};
			int i=0;
			for(;i+internal::unroll_step-1<deg;i+=internal::unroll_step)
				internal::unroll<internal::unroll_step>(i,[&](int ci){add(res[ci]=lhs[ci],rhs[ci]);});
			while(i<deg)
				add(res[i]=lhs[i],rhs[i]),++i;
			return res;
		}
		friend mod_vector operator *(const mod_vector& lhs,const mod_matrix<mod>& rhs){
			if(lhs.get_tp()==0){
				const ull lim=16e18;
				assert(lhs.get_deg()==rhs.get_deg());
				int deg=lhs.get_deg();
				bool tp=lhs.get_tp();
				base_vector<ull>tmp(deg,tp);
				for(int k=0;k<deg;k++){
					int j=0;
					for(;j+internal::unroll_step-1<deg;j+=internal::unroll_step)
						internal::unroll<internal::unroll_step>(j,[&](int cj){tmp[cj]+=(ull)lhs[k]*rhs[k][cj];if(tmp[cj]>lim)tmp[cj]%=mod;});
					while(j<deg){
						tmp[j]+=(ull)lhs[k]*rhs[k][j];
						if(tmp[j]>lim)tmp[j]%=mod;
						++j;
					}
				}
				mod_vector res(deg,tp);
				for(int j=0;j<deg;j++)
					res[j]=tmp[j]%mod;
				return res;
			}else if(lhs.get_tp()==1){
				const ull lim=16e18;
				assert(lhs.get_deg()==rhs.get_deg());
				int deg=lhs.get_deg();
				bool tp=lhs.get_tp();
				base_vector<ull>tmp(deg,tp);
				for(int k=0;k<deg;k++){
					int j=0;
					for(;j+internal::unroll_step-1<deg;j+=internal::unroll_step)
						internal::unroll<internal::unroll_step>(j,[&](int cj){tmp[cj]+=(ull)lhs[k]*rhs[cj][k];if(tmp[cj]>lim)tmp[cj]%=mod;});
					while(j<deg){
						tmp[j]+=(ull)lhs[k]*rhs[j][k];
						if(tmp[j]>lim)tmp[j]%=mod;
						++j;
					}
				}
				mod_vector res(deg,tp);
				for(int j=0;j<deg;j++)
					res[j]=tmp[j]%mod;
				return res;
			}
		}
		friend mod_vector& operator +=(mod_vector& lhs,const mod_vector& rhs){
			lhs=lhs+rhs;
			return lhs;
		}
		friend mod_vector& operator *=(mod_vector& lhs,const mod_matrix<mod>& rhs){
			lhs=lhs*rhs;
			return lhs;
		}
		void print(){
			printf("mod_vector\n");
			printf("============\n");
			int curdeg=this->get_deg();
			for(int i=0;i<curdeg;i++){
				printf("%d ",(*this)[i]);
			}
			printf("\n");
			printf("============\n");
		}
	};
}


#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef exodus::mod_matrix<998244353> matrix;

#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)
#define Exit(p) fprintf(stderr,"[exit]: at breakpoint %d\n",p),exit(0);

#ifdef EXODUS
	#define Debug(...) fprintf(stderr,__VA_ARGS__)
#else
	#define Debug(...) 0
#endif

//=========================================================================================================
// Something about IO

template<typename T>
void read(T &x){
	x=0;T flg=1;
	char ch=getchar();
	while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}
	while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
	x*=flg;
}
template<typename T>
void seq_read(T bg,T ed){for(auto i=bg;i!=ed;++i)read(*i);}
template<typename T,typename... Args>
void read(T &x,Args &...args){read(x),read(args...);}

//=========================================================================================================
//Some useful function

template<typename T>
void cmax(T& x,T y){x=max(x,y);}
template<typename T,typename... Args>
void cmax(T& x,T y,Args ...args){cmax(x,y);cmax(x,args...);}
template<typename T>
void cmin(T& x,T y){x=min(x,y);}
template<typename T,typename... Args>
void cmin(T& x,T y,Args ...args){cmin(x,y);cmin(x,args...);}
template<typename T,typename U>
void seq_assign(T bg,T ed,U val){for(auto i=bg;i!=ed;++i)(*i)=val;}
template<typename T,class F,class=enable_if_t<is_invocable_v<F>>>
void seq_assign(T bg,T ed,F func){for(auto i=bg;i!=ed;++i)(*i)=func(i);}
template<typename T>
void seq_copy(T dstbg,T dsted,T srcbg,T srced){for(auto i=dstbg,j=srcbg;i!=dsted&&j!=srced;++i,++j)(*i)=(*j);}
matrix qpow(matrix b,int m){
	matrix res(b.get_deg());
	res[0][0]=res[1][1]=1;
	for(;m;m>>=1,b=b*b)
		if(m&1)res=res*b;
	return res;
}

//=========================================================================================================
// Define the global variables here.

bool membg=0;

constexpr int N=5e5+7;
constexpr int mod=998244353;
matrix e;
matrix mat[3],imat[3];
exodus::randlib gen(0);
int n,Q;
char s[N];
struct Sgt{
#define ls(k) ((k)<<1)
#define rs(k) ((k)<<1|1)
	struct node{
		matrix prod[3];
		int tag;
	}t[N<<2];
	void apply(int k,int v){
		rotate(t[k].prod,t[k].prod+v,t[k].prod+3);
		(t[k].tag+=v)%=3;
	}
	void pull(int k){
		for(int i=0;i<3;i++)
			t[k].prod[i]=t[ls(k)].prod[i]*t[rs(k)].prod[i];
	}
	void push(int k){
		if(t[k].tag){
			apply(ls(k),t[k].tag);
			apply(rs(k),t[k].tag);
			t[k].tag=0;
		}
	}
	void build(int k,int l,int r){
		t[k].tag=0;
		if(l==r){
			for(int i=0;i<3;i++)
				t[k].prod[i]=(l&1)?mat[i]:imat[i];
			apply(k,s[l]-'0');
			return;
		}
		int mid=(l+r)>>1;
		build(ls(k),l,mid);
		build(rs(k),mid+1,r);
		return pull(k);;
	}
	void modify(int k,int l,int r,int ql,int qr,int v){
		if(ql<=l&&r<=qr)
			return apply(k,v);
		int mid=(l+r)>>1;
		push(k);
		if(ql<=mid)
			modify(ls(k),l,mid,ql,qr,v);
		if(mid<qr)
			modify(rs(k),mid+1,r,ql,qr,v);
		return pull(k);
	}
	matrix query(int k,int l,int r,int ql,int qr){
		if(ql<=l&&r<=qr)
			return t[k].prod[0];
		int mid=(l+r)>>1;matrix res;
		push(k);
		if(ql<=mid){
			res=query(ls(k),l,mid,ql,qr);
			if(mid<qr)
				res=res*query(rs(k),mid+1,r,ql,qr);
		}else if(mid<qr){
			res=query(rs(k),mid+1,r,ql,qr);
		}
		return res;
	}
#undef ls
#undef rs
}sgt;

bool memed=0;

//=========================================================================================================
// Code here.

void generate(matrix& x,matrix& invx){
	x.set_deg(2),invx.set_deg(2);
	do{
		for(int i=0;i<2;i++)
			for(int j=0;j<2;j++)
				x[i][j]=gen.rnd(1,mod-1);
	}while(qpow(x,mod-1)!=e);
	invx=qpow(x,mod-2);
}

void solve(){
	e.set_deg(2);
	for(int i=0;i<2;i++)
		e[i][i]=1;
	for(int i=0;i<3;i++)
		generate(mat[i],imat[i]);
	read(n,Q);
	scanf("%s",s+1);
	sgt.build(1,1,n);
	// for(int i=0;i<3;i++)
	// 	(mat[i]*imat[i]).print();
	for(int qid=1,opt,l,r;qid<=Q;qid++){
		read(opt,l,r);
		if(opt==1){
			sgt.modify(1,1,n,l,r,1);
			// for(int i=l;i<=r;i++)
			// 	s[i]=(s[i]-'0'+1)%3+'0';
			// sgt.build(1,1,n);
		}else{
			// for(int i=l;i<=r;i++)
			// 	putchar(s[i]);
			// putchar('\n');
			printf(sgt.query(1,1,n,l,r)==e?"Yes\n":"No\n");
		}
	}
	return;
}


//=========================================================================================================

int main(){
	Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
	int timbg=clock();
	int T=1;
	while(T--)solve();
	int timed=clock();
	Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
	fflush(stdout);
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 190ms
memory: 128904kb

input:

8 9
01211012
2 4 5
2 3 6
1 6 8
1 6 8
2 3 6
2 1 8
1 1 1
1 7 7
2 1 8

output:

Yes
No
Yes
No
Yes

result:

ok 5 token(s): yes count is 3, no count is 2

Test #2:

score: 0
Accepted
time: 359ms
memory: 129156kb

input:

100 500000
0011010001000000000110011111000010100111000010101100101001111000001101001000100111101000110000011011
1 6 55
1 7 84
2 62 79
2 59 62
1 59 66
2 10 13
1 25 67
2 33 88
1 7 11
2 72 81
2 71 90
1 15 38
2 3 100
2 59 76
1 13 83
2 11 46
2 25 52
1 25 55
1 35 42
1 19 87
1 26 86
2 83 94
1 27 74
2 42 47...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 248102 token(s): yes count is 9322, no count is 238780

Test #3:

score: 0
Accepted
time: 347ms
memory: 129372kb

input:

100 500000
0210102000201220021100220012101022120002221021222001012101121221021110012101010200020222021101002100
2 8 69
2 37 98
2 13 22
2 20 25
2 16 89
1 47 61
1 1 70
2 19 68
1 31 91
2 6 39
2 16 51
2 44 57
2 24 27
1 25 64
1 20 59
1 18 98
2 45 66
1 2 75
2 16 89
2 85 96
1 12 45
1 9 22
1 66 87
2 13 30
2...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
N...

result:

ok 250664 token(s): yes count is 9342, no count is 241322

Test #4:

score: 0
Accepted
time: 478ms
memory: 128976kb

input:

1000 500000
010001011011010100000011110001101101101011110010111010011110010101100010110001110100010111010101100100111100111111100011001000000101100100101111110111011011110000101010111001111100110001100000011011100011111111010100101010110110100011110000101001100010110111010110001000100110110100000111...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 250675 token(s): yes count is 988, no count is 249687

Test #5:

score: 0
Accepted
time: 472ms
memory: 128924kb

input:

1000 500000
202011221110002000201111000002220121011012110120222101212012120002101120222210012210112202011121222201200211211122210122120201021222202222201102112101010210202120110111010212122020200221112122022202121200200110010012100002111210210002200210011210011222212012011010201121102121022200200110...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 248104 token(s): yes count is 1037, no count is 247067

Test #6:

score: 0
Accepted
time: 962ms
memory: 129392kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
No
Yes
Yes
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
N...

result:

ok 248044 token(s): yes count is 37, no count is 248007

Test #7:

score: 0
Accepted
time: 955ms
memory: 129336kb

input:

500000 500000
0001111011000101100010000100000001110010100101010011010010101010011001000101011110111000111100100001000000101101011001101001011010110111101100110111111110010011111111111100110000001100100001100010011000000001011011110010100111101010001101000100110011111110111000110111110000101000010001...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 250747 token(s): yes count is 1, no count is 250746

Test #8:

score: 0
Accepted
time: 963ms
memory: 129452kb

input:

500000 500000
1001012121120221010111021201201221111112012022002200212020201011201100002101022020120101222010011021020121102110211202120100002100121201102122011220122201220100100210222110112212220002122002110022112000012111101112211102120012120102001020221021211022111211201120001022122011201112101111...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 248066 token(s): yes count is 2, no count is 248064

Test #9:

score: 0
Accepted
time: 606ms
memory: 129392kb

input:

500000 500000
0001111011000101100010000100000001110010100101010011010010101010011001000101011110111000111100100001000000101101011001101001011010110111101100110111111110010011111111111100110000001100100001100010011000000001011011110010100111101010001101000100110011111110111000110111110000101000010001...

output:

Yes
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
Yes
Yes
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
Yes
N...

result:

ok 249864 token(s): yes count is 25722, no count is 224142

Test #10:

score: 0
Accepted
time: 603ms
memory: 129320kb

input:

500000 500000
1001012121120221010111021201201221111112012022002200212020201011201100002101022020120101222010011021020121102110211202120100002100121201102122011220122201220100100210222110112212220002122002110022112000012111101112211102120012120102001020221021211022111211201120001022122011201112101111...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 250064 token(s): yes count is 16110, no count is 233954

Test #11:

score: 0
Accepted
time: 616ms
memory: 129384kb

input:

500000 500000
0110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101100110100110010110100101100110100110010110011010010110100110010110011010011001011010010110011010010110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101...

output:

No
No
Yes
No
Yes
No
No
Yes
No
Yes
No
Yes
No
Yes
Yes
No
No
No
No
No
Yes
No
No
No
Yes
No
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
No
No
No
Yes
No
No
No
Yes
Yes
No
No
Yes
Yes
No
Yes
No
No
No
Yes
No
No...

result:

ok 499764 token(s): yes count is 13197, no count is 486567

Test #12:

score: 0
Accepted
time: 623ms
memory: 129336kb

input:

500000 500000
0112122012202001122020012001011212202001200101122001011201121220122020012001011220010112011212202001011201121220011212201220200112202001200101122001011201121220200101120112122001121220122020012001011201121220011212201220200101121220122020011220200120010112122020012001011220010112011212...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 499741 token(s): yes count is 4, no count is 499737

Test #13:

score: 0
Accepted
time: 722ms
memory: 129388kb

input:

500000 500000
1201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 495082 token(s): yes count is 25440, no count is 469642

Test #14:

score: 0
Accepted
time: 719ms
memory: 129408kb

input:

500000 500000
1201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201...

output:

No
No
Yes
Yes
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 495214 token(s): yes count is 25405, no count is 469809

Test #15:

score: 0
Accepted
time: 708ms
memory: 129376kb

input:

500000 500000
1201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201201...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 495041 token(s): yes count is 26778, no count is 468263

Test #16:

score: 0
Accepted
time: 945ms
memory: 129468kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
No
No
No
Yes
No
No
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
Yes
No
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
No
Y...

result:

ok 251625 token(s): yes count is 167813, no count is 83812

Test #17:

score: 0
Accepted
time: 939ms
memory: 129372kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
...

result:

ok 251611 token(s): yes count is 167452, no count is 84159

Test #18:

score: 0
Accepted
time: 923ms
memory: 129316kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
No
No
No
Yes
No
No
No
Yes
No
Yes
No
No
No
Yes
Yes
No
Yes
No
Yes...

result:

ok 251639 token(s): yes count is 167829, no count is 83810

Test #19:

score: 0
Accepted
time: 910ms
memory: 129372kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
No
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
...

result:

ok 249959 token(s): yes count is 166274, no count is 83685

Test #20:

score: 0
Accepted
time: 892ms
memory: 129316kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
Yes
Yes
Yes
No
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
No
No
No
No
No
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
No
Yes
No
Yes
Yes
Yes
Yes
No
No
No
Yes
No
Yes
No
Yes
Yes
Yes
Yes
...

result:

ok 251590 token(s): yes count is 167841, no count is 83749

Test #21:

score: 0
Accepted
time: 870ms
memory: 129348kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Ye...

result:

ok 249944 token(s): yes count is 167276, no count is 82668

Test #22:

score: 0
Accepted
time: 835ms
memory: 129320kb

input:

500000 500000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

No
Yes
Yes
Yes
Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
No
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
...

result:

ok 249967 token(s): yes count is 168649, no count is 81318

Test #23:

score: 0
Accepted
time: 636ms
memory: 129332kb

input:

500000 500000
2120211202121010200201010120211202102102011020120121200212101210200201212020122102020121011012101021211212012020122102020212122121202020200202020102011020101201211210210212011021201210100101210212100121201210100101210121011012101021200212010101200210101020200202012101022010121010200201...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 249676 token(s): yes count is 13, no count is 249663

Test #24:

score: 0
Accepted
time: 656ms
memory: 129316kb

input:

500000 500000
1210202120021202012120120201011010202102012121010110101212102021020201102020120212121021211212012121202101210220121012021201212120021212102121010121200212101012021012020220202101202120212101101212021201020212022021202010120102121001212010210102021020020120201012121010200201012121012010...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 249788 token(s): yes count is 13, no count is 249775

Test #25:

score: 0
Accepted
time: 668ms
memory: 129452kb

input:

500000 500000
1021201212020202010212020120120201212012010212121221212120102102121020210210202120102020202121021201201010121210121010202020202010120121010102120101200210102120101012102101020202020201012101212101010212121210120212101012021021020102121201212020201010010102020212102121201020120120210101...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 249720 token(s): yes count is 21, no count is 249699

Test #26:

score: 0
Accepted
time: 729ms
memory: 129344kb

input:

500000 500000
2102012102020210212121020120121010120121012012021010212101212102012010201212121012101210212102102120210201020121012021201021012010212021210202012010212020102121202021202121012121021010120210210202021212020212120121202012101201201012021212101210120101020201020121020210121020212012021212...

output:

No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 248946 token(s): yes count is 159, no count is 248787

Test #27:

score: 0
Accepted
time: 720ms
memory: 129456kb

input:

500000 500000
2102121210121212120202012120202010201212102010201021012020201020210210101210121201021212020210102121012010210101020201021010202010201201021010101020212020101210120101201210102020102010101021202102120210121010201012120121202102020121010212120102102102020120121010121010102012012021012010...

output:

No
No
No
No
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
N...

result:

ok 249807 token(s): yes count is 383, no count is 249424

Test #28:

score: 0
Accepted
time: 713ms
memory: 129460kb

input:

500000 500000
2120201021210101202021201212120202021010102021010212020102101010201021010201201012010101210101212012102102101010212102121202102010212120212102020212020121012012021020101210102012102021012121010121020101010210201021201021201201020202010202012020201201210101021010101202021020121202012020...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 248859 token(s): yes count is 994, no count is 247865

Test #29:

score: 0
Accepted
time: 703ms
memory: 129332kb

input:

500000 500000
1021012012010212010210120121012010120202102120202121021021202012121020201021202012120121201202021021020121012101201010101212120201212020120101210210202010210102102102021212021202120212121201201210201210102010120202021212121010121201021021202102020102121202010212020121020210212120212012...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok 248886 token(s): yes count is 2083, no count is 246803

Test #30:

score: 0
Accepted
time: 712ms
memory: 129476kb

input:

500000 500000
1202021012101201201021212121212121201212121012102020120210101212101201212020101020101210101212120201010201201021202121202020201201202010210120201202121010121010102102121010121021212021202021021202120102101202102020210102120202020212120202120212021020121212020102120121012120201202120121...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
...

result:

ok 248858 token(s): yes count is 4672, no count is 244186

Test #31:

score: 0
Accepted
time: 553ms
memory: 129376kb

input:

500000 500000
0100201020101001010102010202020201010201002020102020101001010201020100100201010020010101010102020202010010201020202020200102002010001020201010010102001000101010020000101020102001002020201002020101020101010102010020201010102020200010102020101002020002002002010101010201020020102020101020...

output:

No
No
No
No
No
No
No
No
No
No
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No
No
Yes
Yes
No
Yes
Yes
Yes
No
Yes
Yes
Yes
No
No
No
No
No
Yes
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No...

result:

ok 437390 token(s): yes count is 73249, no count is 364141

Extra Test:

score: 0
Extra Test Passed