QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#735503#6504. Flower's Land 2definierenAC ✓1566ms132936kbC++2010.5kb2024-11-11 20:25:282024-11-22 20:52:51

Judging History

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

  • [2024-11-22 20:52:51]
  • 自动重测本题所有获得100分的提交记录
  • 测评结果:AC
  • 用时:1566ms
  • 内存:132936kb
  • [2024-11-22 20:26:09]
  • hack成功,自动添加数据
  • (/hack/1243)
  • [2024-11-11 20:25:32]
  • 评测
  • 测评结果:100
  • 用时:1283ms
  • 内存:132944kb
  • [2024-11-11 20:25:28]
  • 提交

answer

#include <bits/stdc++.h>

#define fir first
#define sec second
#define mkp make_pair
#define mkt make_tuple
#ifdef LOCAL
#define dbg(x) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << '\n'
#define dpi(x, y) cerr << "In Line " << __LINE__ << " the " << #x << " = " << x << " ; " << "the " << #y << " = " << y << '\n'
#define dbgf(fmt, args...) fprintf(stderr, fmt, ##args)
#else
#define dbg(x) void()
#define dpi(x, y) void()
#define dbgf(fmt, args...) void()
#endif

using namespace std;

using ll = long long;
using ull = unsigned long long;
using ui = unsigned int;
using ldb = long double;
using i128 = __int128_t;
using ui128 = __uint128_t;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using vi = vector<int>;
using vpii = vector<pii>;

namespace {
bool Mbe;
constexpr int MOD = 998244353;
template<typename T> T Norm(T a, T p = MOD) { return (a % p + p) % p; }
template<typename T> T add(T a, T b, T p = MOD) { return (a + b >= p) ? (a + b - p) : (a + b); }
template<typename T> T del(T a, T b, T p = MOD) { return (a - b < 0) ? (a - b + p) : (a - b); }
template<typename T> T mul(T a, T b, T p = MOD) { return 1ll * a * b % p; }
template<typename T> T cadd(T &a, T b, T p = MOD) { return a = add(a, b, p); }
template<typename T> T cdel(T &a, T b, T p = MOD) { return a = del(a, b, p); }
template<typename T> T cmul(T &a, T b, T p = MOD) { return a = mul(a, b, p); }
template<typename T> bool cmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> bool cmin(T &a, T b) { return a > b ? a = b, true : false; }
template<typename T> T DivFloor(T a, T b) { return a >= 0 ? a / b : (a - b + 1) / b; }
template<typename T> T DivCeil(T a, T b) { return a >= 0 ? (a + b - 1) / b : a / b; }

namespace FastIO {
	constexpr int LEN = 1 << 20;
	char in[LEN + 1], out[LEN + 1];
	char *pin = in, *pout = out, *ein = in, *eout = out + LEN;

	char gc() { return pin == ein && (ein = (pin = in) + fread(in, 1, LEN, stdin), ein == in) ? EOF : *pin ++; }
	void pc(char c) { pout == eout && (fwrite(out, 1, LEN, stdout), pout = out); (*pout ++) = c; return; }
	struct Flush { ~Flush() { fwrite(out, 1, pout - out, stdout); pout = out; return; } } _flush;

