QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#824255 | #9774. Same Sum | ucup-team896# | AC ✓ | 189ms | 42552kb | C++20 | 17.5kb | 2024-12-21 13:20:57 | 2025-01-11 12:00:08 |
Judging History
你现在查看的是最新测评结果
- [2025-01-11 11:59:18]
- hack成功,自动添加数据
- (/hack/1443)
- [2024-12-23 17:02:06]
- hack成功,自动添加数据
- (/hack/1310)
- [2024-12-23 16:48:26]
- hack成功,自动添加数据
- (/hack/1309)
- [2024-12-23 16:33:45]
- hack成功,自动添加数据
- (/hack/1308)
- [2024-12-23 16:23:53]
- hack成功,自动添加数据
- (/hack/1307)
- [2024-12-23 16:13:08]
- hack成功,自动添加数据
- (/hack/1306)
- [2024-12-23 15:54:42]
- hack成功,自动添加数据
- (/hack/1305)
- [2024-12-23 14:58:39]
- hack成功,自动添加数据
- (/hack/1304)
- [2024-12-23 09:58:11]
- hack成功,自动添加数据
- (/hack/1302)
- [2024-12-23 09:47:22]
- hack成功,自动添加数据
- (/hack/1301)
- [2024-12-23 09:41:23]
- hack成功,自动添加数据
- (/hack/1300)
- [2024-12-23 09:26:32]
- hack成功,自动添加数据
- (/hack/1299)
- [2024-12-23 09:19:58]
- hack成功,自动添加数据
- (/hack/1298)
- [2024-12-23 09:13:29]
- hack成功,自动添加数据
- (/hack/1297)
- [2024-12-22 18:52:18]
- hack成功,自动添加数据
- (/hack/1296)
- [2024-12-22 18:13:14]
- hack成功,自动添加数据
- (/hack/1294)
- [2024-12-21 13:20:57]
- 提交
answer
/* _ _ _ _ __ __ __
/ \ _ _ | |_ | |__ ___ _ __ _ ___ _ __ ___ | | __ / /_ / /_ / /_
/ _ \ | | | | | __| | '_ \ / _ \ | '__| (_) / __| | '_ ` _ \ | |/ / | '_ \ | '_ \ | '_ \
/ ___ \ | |_| | | |_ | | | | | (_) | | | _ | (__ | | | | | | | < | (_) | | (_) | | (_) |
/_/ \_\ \__,_| \__| |_| |_| \___/ |_| (_) \___| |_| |_| |_| |_|\_\ \___/ \___/ \___/
[Created Time: 2024-12-21 13:03:01]
[Last Modified Time: 2024-12-21 13:20:47] */
#ifdef LOCAL
#include<bits/stdc++.h>
#include"debug.h"
#else
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#define D(...) ((void)0)
#endif
using namespace std; using ll = long long;
#define For(i, j, k) for ( int i = (j) ; i <= (k) ; i++ )
#define Fol(i, j, k) for ( int i = (j) ; i >= (k) ; i-- )
namespace FastIO
{
#define USE_FastIO
// ------------------------------
// #define DISABLE_MMAP
// ------------------------------
#if ( defined(LOCAL) || defined(_WIN32) ) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifdef LOCAL
inline void _chk_i() {}
inline char _gc_nochk() { return getchar(); }
inline char _gc() { return getchar(); }
inline void _chk_o() {}
inline void _pc_nochk(char c) { putchar(c); }
inline void _pc(char c) { putchar(c); }
template < int n > inline void _pnc_nochk(const char *c) { for ( int i = 0 ; i < n ; i++ ) putchar(c[i]); }
#else
#ifdef DISABLE_MMAP
inline constexpr int _READ_SIZE = 1 << 18; inline static char _read_buffer[_READ_SIZE + 40], *_read_ptr = nullptr, *_read_ptr_end = nullptr; static inline bool _eof = false;
inline void _chk_i() { if ( __builtin_expect(!_eof, true) && __builtin_expect(_read_ptr_end - _read_ptr < 40, false) ) { int sz = _read_ptr_end - _read_ptr; if ( sz ) memcpy(_read_buffer, _read_ptr, sz); char *beg = _read_buffer + sz; _read_ptr = _read_buffer, _read_ptr_end = beg + fread(beg, 1, _READ_SIZE, stdin); if ( __builtin_expect(_read_ptr_end != beg + _READ_SIZE, false) ) _eof = true, *_read_ptr_end = EOF; } }
inline char _gc_nochk() { return __builtin_expect(_eof && _read_ptr == _read_ptr_end, false) ? EOF : *_read_ptr++; }
inline char _gc() { _chk_i(); return _gc_nochk(); }
#else
#include<sys/mman.h>
#include<sys/stat.h>
inline static char *_read_ptr = (char *)mmap(nullptr, [] { struct stat s; return fstat(0, &s), s.st_size; } (), 1, 2, 0, 0);
inline void _chk_i() {}
inline char _gc_nochk() { return *_read_ptr++; }
inline char _gc() { return *_read_ptr++; }
#endif
inline constexpr int _WRITE_SIZE = 1 << 18; inline static char _write_buffer[_WRITE_SIZE + 40], *_write_ptr = _write_buffer;
inline void _chk_o() { if ( __builtin_expect(_write_ptr - _write_buffer > _WRITE_SIZE, false) ) fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout), _write_ptr = _write_buffer; }
inline void _pc_nochk(char c) { *_write_ptr++ = c; }
inline void _pc(char c) { *_write_ptr++ = c, _chk_o(); }
template < int n > inline void _pnc_nochk(const char *c) { memcpy(_write_ptr, c, n), _write_ptr += n; }
inline struct _auto_flush { inline ~_auto_flush() { fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout); } } _auto_flush;
#endif
#define println println_ // don't use C++23 std::println
template < class T > inline constexpr bool _is_signed = numeric_limits < T >::is_signed;
template < class T > inline constexpr bool _is_unsigned = numeric_limits < T >::is_integer && !_is_signed < T >;
#if __SIZEOF_LONG__ == 64
template <> inline constexpr bool _is_signed < __int128 > = true;
template <> inline constexpr bool _is_unsigned < __uint128_t > = true;
#endif
inline bool _isgraph(char c) { return c >= 33; }
inline bool _isdigit(char c) { return 48 <= c && c <= 57; } // or faster, remove c <= 57
constexpr struct _table {
#ifndef LOCAL
int i[65536];
#endif
char o[40000]; constexpr _table() :
#ifndef LOCAL
i{},
#endif
o{} {
#ifndef LOCAL
for ( int x = 0 ; x < 65536 ; x++ ) i[x] = -1; for ( int x = 0 ; x <= 9 ; x++ ) for ( int y = 0 ; y <= 9 ; y++ ) i[x + y * 256 + 12336] = x * 10 + y;
#endif
for ( int x = 0 ; x < 10000 ; x++ ) for ( int y = 3, z = x ; ~y ; y-- ) o[x * 4 + y] = z % 10 + 48, z /= 10; } } _table;
template < class T, int digit > inline constexpr T _pw10 = 10 * _pw10 < T, digit - 1 >;
template < class T > inline constexpr T _pw10 < T, 0 > = 1;
inline void read(char &c) { do c = _gc(); while ( !_isgraph(c) ); }
inline void read_cstr(char *s) { char c = _gc(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) *s++ = c, c = _gc(); *s = 0; }
inline void read(string &s) { char c = _gc(); s.clear(); while ( !_isgraph(c) ) c = _gc(); while ( _isgraph(c) ) s.push_back(c), c = _gc(); }
template < class T, bool neg >
#ifndef LOCAL
__attribute__((no_sanitize("undefined")))
#endif
inline void _read_int_suf(T &x) { _chk_i(); char c; while
#ifndef LOCAL
( ~_table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)] ) if constexpr ( neg ) x = x * 100 - _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; else x = x * 100 + _table.i[*reinterpret_cast < unsigned short *& >(_read_ptr)++]; if
#endif
( _isdigit(c = _gc_nochk()) ) if constexpr ( neg ) x = x * 10 - ( c & 15 ); else x = x * 10 + ( c & 15 ); }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ) if ( c == 45 ) { _read_int_suf < T, true >(x = -( _gc_nochk() & 15 )); return; } _read_int_suf < T, false >(x = c & 15); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void read(T &x) { char c; while ( !_isdigit(c = _gc()) ); _read_int_suf < T, false >(x = c & 15); }
inline void write(bool x) { _pc(x | 48); }
inline void write(char c) { _pc(c); }
inline void write_cstr(const char *s) { while ( *s ) _pc(*s++); }
inline void write(const string &s) { for ( char c : s ) _pc(c); }
template < class T, bool neg, int digit > inline void _write_int_suf(T x) { if constexpr ( digit == 4 ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _write_int_suf < T, neg, digit / 2 >(x / _pw10 < T, digit / 2 >), _write_int_suf < T, neg, digit / 2 >(x % _pw10 < T, digit / 2 >); }
template < class T, bool neg, int digit > inline void _write_int_pre(T x) { if constexpr ( digit <= 4 ) if ( digit >= 3 && ( neg ? x <= -100 : x >= 100 ) ) if ( digit >= 4 && ( neg ? x <= -1000 : x >= 1000 ) ) _pnc_nochk < 4 >(_table.o + ( neg ? -x : x ) * 4); else _pnc_nochk < 3 >(_table.o + ( neg ? -x : x ) * 4 + 1); else if ( digit >= 2 && ( neg ? x <= -10 : x >= 10 ) ) _pnc_nochk < 2 >(_table.o + ( neg ? -x : x ) * 4 + 2); else _pc_nochk(( neg ? -x : x ) | 48); else { constexpr int cur = 1 << __lg(digit - 1); if ( neg ? x <= -_pw10 < T, cur > : x >= _pw10 < T, cur > ) _write_int_pre < T, neg, digit - cur >(x / _pw10 < T, cur >), _write_int_suf < T, neg, cur >(x % _pw10 < T, cur >); else _write_int_pre < T, neg, cur >(x); } }
template < class T, enable_if_t < _is_signed < T >, int > = 0 > inline void write(T x) { if ( x >= 0 ) _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x); else _pc_nochk(45), _write_int_pre < T, true, numeric_limits < T >::digits10 + 1 >(x); _chk_o(); }
template < class T, enable_if_t < _is_unsigned < T >, int > = 0 > inline void write(T x) { _write_int_pre < T, false, numeric_limits < T >::digits10 + 1 >(x), _chk_o(); }
template < size_t N, class ...T > inline void _read_tuple(tuple < T... > &x) { read(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _read_tuple < N + 1, T... >(x); }
template < size_t N, class ...T > inline void _write_tuple(const tuple < T... > &x) { write(get < N >(x)); if constexpr ( N + 1 != sizeof...(T) ) _pc(32), _write_tuple < N + 1, T... >(x); }
template < class ...T > inline void read(tuple < T... > &x) { _read_tuple < 0, T... >(x); }
template < class ...T > inline void write(const tuple < T... > &x) { _write_tuple < 0, T... >(x); }
template < class T1, class T2 > inline void read(pair < T1, T2 > &x) { read(x.first), read(x.second); }
template < class T1, class T2 > inline void write(const pair < T1, T2 > &x) { write(x.first), _pc(32), write(x.second); }
template < class T > inline auto read(T &x) -> decltype(x.read(), void()) { x.read(); }
template < class T > inline auto write(const T &x) -> decltype(x.write(), void()) { x.write(); }
template < class T1, class ...T2 > inline void read(T1 &x, T2 &...y) { read(x), read(y...); }
template < class ...T > inline void read_cstr(char *x, T *...y) { read_cstr(x), read_cstr(y...); }
template < class T1, class ...T2 > inline void write(const T1 &x, const T2 &...y) { write(x), write(y...); }
template < class ...T > inline void write_cstr(const char *x, const T *...y) { write_cstr(x), write_cstr(y...); }
template < class T > inline void print(const T &x) { write(x); }
inline void print_cstr(const char *x) { write_cstr(x); }
template < class T1, class ...T2 > inline void print(const T1 &x, const T2 &...y) { write(x), _pc(32), print(y...); }
template < class ...T > inline void print_cstr(const char *x, const T *...y) { write_cstr(x), _pc(32), print_cstr(y...); }
inline void println() { _pc(10); }
inline void println_cstr() { _pc(10); }
template < class ...T > inline void println(const T &...x) { print(x...), _pc(10); }
template < class ...T > inline void println_cstr(const T *...x) { print_cstr(x...), _pc(10); }
} using FastIO::read, FastIO::read_cstr, FastIO::write, FastIO::write_cstr, FastIO::println, FastIO::println_cstr;
template < auto P_ > class MontgomeryModInt
{
using S = decltype(P_); static_assert(is_same_v < S, int > || is_same_v < S, long > || is_same_v < S, long long >);
static_assert(P_ & 1 && 0 < P_ && P_ < ( (S)1 << ( sizeof(S) * 8 - 2 ) ));
using U = conditional_t < is_same_v < S, int >, unsigned, unsigned long long >; using D = conditional_t < is_same_v < S, int >, unsigned long long, __uint128_t >;
inline constexpr static U uinv(U x) { U y = x; for ( int i = is_same_v < S, int > ? 4 : 5 ; i-- ; ) y *= 2 - x * y; return y; }
constexpr static U P = P_, P2 = P << 1, R = -uinv(P), R2 = -(D)P % P; static_assert(P * R == -1);
inline constexpr static U reduce(D x) { return ( x + (U)x * R * (D)P ) >> ( sizeof(U) * 8 ); }
inline constexpr MontgomeryModInt(U x, int) : v(x) {} U v;
public:
inline constexpr static S mod() { return P; }
inline constexpr MontgomeryModInt() : v(0) {}
inline constexpr MontgomeryModInt(const MontgomeryModInt &x) : v(x.v) {}
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt(T x) : v(reduce((D)R2 * ( numeric_limits < T >::is_signed && x < 0 ? ( ( x + P < 0 ) && ( x %= P ), x + P ) : ( ( sizeof(T) > sizeof(U) && x >= (T)1 << sizeof(U) ) && ( x %= P ), x ) ))) {}
inline constexpr S val()const { U x = reduce(v); return ( x - P ) >> ( sizeof(U) * 8 - 1 ) ? x : x - P; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > explicit inline constexpr operator T()const { return val(); }
inline constexpr friend bool operator==(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() == y.val(); }
inline constexpr friend bool operator!=(const MontgomeryModInt &x, const MontgomeryModInt &y) { return x.val() != y.val(); }
inline constexpr MontgomeryModInt &operator=(const MontgomeryModInt &x) & { v = x.v; return *this; }
inline constexpr MontgomeryModInt &operator++() & { return *this += 1; }
inline constexpr MontgomeryModInt operator++(int) & { MontgomeryModInt x = *this; *this += 1; return x; }
inline constexpr MontgomeryModInt &operator--() & { return *this -= 1; }
inline constexpr MontgomeryModInt operator--(int) & { MontgomeryModInt x = *this; *this -= 1; return x; }
inline constexpr MontgomeryModInt operator-()const { return MontgomeryModInt(v ? P2 - v : 0, 0); }
inline constexpr MontgomeryModInt &operator+=(const MontgomeryModInt &x) & { v += x.v, ( v - P2 ) >> ( sizeof(U) * 8 - 1 ) || ( v -= P2 ); return *this; }
inline constexpr MontgomeryModInt &operator-=(const MontgomeryModInt &x) & { v -= x.v, v >> ( sizeof(U) * 8 - 1 ) && ( v += P2 ); return *this; }
inline constexpr MontgomeryModInt &operator*=(const MontgomeryModInt &x) & { v = reduce((D)v * x.v); return *this; }
inline constexpr MontgomeryModInt &operator/=(const MontgomeryModInt &x) & { return *this *= x.inv(); }
inline constexpr friend MontgomeryModInt operator+(MontgomeryModInt x, const MontgomeryModInt &y) { return x += y; }
inline constexpr friend MontgomeryModInt operator-(MontgomeryModInt x, const MontgomeryModInt &y) { return x -= y; }
inline constexpr friend MontgomeryModInt operator*(MontgomeryModInt x, const MontgomeryModInt &y) { return x *= y; }
inline constexpr friend MontgomeryModInt operator/(MontgomeryModInt x, const MontgomeryModInt &y) { return x /= y; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr MontgomeryModInt qpow(T y)const { MontgomeryModInt x = *this, z = 1; while ( y ) { if ( y & 1 ) z *= x; if ( y >>= 1 ) x *= x; } return z; }
template < class T, enable_if_t < numeric_limits < T >::is_integer, int > = 0 > inline constexpr friend MontgomeryModInt qpow(const MontgomeryModInt &x, T y) { return x.qpow(y); }
inline constexpr MontgomeryModInt inv()const { return qpow(P - 2); }
inline constexpr friend MontgomeryModInt inv(const MontgomeryModInt &x) { return x.inv(); }
inline friend istream &operator>>(istream &is, MontgomeryModInt &x) { S y; is >> y, x = y; return is; }
inline friend ostream &operator<<(ostream &os, const MontgomeryModInt &x) { return os << x.val(); }
#ifdef USE_FastIO
inline void read() & { S x; ::read(x), *this = x; }
inline void write()const { ::write(val()); }
#endif
}; using MI = MontgomeryModInt < 1145141919810000037 >; // 1000000007 1145141919810000037
mt19937 rnd(chrono::system_clock::now().time_since_epoch().count());
template < class T > inline T R(T l, T r) { return uniform_int_distribution < T >(l, r)(rnd); }
constexpr int N = 200000; constexpr ll M = ( N + 1ll ) * ( N + 1 );
const MI B = MI::mod() / 2 + R(-2333333333ll, 2333333333ll), ivB = inv(B);
MI pw[200009], ivpw[200009];
namespace ST_
{
struct node
{
ll v, lz;
inline void apply(ll x, int len) { v += x * len, lz += x; }
} t[200009 << 2];
inline int lc(int p) { return p << 1; }
inline int rc(int p) { return p << 1 | 1; }
inline int md(int l, int r) { return ( l + r ) >> 1; }
inline void pu(int p) { t[p].v = t[lc(p)].v + t[rc(p)].v; }
inline void pd(int p, int l, int r)
{
if ( !t[p].lz ) return;
t[lc(p)].apply(t[p].lz, md(l, r) - l + 1), t[rc(p)].apply(t[p].lz, r - md(l, r)), t[p].lz = 0;
}
inline void build(int p, int l, int r, int *x)
{
if ( l == r ) { t[p].v = x[l]; return; }
build(lc(p), l, md(l, r), x), build(rc(p), md(l, r) + 1, r, x), pu(p);
}
inline void add(int p, int l, int r, int lp, int rp, int v)
{
if ( l > rp || r < lp ) return;
if ( lp <= l && r <= rp ) { t[p].apply(v, r - l + 1); return; }
pd(p, l, r), add(lc(p), l, md(l, r), lp, rp, v), add(rc(p), md(l, r) + 1, r, lp, rp, v), pu(p);
}
inline ll qry(int p, int l, int r, int lp, int rp)
{
if ( l > rp || r < lp ) return 0;
if ( lp <= l && r <= rp ) return t[p].v;
return pd(p, l, r), qry(lc(p), l, md(l, r), lp, rp) + qry(rc(p), md(l, r) + 1, r, lp, rp);
}
}
namespace ST
{
struct node
{
MI h, ivh, lz, ivlz;
inline void apply(MI x, MI ivx) { h *= x, ivh *= ivx, lz *= x, ivlz *= ivx; }
} t[200009 << 2];
inline int lc(int p) { return p << 1; }
inline int rc(int p) { return p << 1 | 1; }
inline int md(int l, int r) { return ( l + r ) >> 1; }
inline void pu(int p) { t[p].h = t[lc(p)].h + t[rc(p)].h, t[p].ivh = t[lc(p)].ivh + t[rc(p)].ivh; }
inline void pd(int p)
{
if ( t[p].lz == 1 && t[p].ivlz == 1 ) return;
t[lc(p)].apply(t[p].lz, t[p].ivlz), t[rc(p)].apply(t[p].lz, t[p].ivlz), t[p].lz = t[p].ivlz = 1;
}
inline void build(int p, int l, int r, int *x)
{
t[p].lz = t[p].ivlz = 1;
if ( l == r ) { t[p].h = pw[x[l]], t[p].ivh = ivpw[x[l]]; return; }
build(lc(p), l, md(l, r), x), build(rc(p), md(l, r) + 1, r, x), pu(p);
}
inline void add(int p, int l, int r, int lp, int rp, int v)
{
if ( l > rp || r < lp ) return;
if ( lp <= l && r <= rp ) { t[p].apply(pw[v], ivpw[v]); return; }
pd(p), add(lc(p), l, md(l, r), lp, rp, v), add(rc(p), md(l, r) + 1, r, lp, rp, v), pu(p);
}
inline MI qryh(int p, int l, int r, int lp, int rp)
{
if ( l > rp || r < lp ) return 0;
if ( lp <= l && r <= rp ) return t[p].h;
return pd(p), qryh(lc(p), l, md(l, r), lp, rp) + qryh(rc(p), md(l, r) + 1, r, lp, rp);
}
inline MI qryivh(int p, int l, int r, int lp, int rp)
{
if ( l > rp || r < lp ) return 0;
if ( lp <= l && r <= rp ) return t[p].ivh;
return pd(p), qryivh(lc(p), l, md(l, r), lp, rp) + qryivh(rc(p), md(l, r) + 1, r, lp, rp);
}
}
int n, q, op, l, r, v, a[200009]; ll s; MI h, ivh;
int main()
{
*pw = *ivpw = 1; For(i, 1, N) pw[i] = pw[i - 1] * B, ivpw[i] = ivpw[i - 1] * ivB;
read(n, q); For(i, 1, n) read(a[i]);
ST_::build(1, 1, n, a), ST::build(1, 1, n, a);
while ( q-- )
{
read(op, l, r);
if ( op == 1 ) read(v), ST_::add(1, 1, n, l, r, v), ST::add(1, 1, n, l, r, v);
else
{
v = ( r - l + 1 ) >> 1, s = ST_::qry(1, 1, n, l, r);
if ( s % v ) { println("NO"s); continue; } s /= v;
h = ST::qryh(1, 1, n, l, r), ivh = ST::qryivh(1, 1, n, l, r);
println(h == ivh * qpow(B, s) ? "YES"s : "NO"s);
}
}
return 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 12164kb
input:
8 4 1 2 3 4 5 6 7 8 2 1 8 1 1 4 4 2 1 6 2 1 8
output:
YES NO YES
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: 0
Accepted
time: 145ms
memory: 38996kb
input:
200000 200000 0 0 0 1 1 0 2 1 1 2 0 1 0 0 0 2 1 0 1 2 2 1 2 1 2 0 0 2 1 2 1 0 0 2 0 2 1 1 1 2 0 0 0 0 2 0 1 0 0 2 2 1 1 0 0 2 1 0 2 0 2 1 2 1 0 1 2 1 0 1 2 1 2 1 0 1 2 0 1 0 1 1 0 2 1 2 0 2 2 1 1 2 1 2 2 0 0 1 2 0 0 2 2 0 1 2 2 0 0 1 2 1 2 0 2 0 0 2 0 2 1 0 1 1 1 1 2 1 2 0 1 2 1 0 2 1 0 1 1 2 2 0 1 ...
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 100047 token(s): yes count is 22, no count is 100025
Test #3:
score: 0
Accepted
time: 148ms
memory: 40852kb
input:
200000 200000 5 5 2 0 1 1 4 1 1 0 4 2 2 5 5 4 1 2 2 0 3 3 3 2 5 4 1 5 1 0 0 4 3 4 2 2 3 1 4 2 0 5 4 0 2 5 5 5 2 2 3 4 0 2 2 5 0 2 3 5 4 0 0 2 1 0 5 3 1 4 5 2 2 3 4 5 0 5 5 5 3 3 0 1 4 3 0 0 3 2 2 0 4 5 5 5 2 4 5 2 5 3 1 1 5 2 1 0 1 0 5 0 0 1 5 1 5 3 1 5 3 5 4 0 2 2 4 2 5 2 3 4 5 4 3 5 2 5 2 4 5 3 4 ...
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 99734 token(s): yes count is 10, no count is 99724
Test #4:
score: 0
Accepted
time: 151ms
memory: 42048kb
input:
200000 200000 185447 70128 80288 38126 188018 126450 46081 189881 15377 21028 12588 100061 7218 74518 162803 34448 90998 44793 167718 16370 136024 153269 186316 137564 3082 169700 175712 19214 82647 72919 170919 142138 57755 168197 81575 126456 183138 106882 167154 184388 198667 190302 188371 183732...
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 99837 token(s): yes count is 11, no count is 99826
Test #5:
score: 0
Accepted
time: 150ms
memory: 40740kb
input:
200000 200000 0 2 0 2 0 2 1 1 1 1 0 2 2 0 1 1 1 1 2 0 0 2 1 1 0 2 0 2 0 2 2 0 1 1 0 2 1 1 2 0 2 0 1 1 2 0 1 1 2 0 0 2 0 2 2 0 1 1 2 0 1 1 0 2 0 2 2 0 0 2 2 0 1 1 1 1 1 1 2 0 0 2 0 2 0 2 0 2 2 0 0 2 1 1 0 2 0 2 2 0 2 0 1 1 1 1 0 2 0 2 2 0 1 1 0 2 2 0 0 2 2 0 1 1 2 0 1 1 0 2 1 1 2 0 1 1 0 2 1 1 2 0 1 ...
output:
NO YES YES 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 YES NO 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 YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES ...
result:
ok 99868 token(s): yes count is 34, no count is 99834
Test #6:
score: 0
Accepted
time: 148ms
memory: 41040kb
input:
200000 200000 5 0 5 0 2 3 0 5 1 4 1 4 4 1 1 4 1 4 0 5 4 1 2 3 2 3 5 0 5 0 4 1 1 4 2 3 2 3 0 5 3 2 3 2 3 2 2 3 5 0 4 1 1 4 5 0 1 4 0 5 0 5 4 1 3 2 4 1 2 3 2 3 3 2 1 4 4 1 2 3 0 5 5 0 4 1 0 5 2 3 5 0 5 0 5 0 2 3 2 3 3 2 4 1 0 5 2 3 2 3 5 0 0 5 2 3 3 2 5 0 4 1 0 5 0 5 2 3 1 4 0 5 5 0 3 2 1 4 4 1 5 0 2 ...
output:
NO YES YES NO NO NO NO NO YES 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 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 YES NO NO NO NO NO...
result:
ok 99999 token(s): yes count is 32, no count is 99967
Test #7:
score: 0
Accepted
time: 152ms
memory: 40048kb
input:
200000 200000 185447 14553 70128 129872 80288 119712 38126 161874 188018 11982 126450 73550 46081 153919 189881 10119 15377 184623 21028 178972 12588 187412 100061 99939 7218 192782 74518 125482 162803 37197 34448 165552 90998 109002 44793 155207 167718 32282 16370 183630 136024 63976 153269 46731 1...
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 99951 token(s): yes count is 16, no count is 99935
Test #8:
score: 0
Accepted
time: 157ms
memory: 41732kb
input:
200000 200000 0 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 97 98...
output:
NO YES YES NO NO NO YES YES YES NO YES YES 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 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...
result:
ok 99715 token(s): yes count is 40, no count is 99675
Test #9:
score: 0
Accepted
time: 145ms
memory: 41696kb
input:
200000 200000 0 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 97 98...
output:
YES NO YES NO YES YES 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 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 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 ...
result:
ok 100013 token(s): yes count is 34, no count is 99979
Test #10:
score: 0
Accepted
time: 145ms
memory: 42224kb
input:
200000 200000 0 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 97 98...
output:
YES YES NO YES NO YES NO NO NO NO YES 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 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 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 ...
result:
ok 99963 token(s): yes count is 34, no count is 99929
Test #11:
score: 0
Accepted
time: 3ms
memory: 13012kb
input:
6 122861 0 0 0 0 0 0 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 2 2 6 1 3 3 5 1 4 4 5 1 5 5 5 1 6 6 5 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 2 2 6 1 3 3 5 1 4 4 5 1 5 5 5 1 6 6 5 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6 1 1 1 1 2 1 6...
output:
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 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 YES NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 46656 token(s): yes count is 4986, no count is 41670
Test #12:
score: 0
Accepted
time: 189ms
memory: 39544kb
input:
200000 200000 0 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 97 98...
output:
YES YES NO YES NO YES YES YES YES YES YES NO YES YES NO YES NO YES YES NO NO YES YES YES YES NO NO YES YES NO YES NO YES YES YES YES YES YES YES NO NO NO YES YES YES YES YES NO YES YES NO YES NO YES YES YES YES NO YES NO NO YES NO NO YES YES YES NO YES YES YES YES YES NO YES YES YES NO NO NO NO NO Y...
result:
ok 200000 token(s): yes count is 142548, no count is 57452
Test #13:
score: 0
Accepted
time: 100ms
memory: 41444kb
input:
200000 200000 192638 7362 141854 58146 18695 181305 143615 56385 20728 179272 179861 20139 78463 121537 79967 120033 121724 78276 131821 68179 140320 59680 124938 75062 119503 80497 14769 185231 50662 149338 82361 117639 43840 156160 110453 89547 64825 135175 177198 22802 147890 52110 197055 2945 12...
output:
NO NO NO NO YES YES NO NO NO NO YES NO NO NO NO NO YES YES NO NO NO NO YES NO NO YES NO NO NO NO NO NO NO NO YES YES YES NO NO NO NO YES NO NO NO NO NO YES NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO YES YES NO NO NO NO NO NO YES YES NO NO YES YES NO NO NO NO YES NO YES...
result:
ok 200000 token(s): yes count is 48250, no count is 151750
Test #14:
score: 0
Accepted
time: 24ms
memory: 39584kb
input:
200000 200000 0 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 97 98...
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 99626 token(s): yes count is 99626, no count is 0
Test #15:
score: 0
Accepted
time: 55ms
memory: 41028kb
input:
197608 196219 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
output:
NO
result:
ok NO
Test #16:
score: 0
Accepted
time: 22ms
memory: 39212kb
input:
200000 200000 192638 141854 18695 143615 20728 179861 78463 79967 121724 131821 140320 124938 119503 14769 50662 82361 43840 110453 64825 177198 147890 197055 123986 43758 8280 150034 76471 159453 87872 155736 157666 86004 64006 177643 1216 5985 55593 136832 69653 148283 122874 29168 48188 163871 13...
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 100000 token(s): yes count is 0, no count is 100000
Test #17:
score: 0
Accepted
time: 16ms
memory: 12964kb
input:
4 200000 0 0 0 0 1 1 1 42088 2 1 4 1 1 1 58300 2 1 4 1 1 1 145704 2 1 4 1 1 1 117780 2 1 4 1 1 1 195088 2 1 4 1 1 1 160324 2 1 4 1 1 1 133788 2 1 4 1 1 1 162516 2 1 4 1 1 1 13988 2 1 4 1 1 1 188808 2 1 4 1 1 1 31100 2 1 4 1 1 1 177300 2 1 4 1 1 1 55928 2 1 4 1 1 1 19136 2 1 4 1 1 1 73668 2 1 4 1 1 1...
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 100000 token(s): yes count is 0, no count is 100000
Test #18:
score: 0
Accepted
time: 2ms
memory: 10660kb
input:
2 1 0 0 2 1 2
output:
YES
result:
ok YES
Test #19:
score: 0
Accepted
time: 0ms
memory: 12080kb
input:
2 2 0 0 1 1 1 0 2 1 2
output:
YES
result:
ok YES
Test #20:
score: 0
Accepted
time: 2ms
memory: 9468kb
input:
1 1 0 1 1 1 0
output:
result:
ok Empty output
Test #21:
score: 0
Accepted
time: 12ms
memory: 13836kb
input:
4 200000 0 0 0 0 1 2 2 199964 2 1 4 1 1 1 199836 2 1 4 1 1 1 199940 2 1 4 1 2 2 199840 2 1 4 1 1 1 199828 2 1 4 1 2 2 199888 2 1 4 1 1 1 199648 2 1 4 1 2 2 199612 2 1 4 1 1 1 199708 2 1 4 1 2 2 199664 2 1 4 1 1 1 199832 2 1 4 1 2 2 199764 2 1 4 1 2 2 199976 2 1 4 1 1 1 199908 2 1 4 1 1 1 199856 2 1 ...
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 100000 token(s): yes count is 8, no count is 99992
Test #22:
score: 0
Accepted
time: 51ms
memory: 42552kb
input:
200000 200000 200000 199999 199998 199997 199996 199995 199994 199993 199992 199991 199990 199989 199988 199987 199986 199985 199984 199983 199982 199981 199980 199979 199978 199977 199976 199975 199974 199973 199972 199971 199970 199969 199968 199967 199966 199965 199964 199963 199962 199961 199960...
output:
YES
result:
ok YES
Test #23:
score: 0
Accepted
time: 130ms
memory: 40268kb
input:
200000 200000 175960 196691 141034 183984 132008 129164 72964 53485 150696 31544 139600 193356 28529 89919 66203 72599 141290 173131 195071 149428 42387 2727 96203 56482 124989 42578 1279 45714 127772 147686 190834 124128 87157 141600 151702 131564 181105 179659 94356 91225 180372 167118 123153 1339...
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 20000 token(s): yes count is 20000, no count is 0
Extra Test:
score: 0
Extra Test Passed