QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#666253#9464. 基础 01? 练习题peaneval_kala0 639ms40640kbC++2316.6kb2024-10-22 17:21:312024-10-22 17:21:33

Judging History

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

  • [2024-10-22 17:21:33]
  • 评测
  • 测评结果:0
  • 用时:639ms
  • 内存:40640kb
  • [2024-10-22 17:21:31]
  • 提交

answer

#pragma GCC optimize(3, "unroll-loops", "no-stack-protector")
#define atsum(l, r) accumulate(l, r, 0)
#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/hash_policy.hpp>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr int inf = 0x3f3f3f3f;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
inline void chkmin(T &x, T y) {
    x = min(x, y);
}
template <typename T>
inline void chkmax(T &x, T y) {
    x = max(x, y);
}
namespace FastIO {
// ------------------------------
#define IN_HAS_NEG
#define OUT_HAS_NEG
#define CHK_EOF
#define DISABLE_MMAP
// ------------------------------
#if __cplusplus < 201400
#error Please use C++14 or higher.
#endif
#if __cplusplus > 201700
#define INLINE_V inline
#else
#define INLINE_V
#endif
#if (defined(LOCAL) || defined(_WIN32)) && !defined(DISABLE_MMAP)
#define DISABLE_MMAP
#endif
#ifndef DISABLE_MMAP
#include <sys/mman.h>
#endif
#ifdef LOCAL
inline char gc() { return getchar(); }
inline void pc(char c) { putchar(c); }
#else
#ifdef DISABLE_MMAP
INLINE_V constexpr int _READ_SIZE = 1 << 18;
INLINE_V static char _read_buffer[_READ_SIZE], *_read_ptr = nullptr,
                                               *_read_ptr_end = nullptr;
inline char gc() {
    if (__builtin_expect(_read_ptr == _read_ptr_end, false)) {
        _read_ptr = _read_buffer;
        _read_ptr_end =
            _read_buffer + fread(_read_buffer, 1, _READ_SIZE, stdin);
#ifdef CHK_EOF
        if (__builtin_expect(_read_ptr == _read_ptr_end, false)) return EOF;
#endif
    }
    return *_read_ptr++;
}
#else
INLINE_V static const char *_read_ptr =
    (const char *)mmap(nullptr, INT_MAX, 1, 2, 0, 0);
inline char gc() { return *_read_ptr++; }
#endif
INLINE_V constexpr int _WRITE_SIZE = 1 << 18;
INLINE_V static char _write_buffer[_WRITE_SIZE], *_write_ptr = _write_buffer;
inline void pc(char c) {
    *_write_ptr++ = c;
    if (__builtin_expect(_write_buffer + _WRITE_SIZE == _write_ptr, false)) {
        fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout);
        _write_ptr = _write_buffer;
    }
}
INLINE_V struct _auto_flush {
    ~_auto_flush() {
        fwrite(_write_buffer, 1, _write_ptr - _write_buffer, stdout);
    }
} _auto_flush;
#endif
#ifdef CHK_EOF
inline bool _isdigit(char c) { return (c & 16) && c != EOF; }
inline bool _isgraph(char c) { return c > 32 && c != EOF; }
#else
inline bool _isdigit(char c) { return c & 16; }
inline bool _isgraph(char c) { return c > 32; }
#endif
template <class T>
INLINE_V constexpr bool _is_integer = numeric_limits<T>::is_integer;
template <class T>
INLINE_V constexpr bool _is_signed = numeric_limits<T>::is_signed;
template <class T>
INLINE_V constexpr bool _is_unsigned = _is_integer<T> && !_is_signed<T>;
template <>
INLINE_V constexpr bool _is_integer<__int128> = true;
template <>
INLINE_V constexpr bool _is_integer<__uint128_t> = true;
template <>
INLINE_V constexpr bool _is_signed<__int128> = true;
template <>
INLINE_V constexpr bool _is_unsigned<__uint128_t> = true;
#undef INLINE_V
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();
}
#ifdef IN_HAS_NEG
template <class T, enable_if_t<_is_signed<T>, int> = 0>
inline void read(T &x) {
    char c = gc();
    bool f = true;
    x = 0;
    while (!_isdigit(c)) {
        if (c == 45) f = false;
        c = gc();
    }
    if (f)
        while (_isdigit(c)) x = x * 10 + (c & 15), c = gc();
    else
        while (_isdigit(c)) x = x * 10 - (c & 15), c = gc();
}
template <class T, enable_if_t<_is_unsigned<T>, int> = 0>
#else
template <class T, enable_if_t<_is_integer<T>, int> = 0>
#endif
inline void read(T &x) {
    char c = gc();
    while (!_isdigit(c)) c = gc();
    x = 0;
    while (_isdigit(c)) x = x * 10 + (c & 15), c = gc();
}
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);
}
#ifdef OUT_HAS_NEG
template <class T, enable_if_t<_is_signed<T>, int> = 0>
inline void write(T x) {
    char buffer[numeric_limits<T>::digits10 + 1];
    int digits = 0;
    if (x >= 0) do
            buffer[digits++] = (x % 10) | 48, x /= 10;
        while (x);
    else {
        pc(45);
        do buffer[digits++] = -(x % 10) | 48, x /= 10;
        while (x);
    }
    while (digits) pc(buffer[--digits]);
}
template <class T, enable_if_t<_is_unsigned<T>, int> = 0>
#else
template <class T, enable_if_t<_is_integer<T>, int> = 0>
#endif
inline void write(T x) {
    char buffer[numeric_limits<T>::digits10 + 1];
    int digits = 0;
    do buffer[digits++] = (x % 10) | 48, x /= 10;
    while (x);
    while (digits) pc(buffer[--digits]);
}
template <int N>
struct _tuple_io_helper {
    template <class... T>
    static inline void _read(tuple<T...> &x) {
        _tuple_io_helper<N - 1>::_read(x), read(get<N - 1>(x));
    }
    template <class... T>
    static inline void _write(const tuple<T...> &x) {
        _tuple_io_helper<N - 1>::_write(x), pc(32), write(get<N - 1>(x));
    }
};
template <>
struct _tuple_io_helper<1> {
    template <class... T>
    static inline void _read(tuple<T...> &x) {
        read(get<0>(x));
    }
    template <class... T>
    static inline void _write(const tuple<T...> &x) {
        write(get<0>(x));
    }
};
template <class... T>
inline void read(tuple<T...> &x) {
    _tuple_io_helper<sizeof...(T)>::_read(x);
}
template <class... T>
inline void write(const tuple<T...> &x) {
    _tuple_io_helper<sizeof...(T)>::_write(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 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) {
    print(x), pc(32), print(y...);
}
template <class... T>
inline void print_cstr(const char *x, const T *...y) {
    print_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);
}
}  // namespace FastIO
using namespace FastIO;
template <typename T>
inline void clear(T &x) {
    T y;
    swap(x, y);
}
const int N = 2e5 + 10;
// void build(int u, int L, int R) {
    // if (L == R) return;
