QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#863782#9870. ItemshbbbbAC ✓2712ms19280kbC++2322.0kb2025-01-19 22:20:242025-01-19 22:20:25

Judging History

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

  • [2025-01-19 22:20:25]
  • 评测
  • 测评结果:AC
  • 用时:2712ms
  • 内存:19280kb
  • [2025-01-19 22:20:24]
  • 提交

answer

#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <random>
#include <chrono>
#include <vector>
#include <queue>
#include <array>
#include <numeric>
using namespace std;
//#define int long long

using ll = long long;

constexpr int N = 3e5 + 5, MOD = 1e9 + 7, HSMOD = 1610612741, HSMOD2 = 998244353; // Remember to change

template<int mod> class ModInt {
public:
	// Constractor definition
	ModInt(long long v = 0) noexcept : val(v% mod) {
		if (val < 0) val += mod;
	}

	// Operator overriding
	constexpr ModInt operator+(const ModInt& x) const { return ModInt(*this) += x; }
	constexpr ModInt operator-(const ModInt& x) const { return ModInt(*this) -= x; }
	constexpr ModInt operator*(const ModInt& x) const { return ModInt(*this) *= x; }
	constexpr ModInt operator/(const ModInt& x) const { return ModInt(*this) /= x; }
	constexpr ModInt& operator+=(const ModInt& x) {
		val += x.val;
		if (val >= mod) val -= mod;
		return *this;
	}
	constexpr ModInt& operator-=(const ModInt& x) {
		val -= x.val;
		if (val < 0) val += mod;
		return *this;
	}
	constexpr ModInt& operator*=(const ModInt& x) {
		val *= x.val;
		val %= mod;
		if (val < 0) val += mod;
		return *this;
	}
	constexpr ModInt& operator/=(const ModInt& x) {
		long long a = mod, b = x.val;
		long long s = 1, t = 0, ns = 0, nt = 1;
		while (a % b != 0) {
			int q = a / b;
			int r = a % b;
			int tmps = s - q * ns;
			int tmpt = t - q * nt;

			a = b;
			b = r;
			s = ns;
			t = nt;
			ns = tmps;
			nt = tmpt;
		}
		val = val * nt % mod;
		if (val < 0) val += mod;
		return *this;
	}
	friend constexpr std::ostream& operator<<(std::ostream& o, const ModInt<mod>& x) {
		return o << x.val;
	}

public:
	long long val = 0;
};

using mint = ModInt<MOD>;

int mod = 998244353, grt = 3;

class poly {
private:
	std::vector<int> data;

	void out(void) {
		for (int i = 0; i < (int)data.size(); ++i) printf("%d ", data[i]);
		puts("");
	}

public:
	poly(std::size_t len = std::size_t(0)) { data = std::vector<int>(len); }

	poly(const std::vector<int>& b) { data = b; }

	poly(const poly& b) { data = b.data; }

	void resize(std::size_t len, int val = 0) { data.resize(len, val); }

	std::size_t size(void) const { return data.size(); }

	void clear(void) { data.clear(); }
#if __cplusplus >= 201103L
	void shrink_to_fit(void) { data.shrink_to_fit(); }
#endif
	int& operator[](std::size_t b) { return data[b]; }

	const int& operator[](std::size_t b) const { return data[b]; }

	poly operator*(const poly& h) const;
	poly operator*=(const poly& h);
	poly operator*(const int& h) const;
	poly operator*=(const int& h);
	poly operator+(const poly& h) const;
	poly operator+=(const poly& h);
	poly operator-(const poly& h) const;
	poly operator-=(const poly& h);
	poly operator<<(const std::size_t& b) const;
	poly operator<<=(const std::size_t& b);
	poly operator>>(const std::size_t& b) const;
	poly operator>>=(const std::size_t& b);
	poly operator/(const int& h) const;
	poly operator/=(const int& h);
	poly operator==(const poly& h) const;
	poly operator!=(const poly& h) const;
	poly operator+(const int& h) const;
	poly operator+=(const int& h);
	poly inv(void) const;
	poly inv(const int& h) const;
	friend poly sqrt(const poly& h);
	friend poly log(const poly& h);
	friend poly exp(const poly& h);
};

int qpow(int a, int b, int p = mod) {
	int res = 1;
	while (b) {
		if (b & 1) res = (ll)res * a % p;
		a = (ll)a * a % p, b >>= 1;
	}
	return res;
}

std::vector<int> rev;

void dft_for_module(std::vector<int>& f, int n, int b) {
	static std::vector<int> w;
	w.resize(n);
	for (int i = 0; i < n; ++i)
		if (i < rev[i]) std::swap(f[i], f[rev[i]]);
	for (int i = 2; i <= n; i <<= 1) {
		w[0] = 1, w[1] = qpow(grt, (mod - 1) / i);
		if (b == -1) w[1] = qpow(w[1], mod - 2);
		for (int j = 2; j < i / 2; ++j) w[j] = (ll)w[j - 1] * w[1] % mod;
		for (int j = 0; j < n; j += i)
			for (int k = 0; k < i / 2; ++k) {
				int p = f[j + k], q = (ll)f[j + k + i / 2] * w[k] % mod;
				f[j + k] = (p + q) % mod, f[j + k + i / 2] = (p - q + mod) % mod;
			}
	}
}

poly poly::operator*(const poly& h) const {
	int N = 1;
	while (N < (int)(size() + h.size() - 1)) N <<= 1;
	std::vector<int> f(this->data), g(h.data);
	f.resize(N), g.resize(N);
	rev.resize(N);
	for (int i = 0; i < N; ++i)
		rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? N >> 1 : 0);
	dft_for_module(f, N, 1), dft_for_module(g, N, 1);
	for (int i = 0; i < N; ++i) f[i] = (ll)f[i] * g[i] % mod;
	dft_for_module(f, N, -1), f.resize(size() + h.size() - 1);
	for (int i = 0, inv = qpow(N, mod - 2); i < (int)f.size(); ++i)
		f[i] = (ll)f[i] * inv % mod;
	return f;
}

poly poly::operator*=(const poly& h) { return *this = *this * h; }

poly poly::operator*(const int& h) const {
	std::vector<int> f(this->data);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = (ll)f[i] * h % mod;
	return f;
}

poly poly::operator*=(const int& h) {
	for (int i = 0; i < (int)size(); ++i) data[i] = (ll)data[i] * h % mod;
	return *this;
}

poly poly::operator+(const poly& h) const {
	std::vector<int> f(this->data);
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] + h[i]) % mod;
	return f;
}

poly poly::operator+=(const poly& h) {
	std::vector<int>& f = this->data;
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] + h[i]) % mod;
	return f;
}

poly poly::operator-(const poly& h) const {
	std::vector<int> f(this->data);
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] - h[i] + mod) % mod;
	return f;
}

poly poly::operator-=(const poly& h) {
	std::vector<int>& f = this->data;
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] - h[i] + mod) % mod;
	return f;
}

poly poly::operator<<(const std::size_t& b) const {
	std::vector<int> f(size() + b);
	for (int i = 0; i < (int)size(); ++i) f[i + b] = data[i];
	return f;
}

poly poly::operator<<=(const std::size_t& b) { return *this = (*this) << b; }

poly poly::operator>>(const std::size_t& b) const {
	std::vector<int> f(size() - b);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = data[i + b];
	return f;
}

poly poly::operator>>=(const std::size_t& b) { return *this = (*this) >> b; }

