QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#666240#9464. 基础 01? 练习题cmk6660 233ms30176kbC++2317.0kb2024-10-22 17:16:022024-10-22 17:16:04

Judging History

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

  • [2024-10-22 17:16:04]
  • 评测
  • 测评结果:0
  • 用时:233ms
  • 内存:30176kb
  • [2024-10-22 17:16:02]
  • 提交

answer

/*  _              _     _                                             _       __      __      __   
   / \     _   _  | |_  | |__     ___    _ __   _    ___   _ __ ___   | | __  / /_    / /_    / /_  
  / _ \   | | | | | __| | '_ \   / _ \  | '__| (_)  / __| | '_ ` _ \  | |/ / | '_ \  | '_ \  | '_ \ 
 / ___ \  | |_| | | |_  | | | | | (_) | | |     _  | (__  | | | | | | |   <  | (_) | | (_) | | (_) |
/_/   \_\  \__,_|  \__| |_| |_|  \___/  |_|    (_)  \___| |_| |_| |_| |_|\_\  \___/   \___/   \___/ 
[Created Time:       2024-10-22 15:41:57]
[Last Modified Time: 2024-10-22 17:15:58] */
#pragma GCC optimize("Ofast", "unroll-loops")
#include<bits/stdc++.h>
#ifdef LOCAL
#include"debug.h"
#else
#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 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 < 998244353 >; // 1000000007 1145141919810000037
int n, m, cnt[50009], cur, lp[2][50009], rp[2][50009], l, r; char s[50009];
MI pw[50009], ipw[50009], qwq, co[200009], ans[200009]; bool f[16][2][50009], g[16][2][50009];
vector < tuple < int, int, MI > > mdf[50009]; vector < tuple < int, int, int > > qry[50009];
namespace ST
{
	struct node
	{
		MI co, k, b, lzk, lzb;
		inline void apply(MI kk, MI bb) { k += co * kk, b += co * bb, lzk += kk, lzb += bb; }
	}	t[50009 << 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].k = t[lc(p)].k + t[rc(p)].k, t[p].b = t[lc(p)].b + t[rc(p)].b; }
	inline void pd(int p)
	{
		if ( t[p].lzk || t[p].lzb ) t[lc(p)].apply(t[p].lzk, t[p].lzb),
									t[rc(p)].apply(t[p].lzk, t[p].lzb), t[p].lzk = t[p].lzb = 0;
	}
	inline void build(int p, int l, int r)
	{
		if ( l == r ) { t[p].co = pw[cnt[l - 1]]; return; }
		build(lc(p), l, md(l, r)), build(rc(p), md(l, r) + 1, r), t[p].co = t[lc(p)].co + t[rc(p)].co;
	}
	inline void add(int p, int l, int r, int lp, int rp, MI k, MI b)
	{
		if ( l > rp || r < lp ) return;
		if ( lp <= l && r <= rp ) { t[p].apply(k, b); return; }
		pd(p), add(lc(p), l, md(l, r), lp, rp, k, b), add(rc(p), md(l, r) + 1, r, lp, rp, k, b), pu(p);
	}
	inline MI qry(int p, int l, int r, int lp, int rp, MI o)
	{
		if ( l > rp || r < lp ) return 0;
		if ( lp <= l && r <= rp ) return t[p].k * o + t[p].b;
		return pd(p), qry(lc(p), l, md(l, r), lp, rp, o) + qry(rc(p), md(l, r) + 1, r, lp, rp, o);
	}
}
int main()
{
	read(n, m), read_cstr(s + 1), *pw = *ipw = 1;
	For(i, 1, n) cnt[i] = cnt[i - 1] + ( s[i] == '?' ), pw[i] = pw[i - 1] * 2, ipw[i] = ipw[i - 1] / 2;
	For(i, 1, n) For(j, 0, 1) if ( s[i] == '?' || s[i] == '0' + j ) f[0][j][i] = g[0][j][i] = true;
	For(i, 1, 15) For(j, 0, 1) For(k, 1, n + 1 - ( 1 << i ))
		f[i][j][k] = f[i - 1][j][k] && f[i - 1][!j][k + ( 1 << ( i - 1 ) )];
	For(i, 1, 15) For(j, 0, 1) For(k, 1 << i, n)
		g[i][j][k] = g[i - 1][j][k] && g[i - 1][!j][k - ( 1 << ( i - 1 ) )];
	For(i, 1, n) For(j, 0, 1)
	{
		lp[j][i] = i + 1, cur = j;
		Fol(k, 15, 0) if ( lp[j][i] - ( 1 << k ) >= 1 && g[k][cur][lp[j][i] - 1] )
			lp[j][i] -= 1 << k, cur = !cur;
		rp[j][i] = i - 1, cur = j;
		Fol(k, 15, 0) if ( rp[j][i] + ( 1 << k ) <= n && f[k][cur][rp[j][i] + 1] )
			rp[j][i] += 1 << k, cur = !cur;
	}
	For(i, 2, n) For(j, 0, 1) For(k, 0, 1)
	{
		l = lp[j][i - 1], r = rp[k][i];
		if ( l < i && i <= r ) mdf[i].emplace_back(l, i - 1, 1), mdf[r + 1].emplace_back(l, i - 1, -1);
	}
	For(i, 2, n) For(j, 0, 1) For(k, 0, 15) if ( i + ( 1 << k ) <= n && f[k][j][i] )
	{
		cur = j ^ ( k & 1 );
		l = max(i - ( 1 << k ), lp[!cur][i - 1]), r = min(i + ( 2 << k ), rp[!j][i + ( 1 << k )]);
		if ( l < i && i + ( 1 << k ) <= r )
			mdf[i + ( 1 << k )].emplace_back(l, i - 1, -1), mdf[r + 1].emplace_back(l, i - 1, 1);
	}
	For(i, 1, m) read(l, r), l++, r++, co[i] = pw[cnt[r] - cnt[l - 1]],
				 ans[i] = r - l + 1, qry[r].emplace_back(l, r, i);
	ST::build(1, 1, n);
	For(i, 1, n)
	{
		for ( auto [l, r, co] : mdf[i] ) ST::add(1, 1, n, l, r, co, -qwq * co);
		qwq += ipw[cnt[i]];
		for ( auto [l, r, id] : qry[i] ) ans[id] += ST::qry(1, 1, n, l, r, qwq);
	}
	For(i, 1, m) println(ans[i] * co[i]);
	return 0;
}
// 想上GM捏 想上GM捏 想上GM捏 想上GM捏 想上GM捏
// 伊娜可爱捏 伊娜贴贴捏

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 5920kb