	template<typename T> T Read() {
		T x = 0; int f = 1; char ch = gc();
		while (ch < '0' || ch > '9') f = (ch == '-' ? (~f + 1) : f), ch = gc();
		while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gc();
		return x * f;
	}
	void Read(char *s) {
		char ch = gc();
		while (ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') ch = gc();
		while ((ch != EOF) && !(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t')) *s = ch, s ++, ch = gc();
		*s = '\0'; return;
	}
	template<typename T> void Read(T &x) { x = Read<T>(); return; }
	template<typename T, typename ...Args>
	void Read(T &x, Args &...args) { Read(x), Read(args...); return; }
	template<typename T> void Write(T x) {
		static char stk[40]; int tp = 0;
		if (x < 0) pc('-'), x = ~x + 1;
		do stk[tp++] = x % 10 + 48, x /= 10; while (x);
		while (tp --) pc(stk[tp]);
		return;
	}
	void Write(char ch) { pc(ch); return; }
	void Write(const char *s) {
		while (*s != '\0') pc(*s), s ++;
		return;
	}
	void Puts(const char *s) {
		Write(s), pc('\n'); return;
	}
	template<typename T, typename ...Args>
	void Write(T x, Args ...args) { Write(x), Write(args...); return; }
}
using FastIO::Read;
using FastIO::Write;
using FastIO::Puts;

#define getchar FastIO::gc
#define putchar FastIO::pc

int Pow(int a, int b) {
	int ans = 1;
	for (; b; b >>= 1, cmul(a, a))
		if (b & 1) cmul(ans, a);
	return ans;
}

mt19937 rnd((time(0)) ^ (ull)(new char));
struct Matrix {
	int a[2][2];
	
	Matrix() {
		for (int i : {0, 1})
			for (int j : {0, 1}) a[i][j] = i == j;
		return;
	}
	void Genshin() {
		do {
			a[0][0] = rnd() % MOD, a[0][1] = rnd() % MOD, a[1][1] = del(0, a[0][0]);
			a[1][0] = mul(del(1, mul(a[0][0], a[0][0])), Pow(a[0][1], MOD - 2));
//			cerr << a[0][0] << ' ' << a[0][1] << ' ' << a[1][0] << ' ' << a[1][1] << endl;
		} while (!(a[0][0] && a[0][1] && a[1][0] && a[1][1]));
		return;
	}
	friend Matrix operator * (Matrix x, Matrix y) {
		Matrix ans;
		for (int i : {0, 1}) for (int j : {0, 1}) ans.a[i][j] = 0;
		for (int i : {0, 1}) for (int j : {0, 1})
			for (int k : {0, 1}) cadd(ans.a[i][j], mul(x.a[i][k], y.a[k][j]));
		return ans;
	}
	friend bool operator < (const Matrix &x, const Matrix &y) {
		for (int i : {0, 1}) for (int j : {0, 1})
			if (x.a[i][j] != y.a[i][j]) return x.a[i][j] < y.a[i][j];
		return false; 
	}
	friend bool operator == (const Matrix &x, const Matrix &y) {
		for (int i : {0, 1}) for (int j : {0, 1})
			if (x.a[i][j] != y.a[i][j]) return false;
		return true;
	}
	friend ostream& operator << (ostream& os, const Matrix &x) {
		for (int i : {0, 1}) for (int j : {0, 1})
			os << x.a[i][j] << ' ';
		return os;
	}
};

template<class Info, class Tag, const int SZ>
struct Segment_Tree {
	private:
		int n, ps[SZ];
		struct Node { Info dt; Tag tg; } sgt[SZ << 2];
		vector<Info> ve; vector<int> _vec;
		vector<tuple<int, int, int>> vec;
		
		constexpr void Push_Up(int p) { sgt[p].dt = sgt[p << 1].dt + sgt[p << 1 | 1].dt; return; }
		constexpr void Push_Tag(int p, Tag tg) { sgt[p].dt = tg.Apply(sgt[p].dt), sgt[p].tg = tg * sgt[p].tg; return; }
		constexpr void Push_Down(int p) { if (sgt[p].tg) Push_Tag(p << 1, sgt[p].tg), Push_Tag(p << 1 | 1, sgt[p].tg), sgt[p].tg = Tag(); return; }
		constexpr void Build(int p, int L, int R) {
			sgt[p].tg = Tag();
			if (L == R) { ps[L] = p; sgt[p].dt = ve[L]; return; }
			int Mid = (L + R) >> 1; Build(p << 1, L, Mid);
			Build(p << 1 | 1, Mid + 1, R); Push_Up(p); return;
		}
		constexpr void Extract(int l, int r, int p, int L, int R) {
			if (l <= L && R <= r) { vec.emplace_back(p, L, R); return; }
			Push_Down(p); int Mid = (L + R) >> 1;
			if (l <= Mid) Extract(l, r, p << 1, L, Mid);
			if (Mid < r) Extract(l, r, p << 1 | 1, Mid + 1, R);
			_vec.emplace_back(p); return;
		}
	public:
		constexpr void Build(int _n) {
			ve.assign(n = _n, Info());
			Build(1, 0, n - 1); return;
		}
		template<class T> constexpr void Build(const vector<T> &a) {
			ve.resize(n = (int)a.size());
			for (int i = 0; i < n; i ++) ve[i] = a[i];
			Build(1, 0, n - 1); return;
		}	
		template<class _InputIterator, class = _RequireInputIter<_InputIterator>>
		constexpr void Build(_InputIterator __first, _InputIterator __last) {
			ve.resize(n = __last - __first);
			for (auto it = __first; it != __last; it ++) ve[it - __first] = *it;
			Build(1, 0, n - 1); return;
		}
		template<class F> constexpr void Build(int _n, F f) {
			ve.resize(n = _n);
			for (int i = 0; i < n; i ++) ve[i] = f(i);
			Build(1, 0, n - 1); return;
		}
		constexpr void Update(int l, int r, Tag k) {
			_vec.clear(), vec.clear();
			Extract(l, r, 1, 0, n - 1);
			for (auto [p, L, R] : vec) Push_Tag(p, k);
			for (auto p : _vec) Push_Up(p);
			return;
		}
		constexpr void Update(int pos, Tag k) {
			_vec.clear(); pos = ps[pos];
			while (pos) _vec.emplace_back(pos), pos >>= 1;
			for (int i = (int)_vec.size() - 1; i; i --) Push_Down(_vec[i]);
			Push_Tag(_vec.front(), k);
			for (int i = 1; i < (int)_vec.size(); i ++) Push_Up(_vec[i]);
			return;
		}
		constexpr void Change(int pos, Info k) {
			_vec.clear(); pos = ps[pos];
			while (pos) _vec.emplace_back(pos), pos >>= 1;
			for (int i = (int)_vec.size() - 1; i; i --) Push_Down(_vec[i]);
			sgt[_vec.front()].dt = k;
			for (int i = 1; i < (int)_vec.size(); i ++) Push_Up(_vec[i]);
			return;
		}
		constexpr Info Query() { return sgt[1].dt; }
		constexpr Info Query(int l, int r) {
			_vec.clear(), vec.clear();
			Extract(l, r, 1, 0, n - 1);
			Info ans = sgt[get<0>(vec.front())].dt;
			for (int i = 1; i < (int)vec.size(); i ++)
				ans = ans + sgt[get<0>(vec[i])].dt;
			return ans;
		}
		constexpr Info Query(int pos) {
			_vec.clear(); pos = ps[pos];
			while (pos) _vec.emplace_back(pos), pos >>= 1;
			for (int i = (int)_vec.size() - 1; i; i --) Push_Down(_vec[i]);
			return sgt[_vec.front()].dt;
		}
		template<class Compare>
		constexpr pair<int, Info> Find_Nxt(int l, int r, Info k, Compare comp) {
			_vec.clear(), vec.clear();
			Extract(l, r, 1, 0, n - 1);
			for (auto [p, L, R] : vec) {
				if (!comp(k, sgt[p].dt)) continue;
				while (L < R) {
					int Mid = (L + R) >> 1; Push_Down(p);
					if (comp(k, sgt[p << 1].dt)) R = Mid, p <<= 1;
					else L = Mid + 1, p = p << 1 | 1;
				}
				return {L, sgt[p].dt};
			}
			return {r + 1, Info()};
		}
		template<class Compare>
		constexpr pair<int, Info> Find_Pre(int l, int r, Info k, Compare comp) {
			_vec.clear(), vec.clear();
			Extract(l, r, 1, 0, n - 1);
			reverse(vec.begin(), vec.end());
			for (auto [p, L, R] : vec) {
				if (!comp(k, sgt[p].dt)) continue;
				while (L < R) {
					int Mid = (L + R) >> 1; Push_Down(p);
					if (!comp(k, sgt[p << 1 | 1].dt)) R = Mid, p <<= 1;
					else L = Mid + 1, p = p << 1 | 1;
				}
				return {L, sgt[p].dt};
			}
			return {l - 1, Info()};
		}
};
struct Info {
	Matrix prod[3];
	
	Info() { return; }
	friend Info operator + (Info x, Info y) {
		Info ans;
		for (int o : {0, 1, 2}) ans.prod[o] = x.prod[o] * y.prod[o];
		return ans;
	}
};
struct Tag {
	int tg;
	
	Tag(): tg(0) { return; }
	Tag(int _t): tg(_t) { return; }
	operator bool() {
		return tg;
	}
	friend Tag operator * (Tag x, Tag y) {
		return Tag((x.tg + y.tg) % 3);
	}
	Info Apply(Info x) {
		Info ans;
		for (int o : {0, 1, 2})
			ans.prod[o] = x.prod[(o + tg) % 3];
		return ans;
	}
};

constexpr int N = 5e5 + 5;
int n, q;
char s[N];
Segment_Tree<Info, Tag, N> sgt;
Matrix mp[3];

void slv() {
	for (int i : {0, 1, 2}) mp[i].Genshin();
	Read(n, q), Read(s);
	sgt.Build(n, [&](int i) {
		int x = s[i] - '0'; Info ans;
		for (int o : {0, 1, 2}) ans.prod[o] = mp[(o + x) % 3];
		return ans;
	});
	while (q --) {
		int opt, l, r; Read(opt, l, r);
		-- l, -- r;
		if (opt == 1) sgt.Update(l, r, Tag(1));
		else {
			auto ans = sgt.Query(l, r);
			for (int x : {0, 1}) for (int y : {0, 1})
				if (ans.prod[0].a[x][y] != (x == y)) { Puts("No"); goto END; }
			Puts("Yes"); END: {};
		}
	}
	return;
}
void clr() {

	return;
}
bool Med;
}

int main() {
#ifdef LOCAL
	freopen("!in.in", "r", stdin);
	freopen("!out.out", "w", stdout);
	fprintf(stderr, "%.3lf Mb\n", fabs((&Mbe - &Med) / 1048576.0));
#endif
	int T = 1;
//	int T = Read<int>();
	while (T --) slv(), clr();
#ifdef LOCAL
	fprintf(stderr, "%d ms\n", (int)clock());
#endif
	return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 8ms
memory: 108232kb

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: 285ms
memory: 109500kb

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: 290ms
memory: 108456kb

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: 495ms
memory: 109100kb

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: 492ms
memory: 109148kb

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: 1566ms
memory: 132744kb

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: 1501ms
memory: 132608kb

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: 1531ms
memory: 132936kb

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: 865ms
memory: 132348kb

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: 839ms
memory: 132372kb

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: 1148ms
memory: 132696kb

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: 1166ms
memory: 132576kb

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: 1185ms
memory: 132776kb

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: 1109ms
memory: 132672kb

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: 1121ms
memory: 132812kb

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: 1530ms
memory: 132688kb

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: 1445ms
memory: 132500kb

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: 1426ms
memory: 132688kb

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: 1411ms
memory: 132540kb

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: 1289ms
memory: 132576kb

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: 1239ms
memory: 132596kb

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: 1217ms
memory: 132680kb

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: 1178ms
memory: 132348kb

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: 1175ms
memory: 132540kb

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: 1226ms
memory: 132316kb

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: 1223ms
memory: 132744kb

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: 1028ms
memory: 132384kb

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: 1058ms
memory: 132160kb

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: 993ms
memory: 132700kb

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: 1058ms
memory: 132620kb

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: 1053ms
memory: 132692kb

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