poly poly::operator/(const int& h) const {
	std::vector<int> f(this->data);
	int inv = qpow(h, mod - 2);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = (ll)f[i] * inv % mod;
	return f;
}

poly poly::operator/=(const int& h) {
	int inv = qpow(h, mod - 2);
	for (int i = 0; i < (int)data.size(); ++i) data[i] = (ll)data[i] * inv % mod;
	return *this;
}

poly poly::inv(void) const {
	int N = 1;
	while (N < (int)(size() + size() - 1)) N <<= 1;
	std::vector<int> f(N), g(N), d(this->data);
	d.resize(N), f[0] = qpow(d[0], mod - 2);
	for (int w = 2; w < N; w <<= 1) {
		for (int i = 0; i < w; ++i) g[i] = d[i];
		rev.resize(w << 1);
		for (int i = 0; i < w * 2; ++i)
			rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? w : 0);
		dft_for_module(f, w << 1, 1), dft_for_module(g, w << 1, 1);
		for (int i = 0; i < w * 2; ++i)
			f[i] = (ll)f[i] * (2 + mod - (ll)f[i] * g[i] % mod) % mod;
		dft_for_module(f, w << 1, -1);
		for (int i = 0, inv = qpow(w << 1, mod - 2); i < w; ++i)
			f[i] = (ll)f[i] * inv % mod;
		for (int i = w; i < w * 2; ++i) f[i] = 0;
	}
	f.resize(size());
	return f;
}

poly poly::operator==(const poly& h) const {
	if (size() != h.size()) return 0;
	for (int i = 0; i < (int)size(); ++i)
		if (data[i] != h[i]) return 0;
	return 1;
}

poly poly::operator!=(const poly& h) const {
	if (size() != h.size()) return 1;
	for (int i = 0; i < (int)size(); ++i)
		if (data[i] != h[i]) return 1;
	return 0;
}

poly poly::operator+(const int& h) const {
	poly f(this->data);
	f[0] = (f[0] + h) % mod;
	return f;
}

poly poly::operator+=(const int& h) { return *this = (*this) + h; }

poly poly::inv(const int& h) const {
	poly f(*this);
	f.resize(h);
	return f.inv();
}

int modsqrt(int h, int p = mod) { return 1; }

poly sqrt(const poly& h) {
	int N = 1;
	while (N < (int)(h.size() + h.size() - 1)) N <<= 1;
	poly f(N), g(N), d(h);
	d.resize(N), f[0] = modsqrt(d[0]);
	for (int w = 2; w < N; w <<= 1) {
		g.resize(w);
		for (int i = 0; i < w; ++i) g[i] = d[i];
		f = (f + f.inv(w) * g) / 2;
		f.resize(w);
	}
	f.resize(h.size());
	return f;
}

poly log(const poly& h) {
	poly f(h);
	for (int i = 1; i < (int)f.size(); ++i) f[i - 1] = (ll)f[i] * i % mod;
	f[f.size() - 1] = 0, f = f * h.inv(), f.resize(h.size());
	for (int i = (int)f.size() - 1; i > 0; --i)
		f[i] = (ll)f[i - 1] * qpow(i, mod - 2) % mod;
	f[0] = 0;
	return f;
}

poly exp(const poly& h) {
	int N = 1;
	while (N < (int)(h.size() + h.size() - 1)) N <<= 1;
	poly f(N), g(N), d(h);
	f[0] = 1, d.resize(N);
	for (int w = 2; w < N; w <<= 1) {
		f.resize(w), g.resize(w);
		for (int i = 0; i < w; ++i) g[i] = d[i];
		f = f * (g + 1 - log(f));
		f.resize(w);
	}
	f.resize(h.size());
	return f;
}

struct comp {
	long double x, y;

	comp(long double _x = 0, long double _y = 0) : x(_x), y(_y) {}

	comp operator*(const comp& b) const {
		return comp(x * b.x - y * b.y, x * b.y + y * b.x);
	}

	comp operator+(const comp& b) const { return comp(x + b.x, y + b.y); }

	comp operator-(const comp& b) const { return comp(x - b.x, y - b.y); }

	comp conj(void) { return comp(x, -y); }
};

const int EPS = 1e-9;

template <typename FLOAT_T>
FLOAT_T fabs(const FLOAT_T& x) {
	return x > 0 ? x : -x;
}

template <typename FLOAT_T>
FLOAT_T sin(const FLOAT_T& x, const long double& EPS = 1e-8) {
	FLOAT_T res = 0, delt = x;
	int d = 0;
	while (fabs(delt) > EPS) {
		res += delt, ++d;
		delt *= -x * x / ((2 * d) * (2 * d + 1));
	}
	return res;
}

template <typename FLOAT_T>
FLOAT_T cos(const FLOAT_T& x, const long double& EPS = 1e-8) {
	FLOAT_T res = 0, delt = 1;
	int d = 0;
	while (fabs(delt) > EPS) {
		res += delt, ++d;
		delt *= -x * x / ((2 * d) * (2 * d - 1));
	}
	return res;
}

const long double PI = std::acos((long double)(-1));

void dft_for_complex(std::vector<comp>& f, int n, int b) {
	static std::vector<comp> w;
	w.resize(n);
	for (int i = 0; i < n; ++i)
		if (i < rev[i]) std::swap(f[i], f[rev[i]]);
	for (int i = 2; i <= n; i <<= 1) {
		w[0] = comp(1, 0), w[1] = comp(cos(2 * PI / i), b * sin(2 * PI / i));
		for (int j = 2; j < i / 2; ++j) w[j] = w[j - 1] * w[1];
		for (int j = 0; j < n; j += i)
			for (int k = 0; k < i / 2; ++k) {
				comp p = f[j + k], q = f[j + k + i / 2] * w[k];
				f[j + k] = p + q, f[j + k + i / 2] = p - q;
			}
	}
}

class arbitrary_module_poly {
private:
	std::vector<int> data;

	int construct_element(int D, ll x, ll y, ll z) const {
		x %= mod, y %= mod, z %= mod;
		return ((ll)D * D * x % mod + (ll)D * y % mod + z) % mod;
	}

public:
	int mod;

	arbitrary_module_poly(std::size_t len = std::size_t(0),
		int module_value = 1e9 + 7) {
		mod = module_value;
		data = std::vector<int>(len);
	}

	arbitrary_module_poly(const std::vector<int>& b, int module_value = 1e9 + 7) {
		mod = module_value;
		data = b;
	}

	arbitrary_module_poly(const arbitrary_module_poly& b) {
		mod = b.mod;
		data = b.data;
	}

	void resize(std::size_t len, const int& val = 0) { data.resize(len, val); }

	std::size_t size(void) const { return data.size(); }

	void clear(void) { data.clear(); }
#if __cplusplus >= 201103L
	void shrink_to_fit(void) { data.shrink_to_fit(); }
#endif
	int& operator[](std::size_t b) { return data[b]; }

	const int& operator[](std::size_t b) const { return data[b]; }