// }
// void update(int u, int L, int R, int l, int r) {
// 
// }

template <uint32_t mod = 998244353>
class Modint {
   private:
    static constexpr uint32_t get_r() {
        uint32_t ret = mod;
        for (int i = 0; i < 4; i++) ret *= 2 - mod * ret;
        return ret;
    }
    static constexpr uint32_t r = get_r();
    static constexpr uint32_t n2 = -uint64_t(mod) % mod;
    static_assert(r * mod == 1 && mod < (1 << 30) && mod & 1);
    uint32_t data;

   public:
    constexpr Modint() : data(0) {}
    template <class int_t>
    constexpr Modint(const int_t x)
        : data(reduce(
              uint64_t((sizeof(int_t) < sizeof(uint32_t) ? x : x % int_t(mod)) +
                       mod) *
              n2)){};
    static constexpr uint32_t reduce(const uint64_t x) {
        return (x + uint64_t(uint32_t(x) * (-r)) * mod) >> 32;
    }
    constexpr Modint &operator+=(const Modint &r) {
        if (int32_t(data += r.data - 2 * mod) < 0) {
            data += 2 * mod;
        }
        return *this;
    }
    constexpr Modint &operator-=(const Modint &r) {
        if (int32_t(data -= r.data) < 0) {
            data += 2 * mod;
        }
        return *this;
    }
    constexpr Modint &operator*=(const Modint &r) {
        return data = reduce((uint64_t)data * r.data), *this;
    }
    constexpr Modint &operator/=(const Modint &r) { return *this *= r.inv(); }
    constexpr friend Modint operator+(Modint l, const Modint &r) {
        return l += r;
    }
    constexpr friend Modint operator-(Modint l, const Modint &r) {
        return l -= r;
    }
    constexpr friend Modint operator*(Modint l, const Modint &r) {
        return l *= r;
    }
    constexpr friend Modint operator/(Modint l, const Modint &r) {
        return l /= r;
    }
    constexpr friend bool operator==(Modint l, const Modint &r) {
        return l.value() == r.value();
    }
    constexpr Modint operator-() const { return Modint() - Modint(*this); }
    template <class int_t>
    constexpr Modint pow(int_t r) const {
        Modint res(1), w(*this);
        for (; r; r >>= 1, w *= w)
            if (r & 1) res *= w;
        return res;
    }
    constexpr Modint inv() const { return pow(mod - 2); }
    constexpr uint32_t value() const {
        uint32_t res = reduce(data);
        return res >= mod ? res - mod : res;
    }
};
using modint = Modint<>;
modint pw[N], ipw[N];
vector<tuple<int, int, int> > vec[N];
int n, q;
modint ans[N];
char str[N];
bool f[20][N][2], g[20][N][2];
int lcp[N][2], lcs[N][2], s[N];