input:

15 15
0???0??01???1??
2 14
0 9
6 10
1 14
1 14
0 12
5 14
6 7
0 6
4 14
1 12
10 10
0 14
1 12
4 7

output:

24967
2272
108
54429
54429
12520
4335
6
646
5016
11488
2
58566
11488
37

result:

wrong answer 1st numbers differ - expected: '25883', found: '24967'

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 13ms
memory: 9596kb

input:

20 200000
???10?10???????1????
1 19
2 17
5 19
6 19
6 15
5 19
1 11
0 15
4 6
3 16
10 13
12 18
16 16
0 15
7 14
2 11
14 19
9 16
0 18
11 16
7 13
1 17
5 18
7 7
6 10
4 17
5 19
2 9
0 16
1 19
5 14
4 19
0 11
0 16
15 19
0 12
1 15
4 17
13 16
3 14
4 13
5 13
3 10
0 19
2 17
6 18
0 18
7 10
3 18
10 14
1 13
0 16
0 19...

output:

1290365
133852
225868
102568
4272
225868
5735
136654
12
28085
144
1309
2
136654
3139
2549
527
3139
1299910
527
1309
288306
104377
1
104
53718
225868
492
290622
1290365
8755
249127
12683
290622
202
27616
63450
53718
72
11877
4562
3844
467
2736885
133852
47008
1299910
72
129502
404
27377
290622
273688...

result:

wrong answer 1st numbers differ - expected: '1336712', found: '1290365'

Subtask #3:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 101ms
memory: 25760kb

input:

50000 200000
011001101001011?10011001011010010110011010011001011?011010010110?0011001011001101?011?010?10100101100110100110010110011?1001011010011001011?10010?1?0?10100101101?01100101100110100110010110?001011001101001100101100?10100101101?0110?10110011010011001011010010110011010010110100110?10110100...

output:

14
20
65
20
6
75
38
102
101
59
27
10
136
181
42
109
43
3
43
147
10
14
6
27
27
17
44
100
10
101
21
44
3
63
116
102
88
1
75
64
9
101
6
6
167
43
159
6
27
101
101
6
44
6
35
88
168
333
71
76
39
43
1
117
76
116
44
21
63
66
44
167
10
54
3
3
79
1
1
6
124
44
26
100
10
1
101
102
2
12
14
76
3
49
76
35
1
44
115...