	arbitrary_module_poly operator*(const arbitrary_module_poly& h) const;
	arbitrary_module_poly operator*=(const arbitrary_module_poly& h);
	arbitrary_module_poly operator*(const int& h) const;
	arbitrary_module_poly operator*=(const int& h);
	arbitrary_module_poly operator+(const arbitrary_module_poly& h) const;
	arbitrary_module_poly operator+=(const arbitrary_module_poly& h);
	arbitrary_module_poly operator-(const arbitrary_module_poly& h) const;
	arbitrary_module_poly operator-=(const arbitrary_module_poly& h);
	arbitrary_module_poly operator<<(const std::size_t& b) const;
	arbitrary_module_poly operator<<=(const std::size_t& b);
	arbitrary_module_poly operator>>(const std::size_t& b) const;
	arbitrary_module_poly operator>>=(const std::size_t& b);
	arbitrary_module_poly operator/(const int& h) const;
	arbitrary_module_poly operator/=(const int& h);
	arbitrary_module_poly operator==(const arbitrary_module_poly& h) const;
	arbitrary_module_poly operator!=(const arbitrary_module_poly& h) const;
	arbitrary_module_poly inv(void) const;
	arbitrary_module_poly inv(const int& h) const;
	friend arbitrary_module_poly sqrt(const arbitrary_module_poly& h);
	friend arbitrary_module_poly log(const arbitrary_module_poly& h);
};