struct Matrix {
    modint mat[3][3];
    inline Matrix operator*(Matrix b) {
        Matrix ans;
        for (int k = 0; k < 3; k++) 
            for (int i = 0; i < 3; i++)
                for (int j = 0; j < 3; j++) ans.mat[i][j] += mat[i][k] * b.mat[k][j];
        return ans;
    }
} tag[N << 2], I;
struct Hang{
    modint mat[3];
    inline Hang operator*(Matrix b) {
        Hang ans;
        for (int k = 0; k < 3; k++)
            for (int i = 0; i < 3; i++) ans.mat[i] += mat[k] * b.mat[k][i];
        return ans;
    }
    inline Hang operator+(Hang b) {
        return {mat[0] + b.mat[0], mat[1] + b.mat[1], mat[2] + b.mat[2]};
    }
} w[N << 2];
bool vis[N];
modint pa[N], pb[N];
inline void maketag(int u, Matrix v) {
    vis[u] = 1, tag[u] = tag[u] * v, w[u] = w[u] * v;
}
inline void pushdown(int u) {
    if (vis[u]) vis[u] = 0, maketag(u << 1, tag[u]), maketag(u << 1 | 1, tag[u]), tag[u] = I;
}
void build(int u, int L, int R) {
    tag[u] = I;
    if (L == R) {
        w[u].mat[0] = pw[s[R - 1]];
        return;
    }
    int M = L + R >> 1;
    build(u << 1, L, M), build(u << 1 | 1, M + 1, R);
    w[u] = w[u << 1] + w[u << 1 | 1];
}
vector<pair<int, int> > que[N];
void update(int u, int L, int R, int l, int r, Matrix v) {
    if (L >= l && R <= r) return maketag(u, v);
    if (L > r || R < l) return;
    int M = L + R >> 1;
    pushdown(u);
    update(u << 1, L, M, l, r, v), update(u << 1 | 1, M + 1, R, l, r, v);
    w[u] = w[u << 1] + w[u << 1 | 1];
}
inline modint query(int u, int L, int R, int l, int r) {
    if (L >= l && R <= r) return w[u].mat[2];
    if (L > r || R < l) return 0;
    int M = L + R >> 1;
    pushdown(u);
    return query(u << 1, L, M, l, r) + query(u << 1 | 1, M + 1, R, l, r);
} 
int main() {
    for (int i = 0; i < 3; i++) I.mat[i][i] = 1;
    read(n, q);
    for (int i = 0; i <= n; i++) pw[i] = modint(2).pow(i), ipw[i] = pw[i].inv();
    read_cstr(str + 1);
    for (int i = 1; i <= q; i++) {
        int l, r;
        read(l, r), ++l, ++r, que[r].emplace_back(l, i);
    }
    for (int i = 1; i <= n; i++) s[i] = s[i - 1] + (str[i] == '?');
    for (int i = n; i; i--) {
        if (str[i] != '1') f[0][i][0] = 1;
        if (str[i] != '0') f[0][i][1] = 1;
        for (int j = 1; j < 20; j++)
            if ((i + (1 << j)) - 1 <= n) {
                f[j][i][0] |= f[j - 1][i][0] && f[j - 1][i + (1 << j - 1)][1];
                f[j][i][1] |= f[j - 1][i][1] && f[j - 1][i + (1 << j - 1)][0];
            }
        for (int p = 0; p <= 1; p++) {
            int pos = -1;
            for (int j = 19; ~j; j--)
                if (f[j][i][p]) { pos = j; break; }
            if (pos == -1) continue;
            bool fl = p ^ 1;
            lcp[i][p] = 1 << pos;
            // if (i == 1 && p == 1) cerr << "find youmo:" << i << ' ' << pos << endl;
            while (pos) {
                pos--;
                // if (i == 1 && p == 1) cerr << "find qiqi:" << f[pos][i + lcp[i][p]][fl] << ' ' << fl << endl;
                if (f[pos][i + lcp[i][p]][fl]) fl ^= 1, lcp[i][p] += 1 << pos;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        if (str[i] != '1') g[0][i][0] = 1;
        if (str[i] != '0') g[0][i][1] = 1;
        for (int j = 1; j < 20; j++)
            if ((i - (1 << j)) + 1 <= n) {
                g[j][i][0] |= g[j - 1][i][0] && g[j - 1][i - (1 << j - 1)][1];
                g[j][i][1] |= g[j - 1][i][1] && g[j - 1][i - (1 << j - 1)][0];
            }
        for (int p = 0; p <= 1; p++) {
            int pos = -1;
            for (int j = 19; ~j; j--)
                if (g[j][i][p]) { pos = j; break; }
            if (pos == -1) continue;
            bool fl = p ^ 1;
            lcs[i][p] = 1 << pos;
            while (pos) {
                pos--;
                if (g[pos][i - lcs[i][p]][fl]) fl ^= 1, lcs[i][p] += 1 << pos;
            }
        }
    }
    for (int i = 1; i <= n; i++) {
        vec[i].emplace_back(i, i, 1), vec[i + 1].emplace_back(i, i, -1);
        if (str[i] == '?')
        vec[i].emplace_back(i, i, 1), vec[i + 1].emplace_back(i, i, -1);

    }
    // cerr << "find zqs:" << f[2][1][0] << endl;
    // for (int i = 1; i <= n; i++) cerr << lcp[i][0] << ' '; cerr << endl;
    // for (int i = 1; i <= n; i++) cerr << lcp[i][1] << ' '; cerr << endl;
    // for (int i = 1; i <= n; i++) cerr << lcs[i][0] << ' '; cerr << endl;
    // for (int i = 1; i <= n; i++) cerr << lcs[i][1] << ' '; cerr << endl;
    // cerr << lcp[1] << ' ' << lcs[1] << endl;
    for (int i = 2; i <= n; i++) {
        for (int p = 0; p < 2; p++)
            for (int q = 0; q < 2; q++) if (lcs[i - 1][p] && lcp[i][q]) {
                int l = i - lcs[i - 1][p], r = i + lcp[i][q] - 1;
                // cerr << "find zhangjunyoutl:" << l << ' ' << i << ' ' << r << endl;
                vec[i].emplace_back(l, i - 1, 1);
                vec[r + 1].emplace_back(l, i - 1, - 1);
            }
    }
    for (int k = 0; (1 << k) <= n; k++) {
        for (int i = 1; i <= (n - (1 << k) + 1); i++)
            for (int p = 0; p < 2; p++) if (f[k][i][p]) {
                int lenl = lcs[i - 1][(p ^ k) & 1], lenr = lcp[i + (1 << k)][p ^ 1];
                if (!lenr || !lenl) continue;
                // cerr << "find del:" << i << ' ' << lenl << ' ' << lenr << endl;
                chkmin(lenl, (1 << k)), chkmin(lenr, (1 << k));
                vec[i + (1 << k)].emplace_back(i - lenl, i - 1, -1);
                vec[i + (1 << k) + lenr].emplace_back(i - lenl, i - 1, 1);
            }
    }
    build(1, 1, n);
    for (int i = 1; i <= n; i++) {
        for (auto [l, r, v] : vec[i]) {
            // cerr << "find zhangjunyoudatanglong:" << i << ' ' << l << ' ' << r << ' ' << v << endl;
            update(1, 1, n, l, r, {1, modint(v), 0, 0, 1, 0, 0, 0, 1});
            // for (int j = l; j <= r; j++) pa[j] += v;
        }
        // cerr << "find youmo:" << w[1].mat[0].value() << ' ' << w[1].mat[1].value() << endl;
        maketag(1, {1, 0, 0, 0, 1, modint(ipw[s[i]]), 0, 0, 1});
        // for (int j = 1; j <= n; j++) pb[j] += pa[j] * pw[s[j - 1]] * ipw[s[i]];
        // cerr << "find youmo:" << w[1].mat[2].value() << endl;
        for (auto [l, id] : que[i]) {
            modint res = 0;
            // cerr << "find youmo:" << l << ' ' << id << endl;
             ans[id] = query(1, 1, n, l, i) * pw[s[i] - s[l - 1]];
            // for (int j = l; j <= i; j++) res += pb[j];
            // ans[id] = res * pw[s[i] - s[l - 1]];
        }
    }
    for (int i = 1; i <= q; i++) println(ans[i].value());
    return 0;
}
// A + B + C

/*

1 1
?
0 0

4 4
??00
0 0
0 1
0 2
0 3
*/
// B common / flip

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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:

25763
2344
113
56213
56213
12974
4542
6
672
5191
11880
2
60607
11880
36

result:

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

Subtask #2:

score: 0
Wrong Answer

Test #7:

score: 0
Wrong Answer
time: 15ms
memory: 22120kb

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:

1331395
137493
235122
106825
4450
235122
5875
140883
11
28913
146
1346
2
140883
3235
2595
540
3235
1342053
540
1346
297101
108638
1
108
55545
235122
497
299729
1331395
9129
257901
13027
299729
206
28432
65311
55545
73
12225
4709
4007
474
2827043
137493
48954
1342053
73
133531
412
28162
299729
282704...

result:

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

Subtask #3:

score: 0
Wrong Answer

Test #13:

score: 0
Wrong Answer
time: 222ms
memory: 40640kb

input:

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

output:

16
18
62
23
5
80
41
110
106
61
24
9
140
189
42
95
49
3
49
149
10
16
7
24
27
19
44
99
9
101
21
41
3
68
115
114
93
1
64
54
12
107
7
5
167
48
157
7
24
114
106
5
43
6
37
76
177
329
78
71
42
44
1
124
87
113
44
23
67
79
41
158
9
54
3
3
87
1
1
7
146
43
32
120
9
1
95
114
2
13
15
87
3
46
71
33
1
46
125
36
10...

result:

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

Subtask #4:

score: 0
Wrong Answer

Test #19:

score: 0
Wrong Answer
time: 171ms
memory: 35272kb

input:

50000 1
0101101001100101100110100110010110100101100110100110010110011010010110100110010110011010011001011010010110011010010110100110010110100101100110100110010110011010010110100110010110011010011001011010010110011010011001011001101001011010011001011010010110011010010110100110010110011010011001011010...

output:

141371136

result:

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

Subtask #5:

score: 0
Wrong Answer

Test #25:

score: 0
Wrong Answer
time: 161ms
memory: 33900kb

input:

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

output:

62202308

result:

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

Subtask #6:

score: 0
Wrong Answer

Test #31:

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

input:

500 1000
011000100010010010010010110010101100101100101011010010011001101001011010011000010011010001011010000001100101100110100101101001001011010010110010110100101100111001100111010011010010110100110010110100101100110101000101100110100110010110100101100110100101101?01101101100101011001010010100110010...

output:

406
1849
1521
911
2215
23514
15226
21878
5144
12130
7450
16926
1706
23546
23474
5797
23730
537
10290
23490
2351
15222
379
973
8878
1980
345
16354
14878
2848
21010
754
18306
23230
21810
22726
18298
24106
3
17478
20018
484
8502
14926
20350
336
1381
12450
24282
20922
19574
20894
5414
4113
20782
1549
54...

result:

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

Subtask #7:

score: 0
Wrong Answer

Test #37:

score: 0
Wrong Answer
time: 4ms
memory: 18340kb

input:

1000 2000
01100101101001011001101001011010011001011010010110011010011001011001101001011010011001011010010110011010000110100101101001100101100110100110010110100101100110100110010110011010010110100110010110100101100110100101101001100101100110100110010110100101100110100101101001100101101001011001101001...

output:

2951
683608
667944
12206816
5587
12008
11884512
636408
635272
294660
298668
135958
142334
714664
14739
14670
606648
11847392
4700
614752
108778
116706
142806
1847
5827
5828528
11907040
114622
3589
11815904
52671
11902688
2008
51335
142882
8944
145130
5513
2096
22453
18884
144294
109530
52845
119410
...

result:

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

Subtask #8:

score: 0
Wrong Answer

Test #43:

score: 0
Wrong Answer
time: 143ms
memory: 24360kb

input:

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

output:

917236499
938990217
971022999
554851016
181715280
908599565
546691770
255642236
350632401
637866763
166343858
683033814
718229119
422838464
146119838
444951922
65736136
508960351
784761148
970445740
899362097
852274767
253648149
877018129
70240999
790344143
522918273
37396133
247133429
795717452
343...

result:

wrong answer 21st numbers differ - expected: '912502388', found: '899362097'

Subtask #9:

score: 0
Wrong Answer

Test #49:

score: 0
Wrong Answer
time: 639ms
memory: 38348kb

input:

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

output:

432632766
561837857
429312426
316281860
600283847
700682075
671820803
305236310
129606260
7400649
536547069
473575544
827598523
382317661
613685742
367483150
45227847
60125382
527132526
659141841
450210579
443056501
253663931
252824246
44415041
611796832
580201744
450068799
139060093
943151257
41885...

result:

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

Subtask #10:

score: 0
Wrong Answer

Test #55:

score: 0
Wrong Answer
time: 507ms
memory: 39684kb

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:

528854378
959504795
690071241
714607447
830993969
874968817
769287120
63289655
375112882
460077267
564163500
415607001
724801731
768088459
878629258
571714477
438156183
753338346
841255387
847792648
600391892
176030474
786119481
986092467
748655378
138578921
685943050
564831858
709912790
514336490
3...

result:

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