result:

wrong answer 1st numbers differ - expected: '15', found: '14'

Subtask #4:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 43ms
memory: 17340kb

input:

50000 1
0101101001100101100110100110010110100101100110100110010110011010010110100110010110011010011001011010010110011010010110100110010110100101100110100110010110011010010110100110010110011010011001011010010110011010011001011001101001011010011001011010010110011010010110100110010110011010011001011010...

output:

132338090

result:

wrong answer 1st numbers differ - expected: '132414834', found: '132338090'

Subtask #5:

score: 0
Wrong Answer

Test #25:

score: 0
Wrong Answer
time: 54ms
memory: 17912kb

input:

50000 1
01011010011000110100110010110010?1001?0001011001101?001011001101?0101101?011011001101001010?10100101101001100101?01100101010?101001100110?1011010011001011010??110011?1?011001?1100110?101101001100101100100110010110011100110100101001?1?0?00?100101101001011001101001011100?1010010110101101001011...

output:

481535037

result:

wrong answer 1st numbers differ - expected: '111365458', found: '481535037'

Subtask #6:

score: 0
Wrong Answer

Test #31:

score: 0
Wrong Answer
time: 2ms
memory: 6108kb

input:

500 1000
011000100010010010010010110010101100101100101011010010011001101001011010011000010011010001011010000001100101100110100101101001001011010010110010110100101100111001100111010011010010110100110010110100101100110101000101100110100110010110100101100110100101101?01101101100101011001010010100110010...

output:

382
1709
1429
890
2180
22458
14374
20750
4911
11610
7107
16166
1578
22490
22290
5528
22494
533
9906
22234
2199
14394
325
918
8622
1856
361
15506
14418
2716
19790
707
17346
22046
20570
21562
17354
22982
3
16562
18838
452
8394
14470
19150
326
1348
11634
23246
19634
18650
19594
5099
3796
19662
1466
513...

result:

wrong answer 1st numbers differ - expected: '399', found: '382'

Subtask #7:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 0ms
memory: 6360kb

input:

1000 2000
01100101101001011001101001011010011001011010010110011010011001011001101001011010011001011010010110011010000110100101101001100101100110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101100110100110010110100101100110100101101001100101101001011001101001...

output:

3182
651512
636456
11692640
5697
11964
11353184
610632
608248
280512
284304
130426
135058
679592
16410
16264
578136
11317600
4983
584184
105358
113230
135546
1558
5949
5571568
11374944
110706
4216
11288416
50998
11369056
1732
49602
135614
8683
137994
5609
1851
22185
19739
136974
106602
51190
115822
...

result:

wrong answer 1st numbers differ - expected: '3240', found: '3182'

Subtask #8:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 57ms
memory: 15632kb

input:

5000 100000
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

724713839
41398566
632618766
664244404
139506135
100389085
886292553
827425914
126853355
285411840
852407795
180176063
165394542
522586043
425670181
453914968
217033114
434957021
236036051
188071385
369127811
65376916
453487181
591315597
824959609
346174800
175237756
172591368
770826888
433516585
47...

result:

wrong answer 1st numbers differ - expected: '917236499', found: '724713839'

Subtask #9:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 233ms
memory: 30176kb

input:

20000 100000
????????????????????????????0??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????...

output:

553003576
287695253
929952422
619180522
909077962
20012060
585480337
892238110
289312009
971639253
944207673
772966917
340958064
838309597
771712851
379866246
532839368
164263748
158735226
557732082
243771833
922639022
307518971
276118563
14378956
713017706
386957080
738370395
967076978
779281332
17...

result:

wrong answer 1st numbers differ - expected: '797690592', found: '553003576'

Subtask #10:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 134ms
memory: 26224kb

input:

50000 200000
?01101001011001?01?011?010?1001101001?110?001?0?1?1?001101?0110?101?010??01100110?00?1001011001101001011??001?001?110100101100110100101?01?0110?1011?011010011001?1?0100??110011?100?01101001100?011010?10??00110100?1?0?0110?1101?01??1?10??10010?10?00101?00??0???101101?0???010110??1?10011?...

output:

554323610
758103127
354964220
109340032
888450778
374594982
189005750
297424941
480360334
207727128
598525175
471876704
811675851
644139285
41263416
638360083
726385942
665303814
527119777
980454611
370617742
99221223
417742196
951081594
178572624
460673951
487815582
847261728
565244339
864025549
85...

result:

wrong answer 1st numbers differ - expected: '536829500', found: '554323610'