arbitrary_module_poly arbitrary_module_poly::operator*(
	const arbitrary_module_poly& h) const {
	int N = 1;
	while (N < (int)(size() + h.size() - 1)) N <<= 1;
	std::vector<comp> f(N), g(N), p(N), q(N);
	const int D = std::sqrt(mod);
	for (int i = 0; i < (int)size(); ++i)
		f[i].x = data[i] / D, f[i].y = data[i] % D;
	for (int i = 0; i < (int)h.size(); ++i) g[i].x = h[i] / D, g[i].y = h[i] % D;
	rev.resize(N);
	for (int i = 0; i < N; ++i)
		rev[i] = (rev[i >> 1] >> 1) | (i & 1 ? N >> 1 : 0);
	dft_for_complex(f, N, 1), dft_for_complex(g, N, 1);
	for (int i = 0; i < N; ++i) {
		p[i] = (f[i] + f[(N - i) % N].conj()) * comp(0.50, 0) * g[i];
		q[i] = (f[i] - f[(N - i) % N].conj()) * comp(0, -0.5) * g[i];
	}
	dft_for_complex(p, N, -1), dft_for_complex(q, N, -1);
	std::vector<int> r(size() + h.size() - 1);
	for (int i = 0; i < (int)r.size(); ++i)
		r[i] = construct_element(D, p[i].x / N + 0.5, (p[i].y + q[i].x) / N + 0.5,
			q[i].y / N + 0.5);
	return arbitrary_module_poly(r, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator*=(
	const arbitrary_module_poly& h) {
	return *this = *this * h;
}

arbitrary_module_poly arbitrary_module_poly::operator*(const int& h) const {
	std::vector<int> f(this->data);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = (ll)f[i] * h % mod;
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator*=(const int& h) {
	for (int i = 0; i < (int)size(); ++i) data[i] = (ll)data[i] * h % mod;
	return *this;
}

arbitrary_module_poly arbitrary_module_poly::operator+(
	const arbitrary_module_poly& h) const {
	std::vector<int> f(this->data);
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] + h[i]) % mod;
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator+=(
	const arbitrary_module_poly& h) {
	if (size() < h.size()) resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) data[i] = (data[i] + h[i]) % mod;
	return *this;
}

arbitrary_module_poly arbitrary_module_poly::operator-(
	const arbitrary_module_poly& h) const {
	std::vector<int> f(this->data);
	if (f.size() < h.size()) f.resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i) f[i] = (f[i] + mod - h[i]) % mod;
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator-=(
	const arbitrary_module_poly& h) {
	if (size() < h.size()) resize(h.size());
	for (int i = 0; i < (int)h.size(); ++i)
		data[i] = (data[i] + mod - h[i]) % mod;
	return *this;
}

arbitrary_module_poly arbitrary_module_poly::operator<<(
	const std::size_t& b) const {
	std::vector<int> f(size() + b);
	for (int i = 0; i < (int)size(); ++i) f[i + b] = data[i];
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator<<=(const std::size_t& b) {
	return *this = (*this) << b;
}

arbitrary_module_poly arbitrary_module_poly::operator>>(
	const std::size_t& b) const {
	std::vector<int> f(size() - b);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = data[i + b];
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator>>=(const std::size_t& b) {
	return *this = (*this) >> b;
}

arbitrary_module_poly arbitrary_module_poly::inv(void) const {
	int N = 1;
	while (N < (int)(size() + size() - 1)) N <<= 1;
	arbitrary_module_poly f(1, mod), g(N, mod), h(*this), f2(1, mod);
	f[0] = qpow(data[0], mod - 2, mod), h.resize(N), f2[0] = 2;
	for (int w = 2; w < N; w <<= 1) {
		g.resize(w);
		for (int i = 0; i < w; ++i) g[i] = h[i];
		f = f * (f * g - f2) * (mod - 1);
		f.resize(w);
	}
	f.resize(size());
	return f;
}

arbitrary_module_poly arbitrary_module_poly::inv(const int& h) const {
	arbitrary_module_poly f(*this);
	f.resize(h);
	return f.inv();
}

arbitrary_module_poly arbitrary_module_poly::operator/(const int& h) const {
	int inv = qpow(h, mod - 2, mod);
	std::vector<int> f(this->data);
	for (int i = 0; i < (int)f.size(); ++i) f[i] = (ll)f[i] * inv % mod;
	return arbitrary_module_poly(f, mod);
}

arbitrary_module_poly arbitrary_module_poly::operator/=(const int& h) {
	int inv = qpow(h, mod - 2, mod);
	for (int i = 0; i < (int)size(); ++i) data[i] = (ll)data[i] * inv % mod;
	return *this;
}

arbitrary_module_poly arbitrary_module_poly::operator==(
	const arbitrary_module_poly& h) const {
	if (size() != h.size() || mod != h.mod) return 0;
	for (int i = 0; i < (int)size(); ++i)
		if (data[i] != h[i]) return 0;
	return 1;
}

arbitrary_module_poly arbitrary_module_poly::operator!=(
	const arbitrary_module_poly& h) const {
	if (size() != h.size() || mod != h.mod) return 1;
	for (int i = 0; i < (int)size(); ++i)
		if (data[i] != h[i]) return 1;
	return 0;
}

arbitrary_module_poly sqrt(const arbitrary_module_poly& h) {
	int N = 1;
	while (N < (int)(h.size() + h.size() - 1)) N <<= 1;
	arbitrary_module_poly f(1, mod), g(N, mod), d(h);
	f[0] = modsqrt(h[0], mod), d.resize(N);
	for (int w = 2; w < N; w <<= 1) {
		g.resize(w);
		for (int i = 0; i < w; ++i) g[i] = d[i];
		f = (f + f.inv(w) * g) / 2;
		f.resize(w);
	}
	f.resize(h.size());
	return f;
}

arbitrary_module_poly log(const arbitrary_module_poly& h) {
	arbitrary_module_poly f(h);
	for (int i = 1; i < (int)f.size(); ++i) f[i - 1] = (ll)f[i] * i % f.mod;
	f[f.size() - 1] = 0, f = f * h.inv(), f.resize(h.size());
	for (int i = (int)f.size() - 1; i > 0; --i)
		f[i] = (ll)f[i - 1] * qpow(i, f.mod - 2, f.mod) % f.mod;
	f[0] = 0;
	return f;
}

using m_poly = arbitrary_module_poly;

struct custom_hash
{
	static uint64_t splitmix64(uint64_t x) {
		x ^= x << 13;
		x ^= x >> 7;
		x ^= x << 17;
		return x;
	}
	size_t operator () (uint64_t x) const {
		static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); // 时间戳
		return splitmix64(x + FIXED_RANDOM);
	}
};

constexpr int M = 5;

struct Matrix
{
	array<array<int, M>, M> v;
	Matrix()
	{
		for (int i = 0; i < M; i++) v[i].fill(0);
	}
	void CLEAR()
	{
		for (int i = 0; i < M; i++) v[i].fill(0);
	}
	friend Matrix operator*(const Matrix& a, const Matrix& b) noexcept
	{
		Matrix c;
		for (int i = 0; i < M; i++)
		{
			for (int j = 0; j < M; j++)
			{
				for (int k = 0; k < M; k++)
				{
					c.v[i][j] = (c.v[i][j] + 1ll * a.v[i][k] * b.v[k][j] % MOD) % MOD;
				}
			}
		}
		return c;
	}
};

/*
struct FastMod
{
	using ull=unsigned long long;
	using L=__int128;
	ull b,m;
	FastMod(ull b):b(b),m(ull((L(1)<<64)/b)){}
	ull reduce(ull a)// return a mod b
	{
		ull q=(ull)((L(m)*a)>>64),r=a-q*b;
		return r>=b?r-b:r;
	}
}F(330); // change the MOD*/

class Union_Find
{
public:
	array<int, N> fa;
	void Init()
	{
		for (int i = 0; i < N; i++) fa[i] = i;
	}
	int find(int u)
	{
		return (fa[u] == u ? u : fa[u] = find(fa[u]));
	}
	void merge(int u, int v)
	{
		fa[find(u)] = find(v);
	}
}uf;

struct tws
{
	ll v1, v2;
	tws() = default;
	tws(ll x, ll y) :v1(x), v2(y) {}
	bool operator==(const tws x) const
	{
		return (v1 == x.v1 && v2 == x.v2);
	}
	bool operator!=(const tws x) const
	{
		return (v1 != x.v1 || v2 != x.v2);
	}
	tws operator+(const ll x)
	{
		return tws((v1 + x) % HSMOD, (v2 + x) % HSMOD2);
	}
	tws operator-(const ll x)
	{
		return tws((v1 - x + HSMOD) % HSMOD, (v2 - x + HSMOD2) % HSMOD2);
	}
	tws operator-(const tws x)
	{
		return tws((v1 - x.v1 + HSMOD) % HSMOD, (v2 - x.v2 + HSMOD2) % HSMOD2);
	}
	tws operator*(const ll x)
	{
		return tws((v1 * x) % HSMOD, (v2 * x) % HSMOD2);
	}
	tws operator+(const tws x)
	{
		return tws((v1 + x.v1) % HSMOD, (v2 + x.v2) % HSMOD2);
	}
	tws operator*(const tws x)
	{
		return tws((v1 * x.v1) % HSMOD, (v2 * x.v2) % HSMOD2);
	}
};

long long fspow(long long a, long long b)
{
	long long res = 1ll, base = a;
	while (b)
	{
		if (b & 1ll) res = res * base % MOD;
		base = base * base % MOD;
		b >>= 1ll;
	}
	return res;
}

double dist(double X0, double Y0, double X1, double Y1)
{
	return sqrt((X0 - X1) * (X0 - X1) + (Y0 - Y1) * (Y0 - Y1));
}

inline bool isprime(int x)
{
	if (x == 1) return 0;
	for (int i = 2; 1ll * i * i <= x; i++) if (x % i == 0) return 0;
	return 1;
}

int t, n;
ll m;
array<int, N> b;

int main()
{
	//freopen("*.in", "r", stdin);
	//freopen("*.out", "w", stdout);
	ios::sync_with_stdio(0), cin.tie(0);
	cin >> t;
	while (t--)
	{
		cin >> n >> m;
		int ec = m / n;
		for (int i = 1; i <= n; i++)
		{
			cin >> b[i];
			b[i] -= ec;
		}
		poly ve;
		ve.resize(2 * n + 1);
		for (int i = 1; i <= n; i++) ve[b[i] + n]++;
		poly res, base = ve;
		res.resize(2 * n + 1);
		res[n] = 1;
		int x = n;
		while (x)
		{
			if (x & 1)
			{
				res = res * base;
				poly nr;
				nr.resize(2 * n + 1);
				for (int i = 0; i < res.size(); i++)
				{
					int nj = i - 2 * n;
					if (nj >= -n && nj <= n) nr[nj + n] += res[i];
				}
				res = nr;
			}
			base = base * base;
			poly nr;
			nr.resize(2 * n + 1);
			for (int i = 0; i < base.size(); i++)
			{
				int nj = i - 2 * n;
				if (nj >= -n && nj <= n) nr[nj + n] += base[i];
			}
			base = nr;
			x >>= 1;
		}
		cout << (res[n + m % n] ? "Yes\n" : "No\n");
	}
	return 0;
}

/*
1
5 25
0 1 2 3 4
*/

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
5 25
0 0 0 0 5
5 11
4 4 4 5 5
5 0
1 2 3 4 5
5 25
0 1 2 3 4

output:

Yes
No
No
No

result:

ok 4 token(s): yes count is 1, no count is 3

Test #2:

score: 0
Accepted
time: 30ms
memory: 3712kb

input:

1314
1 0
0
1 0
1
1 1
0
1 1
1
2 0
0 0
2 0
0 1
2 0
0 2
2 0
1 0
2 0
1 1
2 0
1 2
2 0
2 0
2 0
2 1
2 0
2 2
2 1
0 0
2 1
0 1
2 1
0 2
2 1
1 0
2 1
1 1
2 1
1 2
2 1
2 0
2 1
2 1
2 1
2 2
2 2
0 0
2 2
0 1
2 2
0 2
2 2
1 0
2 2
1 1
2 2
1 2
2 2
2 0
2 2
2 1
2 2
2 2
2 3
0 0
2 3
0 1
2 3
0 2
2 3
1 0
2 3
1 1
2 3
1 2
2 3
2 0...

output:

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

result:

ok 1314 token(s): yes count is 732, no count is 582

Test #3:

score: 0
Accepted
time: 267ms
memory: 5820kb

input:

10000
4 1
0 0 0 0
4 1
0 0 0 1
4 1
0 0 0 2
4 1
0 0 0 3
4 1
0 0 0 4
4 1
0 0 1 0
4 1
0 0 1 1
4 1
0 0 1 2
4 1
0 0 1 3
4 1
0 0 1 4
4 1
0 0 2 0
4 1
0 0 2 1
4 1
0 0 2 2
4 1
0 0 2 3
4 1
0 0 2 4
4 1
0 0 3 0
4 1
0 0 3 1
4 1
0 0 3 2
4 1
0 0 3 3
4 1
0 0 3 4
4 1
0 0 4 0
4 1
0 0 4 1
4 1
0 0 4 2
4 1
0 0 4 3
4 1
0 ...

output:

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

result:

ok 10000 token(s): yes count is 6168, no count is 3832

Test #4:

score: 0
Accepted
time: 54ms
memory: 3712kb

input:

1612
5 0
0 0 0 0 0
5 0
1 1 1 1 1
5 0
0 1 1 1 1
5 0
2 2 2 2 2
5 0
0 2 2 2 2
5 0
1 2 2 2 2
5 0
0 1 2 2 2
5 0
3 3 3 3 3
5 0
0 3 3 3 3
5 0
1 3 3 3 3
5 0
0 1 3 3 3
5 0
2 3 3 3 3
5 0
0 2 3 3 3
5 0
1 2 3 3 3
5 0
0 1 2 3 3
5 0
4 4 4 4 4
5 0
0 4 4 4 4
5 0
1 4 4 4 4
5 0
0 1 4 4 4
5 0
2 4 4 4 4
5 0
0 2 4 4 4
5...

output:

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

result:

ok 1612 token(s): yes count is 864, no count is 748

Test #5:

score: 0
Accepted
time: 157ms
memory: 3584kb

input:

4662
6 0
0 0 0 0 0 0
6 0
1 1 1 1 1 1
6 0
0 1 1 1 1 1
6 0
2 2 2 2 2 2
6 0
0 2 2 2 2 2
6 0
1 2 2 2 2 2
6 0
0 1 2 2 2 2
6 0
3 3 3 3 3 3
6 0
0 3 3 3 3 3
6 0
1 3 3 3 3 3
6 0
0 1 3 3 3 3
6 0
2 3 3 3 3 3
6 0
0 2 3 3 3 3
6 0
1 2 3 3 3 3
6 0
0 1 2 3 3 3
6 0
4 4 4 4 4 4
6 0
0 4 4 4 4 4
6 0
1 4 4 4 4 4
6 0
0 1...

output:

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

result:

ok 4662 token(s): yes count is 2730, no count is 1932

Test #6:

score: 0
Accepted
time: 2671ms
memory: 17368kb

input:

1
100000 9999999999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 9...

output:

No

result:

ok NO

Test #7:

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

input:

10000
10 3
5 9 0 1 1 10 0 6 3 2
10 22
5 7 0 0 10 5 6 2 7 8
10 67
7 7 7 4 0 8 10 10 5 10
10 56
1 6 5 3 0 7 3 5 8 9
10 43
4 4 0 3 3 4 1 3 0 0
10 91
0 6 6 9 2 3 10 8 6 0
10 2
5 1 4 0 10 9 2 3 2 9
10 73
8 5 6 10 10 2 8 10 4 8
10 36
10 2 5 1 3 6 7 3 7 10
10 90
3 4 5 10 7 7 3 5 1 6
10 20
9 4 3 1 1 6 8 1 5...

output:

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

result:

ok 10000 token(s): yes count is 8663, no count is 1337

Test #8:

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

input:

1000
100 8921
54 82 23 19 31 95 88 97 10 26 61 50 49 10 4 29 90 60 20 73 45 95 44 96 47 20 24 39 15 35 78 24 78 60 100 36 63 53 70 42 61 78 38 64 0 38 80 99 9 77 68 84 71 75 63 57 38 32 1 74 75 53 0 18 74 80 79 49 31 90 61 81 28 16 72 81 58 76 33 68 76 15 96 65 59 27 0 75 47 85 8 27 55 36 28 49 33 6...

output:

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

result:

ok 1000 token(s): yes count is 983, no count is 17

Test #9:

score: 0
Accepted
time: 959ms
memory: 3840kb

input:

100
1000 822190
824 147 580 931 944 411 499 248 16 807 817 933 344 801 776 172 736 814 298 944 324 901 146 149 653 850 431 224 670 778 918 957 418 847 787 256 313 675 189 372 527 630 518 214 430 962 549 142 419 388 461 227 471 337 436 172 941 944 785 49 630 943 896 819 188 976 230 896 638 30 935 787...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
...

result:

ok 100 token(s): yes count is 100, no count is 0

Test #10:

score: 0
Accepted
time: 2345ms
memory: 7224kb

input:

10
10000 36452743
3219 2049 8923 2370 670 7258 1630 4309 5307 7756 4017 7973 4652 3806 8536 3319 6721 8996 9923 4793 944 7181 1293 6733 5461 9146 5187 3302 2405 8747 9377 2121 5977 3321 3013 1359 8648 5541 3697 4971 7303 7762 2025 695 7336 9420 6617 1496 1680 3299 8682 7302 5303 6835 8207 6786 7868 ...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #11:

score: 0
Accepted
time: 2680ms
memory: 17344kb

input:

1
100000 7132922381
65268 98569 49569 42441 31688 75146 41758 82634 22278 88725 35755 66423 15583 10748 68319 15051 44705 17431 24789 61906 39753 44681 94285 31076 91405 10918 99048 31599 1684 65254 25364 73214 82162 76373 68973 12878 18037 43668 53394 65187 77671 17544 99819 82666 83485 20807 71773...

output:

Yes

result:

ok YES

Test #12:

score: 0
Accepted
time: 657ms
memory: 3584kb

input:

1000
100 1132
81 98 41 61 59 50 62 42 59 68 59 74 100 75 29 4 53 38 21 95 77 46 92 93 26 29 41 85 58 40 27 99 9 85 10 24 46 19 17 51 47 15 14 2 24 11 5 79 7 94 97 62 9 83 53 99 55 37 50 1 82 42 41 28 48 53 24 64 61 40 34 51 41 67 82 86 5 74 38 59 96 0 96 73 31 15 90 32 82 41 97 78 57 42 53 46 14 16 ...

output:

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

result:

ok 1000 token(s): yes count is 670, no count is 330

Test #13:

score: 0
Accepted
time: 2347ms
memory: 5200kb

input:

10
10000 96020464
4552 8968 5192 360 6728 6496 4760 336 2520 2176 6544 6200 2064 1016 7312 7264 136 5832 6344 3064 3064 9712 8648 7000 80 576 2152 8944 2208 9176 7224 1704 2272 8096 7944 5664 9848 3232 9376 4200 6824 8872 8336 9728 4216 4488 5248 4816 1352 3208 4104 5344 9432 6672 1992 2520 4016 248...

output:

Yes
Yes
No
No
Yes
Yes
No
No
No
Yes

result:

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

Test #14:

score: 0
Accepted
time: 2660ms
memory: 19084kb

input:

1
100000 178306281
49588 24794 99176 0 74382 49588 49588 74382 74382 49588 99176 99176 24794 74382 49588 0 0 49588 99176 24794 24794 0 74382 74382 74382 74382 24794 0 74382 49588 49588 49588 99176 74382 0 49588 99176 24794 24794 24794 49588 74382 99176 0 74382 49588 74382 49588 99176 99176 0 74382 7...

output:

No

result:

ok NO

Test #15:

score: 0
Accepted
time: 2681ms
memory: 19236kb

input:

1
100000 1557960515
83410 32925 26340 98775 96580 89995 50485 19755 85605 46095 98775 10975 17560 92190 48290 92190 96580 24145 59265 0 35120 59265 68045 2195 43900 28535 35120 70240 48290 54875 26340 26340 92190 2195 83410 79020 89995 94385 61460 30730 59265 8780 37315 76825 81215 76825 92190 72435...

output:

Yes

result:

ok YES

Test #16:

score: 0
Accepted
time: 2684ms
memory: 17368kb

input:

1
100000 683435046
63546 42534 53499 18258 51714 76398 54519 11475 67830 99144 62220 52326 13719 56355 50388 62934 52224 35190 11730 867 71757 20961 9639 24174 69513 14637 23613 11169 34782 93738 72420 58242 25806 58038 17748 47073 93177 94809 97104 96798 68850 10812 64923 88791 57375 44676 62730 28...

output:

No

result:

ok NO

Test #17:

score: 0
Accepted
time: 2663ms
memory: 17368kb

input:

1
100000 4237125909
92100 88908 42480 31656 75660 9876 2280 51072 4584 45660 55536 62532 39432 15840 86832 86124 97068 36432 85632 6840 76656 4212 86184 11496 99336 56148 6372 8040 39960 85620 55392 58212 6684 1812 94176 52392 2400 41520 86940 68892 90888 1092 20028 76656 86676 23820 32388 16596 399...

output:

No

result:

ok NO

Test #18:

score: 0
Accepted
time: 2680ms
memory: 17244kb

input:

1
100000 7060472559
21072 80337 60582 98775 88239 18438 22389 56631 55314 67167 28974 81654 96141 65850 52680 46095 5268 1317 10536 61899 21072 57948 1317 51363 11853 73752 86922 31608 3951 79020 40827 39510 86922 31608 68484 27657 63216 11853 1317 67167 51363 34242 89556 17121 5268 44778 76386 9614...

output:

Yes

result:

ok YES

Test #19:

score: 0
Accepted
time: 654ms
memory: 3840kb

input:

1000
100 3950
56 68 81 56 81 56 81 81 56 81 81 81 56 56 68 68 81 81 81 56 56 68 68 68 81 68 81 68 56 68 68 56 81 81 81 81 68 56 56 81 56 68 56 56 81 56 81 56 68 68 81 81 68 56 56 68 68 81 68 68 81 68 81 81 68 56 56 68 81 56 68 56 81 68 68 68 56 68 81 81 68 81 56 68 68 56 56 81 81 81 81 56 56 56 56 8...

output:

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

result:

ok 1000 token(s): yes count is 597, no count is 403

Test #20:

score: 0
Accepted
time: 2348ms
memory: 5208kb

input:

10
10000 34796587
1660 9050 6984 8300 4980 6984 9050 8300 4980 8300 6984 6984 9050 6984 9050 8300 9050 9050 9050 6984 6984 8300 1660 9050 6640 1660 6984 9960 6984 9050 4980 9050 9050 1660 6984 3320 6984 6984 9050 1660 9050 6984 3320 6984 3320 3320 3320 6984 3320 6984 4980 9050 8300 8300 6984 6984 66...

output:

No
No
Yes
No
No
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 6, no count is 4

Test #21:

score: 0
Accepted
time: 2674ms
memory: 17372kb

input:

1
100000 9147040951
44280 77118 92394 77118 92394 22140 77118 88560 22140 77118 92394 92394 77118 88560 66420 22140 92394 88560 22140 92394 92394 77118 92394 66420 77118 88560 77118 77118 77118 22140 88560 66420 22140 77118 88560 77118 77118 92394 77118 88560 77118 77118 92394 77118 92394 92394 7711...

output:

No

result:

ok NO

Test #22:

score: 0
Accepted
time: 2657ms
memory: 17372kb

input:

1
100000 6448741768
96237 64834 96237 64834 96237 46792 96237 46792 96237 96237 96237 64834 96237 96237 64834 64834 96237 96237 64834 96237 96237 64834 70188 64834 64834 64834 96237 64834 64834 96237 46792 64834 96237 96237 64834 93584 96237 96237 23396 96237 93584 64834 70188 64834 23396 96237 9623...

output:

Yes

result:

ok YES

Test #23:

score: 0
Accepted
time: 2673ms
memory: 17368kb

input:

1
100000 3750442585
78624 14742 70642 35321 35321 63882 70642 67114 67114 78624 70642 49140 39312 39312 9828 70642 63882 70642 67114 35321 67114 35321 67114 67114 70642 67114 67114 67114 67114 35321 67114 9828 34398 67114 39312 67114 67114 35321 67114 70642 78624 58968 70642 35321 93366 35321 67114 ...

output:

Yes

result:

ok YES

Test #24:

score: 0
Accepted
time: 2662ms
memory: 17264kb

input:

1
100000 6757176107
63511 62086 63511 45048 45048 90096 62086 63511 62086 45048 62086 90096 63511 90096 62086 63511 62086 63511 62086 90096 62086 63511 62086 63511 45048 90096 90096 62086 63511 63511 90096 90096 45048 63511 62086 45048 63511 62086 63511 90096 45048 45048 63511 62086 45048 62086 6351...

output:

Yes

result:

ok YES

Test #25:

score: 0
Accepted
time: 2673ms
memory: 17288kb

input:

1
100000 8353844220
67355 87742 67355 87742 67355 87742 67355 67355 67355 87742 98133 87742 67355 87742 67355 98133 32711 65422 87742 98133 67355 87742 87742 67355 67355 32711 32711 67355 32711 67355 87742 65422 87742 87742 87742 67355 67355 67355 87742 87742 67355 87742 65422 67355 98133 87742 9813...

output:

Yes

result:

ok YES

Test #26:

score: 0
Accepted
time: 657ms
memory: 3584kb

input:

1000
100 3900
82 81 82 61 28 84 61 61 61 61 61 61 14 14 42 70 61 61 81 82 82 61 81 61 82 81 82 81 81 81 42 82 82 61 82 82 84 56 81 70 14 56 81 61 82 61 61 61 56 28 81 61 61 81 70 82 82 81 61 81 84 81 61 61 81 61 14 61 61 42 82 70 82 61 82 98 81 14 81 61 98 81 81 81 82 82 82 82 61 82 81 61 61 81 61 1...

output:

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

result:

ok 1000 token(s): yes count is 717, no count is 283

Test #27:

score: 0
Accepted
time: 2346ms
memory: 5204kb

input:

10
10000 71009048
8263 2228 957 7527 7527 8263 8263 7527 7527 8263 7527 8912 1044 6960 8263 7527 957 7527 7527 8263 3741 8263 2175 8263 8912 3219 7830 8263 7527 8912 8263 7527 4456 8263 8263 4456 7527 2228 5481 6684 7527 4437 8263 1914 4456 696 4456 4456 6684 8263 8912 2228 6684 2228 8912 3915 9657 ...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #28:

score: 0
Accepted
time: 2659ms
memory: 19280kb

input:

1
100000 3053281210
59799 35130 28056 28056 4684 63126 21381 63126 7014 42762 35130 63234 42762 91182 99665 63126 21381 79732 42762 16394 64143 19933 19933 64143 16394 35070 63234 21042 39866 42762 81970 85524 70140 21381 39866 49098 70140 21042 19933 35070 16394 42156 79732 59799 19933 39866 56112 ...

output:

Yes

result:

ok YES

Test #29:

score: 0
Accepted
time: 2689ms
memory: 17328kb

input:

1
100000 3336945729
86974 86974 86974 79453 86974 86974 64186 79453 79453 64186 64186 81839 79453 79453 86974 64186 64186 64186 64186 79453 64186 64186 86974 64186 64186 79453 79453 79453 81839 79453 81839 79453 64186 64186 64186 81839 81839 79453 86974 64186 81839 64186 64186 79453 79453 64186 6418...

output:

No

result:

ok NO

Test #30:

score: 0
Accepted
time: 2661ms
memory: 19192kb

input:

1
100000 5030675656
41846 62778 72765 64908 20923 73241 41846 64908 64908 20926 20923 83692 20923 20923 73241 73241 31389 10463 41846 73241 83692 62769 72765 72765 72765 20923 52315 72765 72765 64908 72765 62778 41846 64908 64908 41846 64908 41846 62769 72765 64908 64908 41846 62769 64908 72765 4185...

output:

Yes

result:

ok YES

Test #31:

score: 0
Accepted
time: 2662ms
memory: 17368kb

input:

1
100000 5314340175
49534 99068 91983 24767 41730 99068 49534 67189 91983 91983 41730 49534 24767 83460 91983 67189 49534 83460 83460 91983 91983 91983 67189 67189 41730 67189 67189 99068 67189 91983 74301 91983 91983 67189 91983 91983 83460 67189 67189 67189 83460 67189 24767 41730 83460 99068 4173...

output:

Yes

result:

ok YES

Test #32:

score: 0
Accepted
time: 2679ms
memory: 17372kb

input:

1
100000 5598004693
85830 73501 73501 59389 98820 28610 59389 59389 57220 59292 9882 59389 79056 85830 73501 57220 85830 73501 28610 59389 28610 73501 73501 57220 73501 59389 19764 29646 73501 39528 59389 59389 59292 59292 59389 59389 85830 85830 73501 59389 73501 73501 73501 19764 57220 28610 73501...

output:

Yes

result:

ok YES

Test #33:

score: 0
Accepted
time: 655ms
memory: 3712kb

input:

1000
100 2639
72 36 81 78 65 81 78 26 74 93 54 36 72 72 65 74 52 51 78 78 52 74 52 65 90 21 72 6 65 81 65 52 74 27 74 65 65 36 99 84 65 65 74 45 74 48 65 65 26 26 74 36 52 74 65 36 65 51 65 65 63 65 74 78 65 65 65 36 78 36 9 74 21 74 3 26 78 78 57 78 65 26 74 65 74 30 74 30 74 36 36 65 72 26 36 74 7...

output:

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

result:

ok 1000 token(s): yes count is 782, no count is 218

Test #34:

score: 0
Accepted
time: 2351ms
memory: 5208kb

input:

10
10000 46764200
2080 8592 8851 4520 8851 8958 2260 8851 6780 2260 6240 8958 8851 8851 8958 8958 8958 8851 8958 6780 2260 5728 8851 2864 8958 8958 4520 8320 8958 5728 6780 8958 8851 8958 8851 8851 8958 2080 9040 8958 8851 5728 2260 8851 2864 2864 9040 6240 8320 2080 4520 4160 8592 8958 8958 8958 28...

output:

Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 8, no count is 2

Test #35:

score: 0
Accepted
time: 2669ms
memory: 17368kb

input:

1
100000 3670847180
93413 93413 89112 50359 50359 89112 89112 89112 44556 33995 89112 44556 50359 50359 93413 33995 89112 20473 44556 81892 40946 61419 89112 93413 44556 81892 44556 40946 44556 40946 93413 93413 61419 40946 44556 81892 61419 44556 81892 50359 81892 89112 93413 89112 50359 20473 5035...

output:

Yes

result:

ok YES

Test #36:

score: 0
Accepted
time: 2670ms
memory: 17364kb

input:

1
100000 4273352429
87350 92860 94083 94083 87350 9114 46430 91789 87350 91789 94083 87350 18228 23215 94083 94083 45570 54684 91789 91140 87350 94083 92860 18228 91789 91789 91789 91140 94083 69645 87350 91789 23215 36456 94083 87350 87350 82026 94083 94083 69645 69645 94083 87350 94083 87350 91140...

output:

Yes

result:

ok YES

Test #37:

score: 0
Accepted
time: 2664ms
memory: 17368kb

input:

1
100000 551813197
16527 89561 87049 82635 75601 75601 95632 89561 95632 95632 75601 87049 95632 87049 49581 87049 95632 89561 95632 89561 87049 87049 49581 16527 95632 49581 75601 75601 82635 33054 89561 99162 75601 95632 33054 89561 66108 87049 75601 75601 49581 95632 89561 89561 95632 75601 89561...

output:

No

result:

ok NO

Test #38:

score: 0
Accepted
time: 2677ms
memory: 17368kb

input:

1
100000 6830273966
64983 69432 69432 91771 85493 69432 85493 97532 34716 64983 69432 64983 64983 85493 91771 97532 91771 97532 64983 91771 34716 85493 91771 85493 91771 64983 91771 64983 69432 64983 85493 91771 91771 64983 97532 34716 69432 64983 34716 91771 97532 91771 69432 64983 34716 85493 6498...

output:

Yes

result:

ok YES

Test #39:

score: 0
Accepted
time: 2678ms
memory: 17368kb

input:

1
100000 3108734735
56848 71060 3151 71060 28424 42636 54352 78775 40764 56848 97681 14212 23779 93982 93982 6302 47265 93982 76750 56848 99484 93982 50955 93982 16985 14212 47558 92100 14212 20382 28424 46050 47558 6302 71060 54352 37367 99484 44161 93982 93982 93982 99484 98513 42636 78775 28424 9...

output:

Yes

result:

ok YES

Test #40:

score: 0
Accepted
time: 657ms
memory: 3840kb

input:

1000
100 3070
65 65 82 52 94 52 78 47 75 44 44 94 94 72 65 44 65 44 82 75 78 65 82 94 94 47 70 44 75 72 44 75 70 70 75 82 70 44 65 82 70 78 65 88 82 82 72 75 94 65 82 82 65 82 26 44 75 94 88 88 70 70 75 72 82 70 70 52 65 82 47 44 52 52 65 65 70 44 88 44 94 72 44 82 82 75 52 72 75 65 65 65 70 26 70 6...

output:

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

result:

ok 1000 token(s): yes count is 865, no count is 135

Test #41:

score: 0
Accepted
time: 2349ms
memory: 5096kb

input:

10
10000 27471652
7471 7471 7463 5189 7463 3895 7666 7471 8356 8036 5189 7471 7463 5189 7463 3895 6912 5189 3895 3833 7471 7705 4018 8356 2682 7471 7471 7471 2682 7471 7471 5189 7705 7705 3833 7666 7471 5189 7471 8356 7790 7471 5364 7463 3833 7463 3895 5189 7463 7463 8356 8356 3895 7463 8046 7463 74...

output:

Yes
Yes
No
No
No
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 7, no count is 3

Test #42:

score: 0
Accepted
time: 2675ms
memory: 17364kb

input:

1
100000 6012264040
87426 73945 92694 73945 41241 65243 73882 92694 72072 82101 41241 72072 98535 72072 92694 82101 73882 65243 98535 92694 73882 73945 73882 92694 73945 73882 98535 65243 41241 88960 88960 65243 82101 88960 88960 82101 65243 88960 73945 72072 82101 98535 65243 82101 72072 87426 9853...

output:

Yes

result:

ok YES

Test #43:

score: 0
Accepted
time: 2712ms
memory: 17372kb

input:

1
100000 9702866868
42810 30794 92094 41664 72690 40550 92094 92094 97935 29076 92382 29806 71989 92382 83969 30794 81100 97935 92094 2129 65290 30794 92094 29076 65290 42810 83969 71989 71989 19161 92382 40451 53225 58152 41664 92094 61588 71989 30794 83969 43614 40550 41664 71989 32645 92382 92094...

output:

Yes

result:

ok YES

Test #44:

score: 0
Accepted
time: 2676ms
memory: 17368kb

input:

1
100000 6050965682
94443 68174 95227 29234 94443 57005 57005 99500 57005 95227 68174 79600 59700 58468 90636 90636 68174 57005 87702 87702 94443 62542 19900 29234 59700 94443 59289 59289 62542 34087 68174 19900 90636 90636 57005 87702 90636 54418 95227 57005 95227 95227 57005 95227 90636 59289 5700...

output:

Yes

result:

ok YES

Test #45:

score: 0
Accepted
time: 2712ms
memory: 17368kb

input:

1
100000 8331503100
88158 87211 92550 47119 64232 87467 85933 54036 92550 47119 88158 92550 87467 79212 39606 87211 88158 64232 87211 94238 94238 92550 45030 85933 92550 88158 85933 85933 87467 44079 92550 39258 39606 87211 47119 87467 45030 79212 78516 63042 87467 87211 85933 87211 47119 64232 6423...

output:

Yes

result:

ok YES

Test #46:

score: 0
Accepted
time: 2669ms
memory: 17348kb

input:

1
100000 384634618
28989 66254 66254 96786 86584 75456 13396 37728 91692 84523 43292 86967 75062 98114 37728 84523 60282 98114 75456 84523 90012 84523 86967 98114 75062 75062 50304 75062 40752 84523 84523 75010 90012 66254 25470 98114 30564 50304 87074 84523 66254 13396 15282 30564 87074 75062 86967...

output:

No

result:

ok NO

Test #47:

score: 0
Accepted
time: 657ms
memory: 3712kb

input:

1000
100 9189
14 78 19 90 38 1 77 65 72 39 56 77 57 57 56 24 24 83 90 39 57 66 77 83 65 65 63 57 65 78 83 72 72 63 22 96 72 56 83 63 63 78 98 45 72 83 72 99 56 72 78 84 72 65 77 53 95 57 63 56 72 78 39 78 77 77 65 41 83 56 72 72 45 90 77 77 38 65 45 77 56 56 24 56 56 77 44 63 77 56 53 63 19 55 53 53...

output:

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

result:

ok 1000 token(s): yes count is 884, no count is 116

Test #48:

score: 0
Accepted
time: 959ms
memory: 3840kb

input:

100
1000 68229
910 854 632 651 854 606 806 578 607 768 562 936 333 632 491 909 658 607 74 562 558 854 557 592 234 607 987 632 578 578 303 768 318 295 512 666 885 407 987 557 491 666 372 481 185 234 885 578 651 468 806 512 742 632 854 854 909 740 987 666 930 562 518 590 372 695 658 512 265 606 256 22...

output:

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

result:

ok 100 token(s): yes count is 98, no count is 2

Test #49:

score: 0
Accepted
time: 2364ms
memory: 5204kb

input:

10
10000 23740247
2080 3731 5200 1709 4340 782 6862 7632 7800 6888 8216 3431 3910 8322 6862 6883 7092 9343 8322 8322 7632 9343 6883 8322 8192 7380 6807 8322 8141 6883 4692 1116 8274 3431 8141 7038 8320 4340 7595 3255 4160 7800 632 5580 6883 8545 2346 3431 5580 3792 6862 3431 5127 9343 8704 6836 8141...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #50:

score: 0
Accepted
time: 2672ms
memory: 19144kb

input:

1
100000 9341510855
72341 90928 96568 43176 72341 66641 89367 28119 81316 92605 14392 44864 96568 37474 32845 57190 66641 86403 91151 57746 44289 9373 66641 95018 90928 57190 66641 57190 67825 28801 19176 43176 57746 43146 57602 18737 73815 28801 91151 59574 47509 91151 57190 92605 71910 89367 72341...

output:

Yes

result:

ok YES

Test #51:

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

input:

1000
100 6809
78 92 84 84 98 73 96 31 84 91 98 34 96 46 99 56 84 42 44 58 66 41 79 24 97 63 11 66 70 33 48 82 56 37 61 37 81 64 31 100 93 51 31 72 91 91 90 59 68 37 90 21 64 96 87 51 74 26 42 16 66 37 98 39 48 86 36 99 92 73 11 20 84 79 80 97 96 99 51 72 43 98 31 72 74 72 84 84 46 41 53 6 80 79 99 8...

output:

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

result:

ok 1000 token(s): yes count is 947, no count is 53

Test #52:

score: 0
Accepted
time: 958ms
memory: 3840kb

input:

100
1000 894860
140 554 282 890 847 576 847 896 841 819 643 810 432 931 426 827 540 876 931 330 357 165 216 612 896 571 533 948 432 648 747 572 540 612 645 533 895 454 264 351 651 680 624 546 643 685 643 501 765 931 360 836 895 533 643 868 841 426 266 624 895 850 351 949 454 852 533 672 689 796 310 ...

output:

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

result:

ok 100 token(s): yes count is 96, no count is 4

Test #53:

score: 0
Accepted
time: 2367ms
memory: 5208kb

input:

10
10000 4323983
8892 5037 7959 8580 8583 4731 8311 8642 7516 5890 4164 3463 8597 8004 5392 7403 8674 3894 8832 9008 8642 2569 9235 8642 3123 7959 6798 7403 8175 4164 8642 7184 1968 8222 8727 8674 9235 8775 2569 5904 9327 6036 5150 5125 7184 7524 8015 649 7415 9840 3936 5890 9864 5033 8311 7292 9235...

output:

Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes

result:

ok 10 token(s): yes count is 8, no count is 2

Test #54:

score: 0
Accepted
time: 2665ms
memory: 17300kb

input:

1
100000 1394564793
79806 91194 82305 99628 90027 66133 35688 66133 66449 57240 91194 73992 39903 68970 83068 63117 87521 72066 80301 42326 90027 86112 93995 58089 90027 8968 53396 58089 82756 76034 37969 50146 53784 49378 10670 72066 47403 76320 43386 55162 66449 66449 55162 39900 67053 39900 75176...

output:

Yes

result:

ok YES

Test #55:

score: 0
Accepted
time: 657ms
memory: 3584kb

input:

1000
100 4199
76 39 96 84 76 81 91 60 57 24 94 72 90 14 91 95 58 19 50 60 100 46 30 72 55 93 88 76 47 0 7 97 93 96 81 87 59 60 39 0 90 45 35 49 51 24 79 72 58 25 48 44 91 69 72 67 20 33 48 84 51 81 71 81 55 26 60 84 86 97 100 90 98 40 91 74 72 51 36 95 40 100 96 58 78 61 54 33 75 58 72 81 44 18 86 4...

output:

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

result:

ok 1000 token(s): yes count is 953, no count is 47

Test #56:

score: 0
Accepted
time: 958ms
memory: 3840kb

input:

100
1000 932728
197 952 672 690 824 609 298 211 869 942 814 610 994 830 849 565 990 943 846 888 412 73 277 386 508 757 735 127 710 844 715 527 921 390 624 326 360 869 635 788 881 708 627 455 379 528 882 740 840 578 675 576 814 465 237 279 718 870 378 507 616 959 630 579 207 980 944 521 521 989 756 7...

output:

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

result:

ok 100 token(s): yes count is 98, no count is 2

Test #57:

score: 0
Accepted
time: 2344ms
memory: 5204kb

input:

10
10000 96416428
5442 5442 3976 3652 5547 7156 9627 7288 6300 9826 5435 8430 9578 1423 9217 9031 8417 9264 8912 6204 5268 3918 6386 8232 8696 7314 9227 5084 9720 3553 7145 4572 7390 9649 8858 3318 6471 9823 7792 1703 6734 7663 7044 5360 9773 7618 7618 4835 3887 9243 9368 9956 1826 3657 4775 8002 82...

output:

Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes

result:

ok 10 token(s): yes count is 10, no count is 0

Test #58:

score: 0
Accepted
time: 2669ms
memory: 17368kb

input:

1
100000 3321635168
82188 97332 59364 93906 83245 51674 85137 86055 55826 98260 48206 59144 68526 58794 89190 33940 75228 88573 92969 88923 98016 52466 90335 86370 65325 70488 45232 8360 50665 89356 58794 68029 86030 74408 22384 90606 51583 38118 92205 93600 38118 69428 80624 60865 54200 48666 52583...

output:

Yes

result:

ok YES

Extra Test:

score: 0
Extra Test Passed