QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#868170#9684. 倾诉zhaohaikun100 ✓1913ms13352kbC++2312.0kb2025-01-24 14:08:382025-01-24 14:08:40

Judging History

This is the latest submission verdict.

  • [2025-01-24 14:08:40]
  • Judged
  • Verdict: 100
  • Time: 1913ms
  • Memory: 13352kb
  • [2025-01-24 14:08:38]
  • Submitted

answer

// MagicDark
#include <bits/stdc++.h>
// #define mid ((l + r) >> 1)
// #define lc num << 1
// #define rc lc | 1
// #define li lc, l, mid
// #define ri rc, mid + 1, r
// #define debug cerr << "\33[32m[" << __LINE__ << "]\33[m "
#define all(x) x.begin(), x.end()
#define SZ(x) ((int) x.size() - 1)
#define ms(x, y) memset(x, y, sizeof x)
#define F(i, x, y) for (int i = (x); i <= (y); ++i)
#define DF(i, x, y) for (int i = (x); i >= (y); --i)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
template <typename T> T& chkmax(T& x, T y) {return x = max(x, y);}
template <typename T> T& chkmin(T& x, T y) {return x = min(x, y);}
template <typename T> T& read(T& x) {
    x = 0; int f = 1; char c = getchar();
    for (; !isdigit(c); c = getchar()) if (c == '-') f = - 1;
    for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
    return x *= f;
}
// mt19937_64 mrand(20070124);
mt19937_64 mrand(20071211);
ll rnd(ll l, ll r) {
    return mrand() % (r - l + 1) + l;
}
const int N = 2e4 + 1010, INF = 1e9 + 10, T = 21, K = T + 5;
const int MOD = 1e9 + 7, inv2 = (MOD + 1) >> 1;
int n, k, a[N], lim[N][K], pw[N * 2], ipw[N * 2], ts[N], pos[N];
int tl[N][K], tr[N][K], wt[N][K];
int qq(int x) {
    return x < 0 ? ipw[- x] : pw[x];
}
int qw(int l, int r) {
    if (r - l + 1 <= T) return wt[r][r - l + 1];
    // int w = 0;
    // F(i, l, r) w = (w + a[i]) / 2;
    // if (w != wt[T][r] + (l <= pos[r])) {
    //     debug << l << " " << r << endl;
    //     debug << w << " " << wt[T][r] << " " << (l <= pos[r]) << endl;
    // }
    // assert(w == wt[T][r] + (l <= pos[r]));
    return wt[r][T] + (l <= pos[r]); 
}
int calc(int a, int b, int c, int t) {
    int d = c - t;
    if (d <= a) {
        return (ll) (ts[b] - ts[a - 1] + MOD) * qq(- a + (a - d)) % MOD;
    }
    // debug << d << endl;
    if (d > b) {
        int delta = d - b - 1;
        if (delta > 30) return 0;
        // int val = wt[min(T, b - a + 1)][b];
        return qw(a, b) >> delta;
    }
    int val = ((ll) (ts[b] - ts[d - 1] + MOD) * qq(- d) + qw(a, d - 1)) % MOD;
    return val;
}
// int cw(int a, int b, int c, int t) {
//     int d = c - t;
//     if (d <= a) {
//         debug << "A\n";
//         return (ll) (ts[b] - ts[a - 1] + MOD) * qq(- a + (a - d)) % MOD;
//     }
//     // debug << d << endl;
//     if (d >= b) {
//         // debug << "B\n";
//         int delta = d - b;
//         if (delta > 30) return 0;
//         // int val = wt[min(T, b - a + 1)][b];
//         return wt[min(T, b - a + 1)][b] >> delta;
//     }
//     // debug << a << " " << d << " " << b << " " << wt[min(T, (d - 1) - a + 1)][d - 1] / 2 << endl;
//     int w = 0;
//     F(i, a, d - 1) {
//         w = (w + ::a[i]) / 2;
//     }
//     // debug << w << endl;
//     // debug << "C\n";
//     int val = ((ll) (ts[b] - ts[d - 1] + MOD) * qq(- d) + (wt[min(T, (d - 1) - a + 1)][d - 1] / 2)) % MOD;
//     return val;
// }
int cc(int a, int b, int c, int t) {
    int x1 = calc(a, b, c, t), x2 = calc(a, b, c, t - 1);
    int val = (x1 - x2 * 2 + MOD * 2ll) % MOD;
    // if (val != 0 && val != 1) {
    //     // cw(a, b, c, t), cw(a, b, c, t - 1);
    //     debug << a << " " << b << " " << c << " " << t << ": " << val << " " << x1 << " " << x2 << endl;
    // }
    // assert(val == 0 || val == 1);
    return val;
}
// int info[N << 2];
// void modify(int num, int l, int r, int x, int y) {
//     if (l == r) {
//         info[num] = y;
//         return;
//     }
//     if (mid)
// }
struct szsz {
    int t[N];
    void init() {
        F(i, 1, n + 1) t[i] = INF;
    }
    void mdf(int x, int y) {
        x++;
        for (; x; x ^= x & - x) chkmin(t[x], y);
    }
    int query(int x) {
        x++;
        // if (x == 0) return - 1;
        int ans = INF;
        for (; x <= n; x += x & - x) chkmin(ans, t[x]);
        return ans;
    }
} ds;
int dp[N];//, ans[N];
bool ff[N][K];
// void print() {
//     F(i, 1, n) {
//         F(j, 1, min(i, T)) {
//             // if (tl[i][j] <= tr[i][j]) 
//             debug << i - j + 1 << " " << i << ' ' << tl[i][j] << " " << tr[i][j] << endl;
//         }
//     }
// }
void zhk() {
    read(n), read(k);
    F(i, 1, n) read(a[i]);
    // F(i, n + 1, n + T) a[i] = 0;
    pw[0] = ipw[0] = 1;
    F(i, 1, n * 2) {
        pw[i] = 2 * pw[i - 1] % MOD;
        ipw[i] = (ll) inv2 * ipw[i - 1] % MOD;
    }
    F(i, 1, n) {
        ts[i] = (ts[i - 1] + (ll) pw[i] * a[i]) % MOD;
    }
    F(i, 1, n) {
        F(j, 1, min(i, T)) {
            tl[i][j] = 1;
            tr[i][j] = i - j + 1;
            // lim[i][j] = i - j + 1;
            int cur = 0;
            DF(k, j, 1) {
                cur = (cur + a[i - k + 1]) / 2;
            }
            wt[i][j] = cur;
        }
        if (i > T) {
            ll v = wt[i][T] + 1;
            DF(j, i, i - T + 1) {
                v = v * 2 - a[j];
                if (v > INF) break;
            }
            pos[i] = 0;
            if (v <= INF) {
                int pp = i - T;
                F(j, 1, min(T, pp))
                    if (wt[pp][j] >= v) {
                        pos[i] = pp - j + 1;
                        break;
                    }
                if (!pos[i]) {
                    if (wt[pp][min(T, pp)] + 1 == v) pos[i] = pos[pp];
                }
            }
            // if (pos[i]) {
            //     debug << i << " " << pos[i] << endl;
            // }
        }
        // F(j, max(1, i - T), i - 1) {
        //     cur = (cur + a[j]) / 2;
        // }
        // wt[i] = cur;
    }
    // debug << calc(6, 10, 10, 1) << endl;
    // exit(0);
    int lsta = - 1, lstb, lstc;
    // int wcnt = 0;
    // print();
    while (true) {
        // wcnt++;
        // if (++wcnt > 10) assert(0);
        ll s = 0;
        F(i, 1, n) {
            F(j, 1, min(i, T)) if (tl[i][j] <= tr[i][j]) {
                s += tr[i][j] - tl[i][j] + 1;
            }
        }
        // debug << s << endl;
        if (!s) break;
        ll pos = rnd(1, s);
        auto solve = [&] (int a, int b, int c) {
            ds.init();
            ds.mdf(0, - 1);
            F(i, 1, n) {
                dp[i] = INF;
                F(j, 1, min(i, T)) {
                    ff[i][j] = false;
                    int t = i - j + 1;
                    // int tl = - T, tr = n + 1;
                    // while (tl + 1 < tr) {
                    //     int mid = (tl + tr) >> 1;
                    //     if (calc(a, b, c, mid) == calc(1, i - j + 1, i, mid)) tl = mid;
                    //     else tr = mid;
                    // }
                    // int t1 = calc(a, b, c, tl), t2 = calc(1, i - j + 1, i, tl);
                    // assert(t1 != t2);
                    // int lim;
                    // if (!t2) {
                    //     lim = 1;
                    // } else {
                    //     int d = i - tl;
                    //     lim = max(1, );
                    // }
                    int wl = tl[i][j] - 1, wr = tr[i][j] + 1;
                    int kl = - T, kr = - T;
                    while (wl + 1 < wr) {
                        int wmid = (wl + wr) >> 1;
                        int pl = min(kl, kr);//, pr = n + 1;
                        int p = 0;
                        while (true) {
                            int pmid = pl + (1 << p);
                            if (pmid > n || calc(a, b, c, pmid) != calc(wmid, t, i, pmid)) break;
                            pl = pmid;
                            p++;
                        }
                        while (p) {
                            p--;
                            int pmid = pl + (1 << p);
                            if (pmid <= n && calc(a, b, c, pmid) == calc(wmid, t, i, pmid)) pl = pmid;
                        }
                        // while (pl + 1 < pr) {
                        //     int pmid = (pl + pr) >> 1;
                        //     if (calc(a, b, c, pmid) == calc(wmid, t, i, pmid)) pl = pmid;
                        //     else pr = pmid;
                        // }
                        // if (t == 2 && i == 3) {
                        //     debug << a << " " << b << " " << c << endl;
                        //     debug << wmid << " " << t << ' ' << i << endl;
                        //     debug << wmid << ' ' << pr << endl;
                        // }
                        if (pl == n) {
                            ff[i][j] = true;
                            wr = wmid;
                            break;
                        } else {
                            // int t1 = cc(a, b, c, pr), t2 = cc(wmid, t, i, pr);
                            // debug << t1 << ' ' << t2 << endl;
                            // assert(t1 != t2);
                            if (!cc(wmid, t, i, pl + 1)) {
                                kr = pl;
                                wr = wmid;
                            } else {
                                kl = pl;
                                wl = wmid;
                            }
                        }
                        // int lim;
                        // if (!t2) {
                        //     lim = 1;
                        // } else {
                        //     int d = i - tl;
                        //     lim = max(1, );
                        // }
                    }
                    // if (t == 2 && i == 3) {
                    //     debug << wr << endl;
                    // }
                    lim[i][j] = wr;
                    // if (a == 1 && b == 1 && c == 1) {
                    //     debug << t << " " << i << " " << wr << endl;
                    // }
                    if (wr != t + 1) {
                        int val = ds.query(wr - 1) + i - (t + 1);
                        if (val < dp[t]) {
                            ds.mdf(t, dp[t] = val);
                        }
                    }
                }
                // if (a == 1 && b == 1 && c == 1) {
                //     debug << i << " " << dp[i] + (i + 1) << endl;
                // }
            }
            // debug << c - b + 1 << ' ' << c << endl;
            // debug << tl[c - b + 1][c] << " " << tr[c - b + 1][c] << endl;
            // debug << dp[n] + (n + 1) << endl;
            if (dp[n] + (n + 1) <= k) {
                // debug << "!\n";
                lsta = a, lstb = b, lstc = c;
                F(i, 1, n) {
                    F(j, 1, min(i, T)) {
                        tl[i][j] = lim[i][j];
                        if (ff[i][j]) tl[i][j]++;
                    }
                }
            } else {
                F(i, 1, n) {
                    F(j, 1, min(i, T)) {
                        tr[i][j] = lim[i][j] - 1;
                        // if (ff[i][j]) tr[i][j]--;
                    }
                }
            }
            // print();
            // debug << "# " << a << " " << b << " " << c << " " << lim[c - b + 1][c] << '\n';
            // debug << tl[c - b + 1][c] << " " << tr[c - b + 1][c] << endl;
        };
        auto work = [&] () {
            F(i, 1, n) {
                F(j, 1, min(i, T)) if (tl[i][j] <= tr[i][j]) {
                    int len = tr[i][j] - tl[i][j] + 1;
                    if (pos <= len) {
                        // debug << tl[i][j] << " " << tr[i][j] << " " << len << " " << pos << endl;
                        solve(tl[i][j] + pos - 1, i - j + 1, i);
                        return;
                    } else pos -= len;
                }
            }
            // assert(false);
        };
        work();
        // exit(0);
    }
    // cerr << wcnt << endl;
    // assert(lsta != - 1);
    bool flag = false;
    F(i, - T, n) {
        int ans = cc(lsta, lstb, lstc, i);
        if (!flag) {
            if (ans) flag = true;
        }
        if (flag) cout << ans;
    }
    cout << '\n';
}
signed main() {
    int _; read(_);
    while (_--) zhk();
    return 0;
}
/* why
*/

详细

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 0ms
memory: 11856kb

input:

5
6 1
11764 28428 28179 18698 6443 20288
6 3
29 17548 61962 31242 8172 4107
6 15
7 2 239427 137145 171239 3
6 4
294 211 407 190 2 2
6 5
197190 265870 12121 144584 21313 14169

output:

110111100001100000000
101110011000100110000
11101001110100001100000
11000110110000
10100110100010001101100

result:

ok 5 lines

Test #2:

score: 2
Accepted
time: 0ms
memory: 9812kb

input:

3
10 9
11333 23 34461 34357 354 4 3 55 3 3
10 13
5 17524 48186 2193 17524 17524 20914 15829 17524 6
10 5
128279 27396 7992 44204 132529 84302 26783 3378 42535 3786

output:

11010110100011011110
101111000011101000000000
11010100100010110010000000

result:

ok 3 lines

Test #3:

score: 2
Accepted
time: 0ms
memory: 11860kb

input:

1
30 23
129534 106530 312047 478493 635175 682687 771242 851161 898940 103771 4 22344 668706 758190 219263 803071 787124 804602 997769 398659 874234 1 845912 226469 600617 203296 540318 171121 5 103637

output:

1011110001001010101000000000000000000000000000000

result:

ok single line: '1011110001001010101000000000000000000000000000000'

Test #4:

score: 2
Accepted
time: 0ms
memory: 11856kb

input:

1
30 20
24369 112417 273642 91342 16920 82890 51488 110843 350768 2127 32310 317716 289575 345557 10461 133151 237824 131339 154529 77796 16773 128740 561207 292189 244465 178375 50425 149932 60698 32020

output:

100000110011011000011001110000000000000000000000

result:

ok single line: '100000110011011000011001110000000000000000000000'

Test #5:

score: 2
Accepted
time: 0ms
memory: 11864kb

input:

1
30 22
5164 3437 1409 1477 1234 290 641 8387 2389 4783 1704 1430 2859 422 368 348 3778 2161 1898 964 357 763 380 3870 6050 1136 3613 1747 975 131

output:

11100100111010100100000000000000000000000

result:

ok single line: '11100100111010100100000000000000000000000'

Test #6:

score: 2
Accepted
time: 0ms
memory: 11860kb

input:

1
30 16
78284 104679 51060 38372 468848 144187 84013 249991 72147 295666 63152 22000 35446 88085 67085 19719 4766 988 384917 450684 101500 548119 105206 420503 54774 10663 13882 48365 104067 33372

output:

11100010001001000011101010000000000000000000000

result:

ok single line: '11100010001001000011101010000000000000000000000'

Test #7:

score: 2
Accepted
time: 0ms
memory: 11860kb

input:

1
30 20
93587 95074 833612 98114 468073 405234 294453 151570 336309 555067 71292 497114 301076 302914 130800 17777 145963 834497 152338 526181 242311 266037 315170 36843 72099 59791 95401 96269 181758 156382

output:

111011010101101111000000101010000000000000000000

result:

ok single line: '111011010101101111000000101010000000000000000000'

Test #8:

score: 2
Accepted
time: 0ms
memory: 11864kb

input:

1
30 20
7 5 5 2 5 2 4 2 1 8 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 244222 8 6 8 1

output:

111011101000110110010001100000001000000000000

result:

ok single line: '111011101000110110010001100000001000000000000'

Test #9:

score: 2
Accepted
time: 0ms
memory: 11860kb

input:

1
30 30
1486 898 1035 2327 2777 3385 4083 330 2925 3348 1324 826 3223 3418 45 184 54 591 44 4301 4453 1558 601 1914 2114 8 1 93 7 6

output:

10011001000001011100000000000000000000

result:

ok single line: '10011001000001011100000000000000000000'

Test #10:

score: 2
Accepted
time: 0ms
memory: 11872kb

input:

1
30 132
999998 999998 999999 999999 1000000 1000000 1000000 1000000 999999 1000000 999999 1000000 999998 999999 999999 999999 999998 1 1 1 1 1 1 1 1 1 1 1 1 1

output:

10110111000110101111000000000000000000

result:

ok single line: '10110111000110101111000000000000000000'

Subtask #2:

score: 10
Accepted

Dependency #1:

100%
Accepted

Test #11:

score: 10
Accepted
time: 0ms
memory: 11860kb

input:

33
6 1
2201 30891 22926 51021 5381 1953
6 1
17621 35116 7069 5597 24627 4779
6 8
6 19015 19015 19015 19015 2
6 4
19047 11041 11837 2027 1116 2645
6 7
117530 117530 117530 117530 117530 4
6 5
26692 20497 5915 6516 6714 1098
6 7
348470 348470 348470 348470 348470 7
6 3
2 1 2378 4 107252 2
6 2
9325 369...

output:

111100010101011100000
110000000110011000000
10010100100101100000
1110111101011010100
1110010110010001000000
10001011101010100100
101010100010100010000000
1101000101111100000000
1001001101001001000000
10100110001010100000
1111111101011100000
1110110000100000000
1000010001100101000000
1010011111111001...

result:

ok 33 lines

Test #12:

score: 10
Accepted
time: 2ms
memory: 11856kb

input:

20
10 10
7398 2663 2 28570 2 2 2 2 2 3
10 10
5 4 486615 486615 486615 521695 469075 486615 486615 7
10 5
5132 160984 19067 83543 351799 157254 40607 16829 39349 21513
10 3
2234 2158 11383 7501 3047 737 626 4487 5017 4908
10 5
31661 111680 91073 9607 12095 42688 118218 47360 392 51408
10 3
28734 5994...

output:

1110111000011011000
1111111010111011111000000000
110000100111001110000000000
10101101101101010000000
11010001011110101100000000
111000110111001000000000000
11111011001001000000000000
11110011101111100000000
1000111111101100000000000
1110010101000111001000000000
11100111110110011100000
10110011111001...

result:

ok 20 lines

Test #13:

score: 10
Accepted
time: 1ms
memory: 9816kb

input:

8
25 15
2317 3833 9894 20350 54995 518 77 9839 15551 281 5127 13100 16 13930 16 16 3872 44999 28972 30892 63777 36955 9212 13452 6
25 24
99488 111510 114067 99889 114169 167030 178257 168039 292710 214341 275210 350436 319813 436188 410390 450309 445475 482666 516698 666862 623999 693281 692643 7096...

output:

110110011010100000000000000000000000000
10101101010000100100000000000000000000000000
111001101011010001100000010000
1000010011011111000000000000000000000
11111000000101000000000000000000000000000
10110110001100111011110110000000000000000
111010000000000000000000000000
1001101000001101010101000000000...

result:

ok 8 lines

Test #14:

score: 10
Accepted
time: 4ms
memory: 11880kb

input:

4
50 34
95 81 35 25 62 110 1410 59 3104 7106 65431 5351 95886 127301 256 73557 41 38 60 43 55 8 32 3661 6459 5863 1242 1188 9 32402 14 11 11 13 62993 14 121264 128664 122950 6617 40500 44292 7 5 2 4 4 5 4 2
50 29
5982 32011 27127 38729 45979 27737 46199 11445 36544 9629 104678 220775 12741 46011 468...

output:

10110111110110010010110100000000000000000000000000000000000000
110001110111011000110111000100000000000000000000000000000000000000
11100001000000000000000000000000000000000000000000000000000
101010011111110001111111111110101011000000110110000000000000000000

result:

ok 4 lines

Test #15:

score: 10
Accepted
time: 3ms
memory: 9816kb

input:

1
200 104
824019 802339 516620 688752 477193 458691 362601 284661 179293 149012 114733 46386 997099 937623 842616 725675 526621 419116 944566 8 947114 835410 880188 817427 933050 781449 749967 709476 674043 659058 694092 595430 606209 578012 589236 565119 563253 538372 527012 506608 471302 379419 40...

output:

1001100000110100001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '100110000011010000110000000000...0000000000000000000000000000000'

Test #16:

score: 10
Accepted
time: 2ms
memory: 9812kb

input:

1
200 146
355620 195534 77535 30471 502788 155147 125612 229317 59146 35958 136590 392319 137199 221090 93946 193044 208968 65713 32921 34906 560844 303977 333461 45377 307699 32096 20279 14237 52638 123530 354319 215336 213842 201158 82292 20137 152410 383905 334181 24694 15921 115128 62545 573156 ...

output:

10100000001001011010010010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '101000000010010110100100101000...0000000000000000000000000000000'

Test #17:

score: 10
Accepted
time: 3ms
memory: 11856kb

input:

1
200 180
12027 63296 71968 12762 26117 176085 211676 816605 431465 442615 490565 215621 95221 222871 242713 425042 582819 517932 492219 142280 472292 318760 574570 296860 539417 501497 381830 456540 281725 588426 261330 95874 726762 153818 453674 253818 265931 435468 249789 503978 214586 484730 143...

output:

11001110111001010110011100101110111000110010101100111001101111011111111000011101111110011100110001000001100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '110011101110010101100111001011...0000000000000000000000000000000'

Test #18:

score: 10
Accepted
time: 4ms
memory: 11808kb

input:

1
200 240
7 8 1 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 652114 6521...

output:

1110111011001111101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '111011101100111110110000000000...0000000000000000000000000000000'

Test #19:

score: 10
Accepted
time: 5ms
memory: 9812kb

input:

1
200 279
1 2 5 6 2 3 1 2 7 3 3 3 3 3 4 7 2 3 3 5 7 2 5 6 3 2 5 6 7 7 4 2 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 228606 22...

output:

1010011101101111101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '101001110110111110100000000000...0000000000000000000000000000000'

Test #20:

score: 10
Accepted
time: 6ms
memory: 11844kb

input:

1
200 169
7353 7753 5155 4759 7316 4440 14772 7931 1421 7350 9161 7156 4525 5978 15883 5924 7913 16372 4068 180432 147014 84712 135022 120070 247413 245415 113692 93943 198658 256478 234505 120986 19909 103949 11457 38642 49133 3222 41930 67973 30301 84413 63309 31681 97310 35350 30751 4 63053 3 205...

output:

110101010011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '110101010011110000000000000000...0000000000000000000000000000000'

Test #21:

score: 10
Accepted
time: 4ms
memory: 9812kb

input:

1
200 130
246 53 27 161 162 209 66 36 28 207 250 247 127 18 72 155 1182 1155 1644 396 312 1318 915 1377 760 1367 1814 1668 823 514 1334 1597 1459 604 806 1875 1468 243 298 502 1203 1237 1299 1575 1983 1603 1453 1055 1333 1191 1033 732 1561 371 326 966 685 1232 286 1752 169 1798 165036 216075 144560 ...

output:

1010011010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '101001101011000000000000000000...0000000000000000000000000000000'

Test #22:

score: 10
Accepted
time: 4ms
memory: 9816kb

input:

1
200 1265
999998 1000000 999999 999999 1000000 999999 999999 999999 1000000 999999 1000000 999999 1000000 1000000 999999 999998 1000000 1000000 1000000 999998 999998 999998 999999 1000000 999999 1000000 999998 999998 999999 999999 1000000 1000000 999998 999999 1000000 999999 999998 999998 1000000 9...

output:

101101110001101011101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

result:

ok single line: '101101110001101011101000000000...0000000000000000000000000000000'

Subtask #3:

score: 13
Accepted

Dependency #2:

100%
Accepted

Test #23:

score: 13
Accepted
time: 0ms
memory: 11860kb

input:

125
6 4
761065 91266 353218 455604 20142 1
6 1
51081 83513 53913 130664 18181 51854
6 8
134089 172165 299079 47567 131343 1
6 1
31181 41274 13433 18685 34070 14948
6 11
299723 283682 231025 276072 241762 3
6 5
3500 2806 14 16 3 76389
6 9
311793 311793 311793 311793 311793 1
6 5
5 5 270719 270719 270...

output:

111100100010001000000000
10100011000111001000000
10010111011111100010000
1000010100010110000000
100100100101100101100000
10010101001100101000000
100110000011111001100000
100001000011000010100000
110101000000
1100101000010010110000000
1001010000001010101000
1110101001000000
110011011110110001000000
1...

result:

ok 125 lines

Test #24:

score: 13
Accepted
time: 3ms
memory: 11860kb

input:

75
10 4
109283 360105 124598 198282 43941 1081 97593 110703 46047 28972
10 6
24080 56162 8377 68913 4 55180 37157 50254 6279 3
10 5
33411 2 98649 3 225289 3 7 5 3 4
10 8
507308 82372 4 85172 423594 606481 152125 507666 525295 580712
10 2
1830 23302 328861 7353 29090 117116 46599 58061 76033 2476
10 ...

output:

110110000011011110101000000
10000110100111001000000000
10000010100000110000000000
100011011100011010000000000000
111001001011111000000000000
11001100100111010000000
100001010111010100000000
1100110011111100000
1001010001010000000000000
101011001001001010000000000
11011001111100101010000000
111001001...

result:

ok 75 lines

Test #25:

score: 13
Accepted
time: 7ms
memory: 9812kb

input:

30
25 14
371710 296741 100044 3 674359 98163 130439 170102 294329 451511 453099 321098 478220 454474 482844 550200 499379 606923 586733 724260 4 3 2 2 4
25 21
551361 501236 472244 341351 204338 186886 152791 142916 53873 42391 41938 553705 548231 5 305173 469608 481999 84325 112326 539631 546787 4 1...

output:

10110101011111111100000000000000000000000000
10110011101100100110000000000000000000000000
111011010001100101001000000000000000000000
11101100010111100000000000000000000000000000
1000001100001111100011001110000000000000000
11100110110110100001000000000000000000000000
101001100101101100000000000000000...

result:

ok 30 lines

Test #26:

score: 13
Accepted
time: 9ms
memory: 11860kb

input:

15
50 58
590267 590267 590266 590265 590266 590265 590267 590267 590265 590266 590265 590265 590267 590266 590267 590267 590267 590265 590267 590266 590267 590266 590266 590267 590266 590266 590265 590266 590267 590267 590266 590265 590265 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
50 29
65271 177855 65031 1...

output:

101100000001101110000101011001000101011000001111000010
11001101100010100000000000000000000000000000000000000000000000000000
101100010000001000000000000000000000000000000000000000000000
100001011011011001001000000000000000000000000000000000000000000000000
110111100100011111010001000010110010000000000...

result:

ok 15 lines

Test #27:

score: 13
Accepted
time: 11ms
memory: 9808kb

input:

7
100 95
58921 69685 126125 144922 165843 210110 194397 293611 302400 349070 369812 381187 442002 508978 517995 1 560119 557264 535815 530268 526078 480749 515748 524057 480428 479462 432669 477329 426551 398664 416679 383331 360956 381735 353269 351669 348685 349152 338131 333803 317635 316928 3186...

output:

11110010001000100100110011010010111101110100010001010110010010000110000100011100111100011001011111100011100000
1101011100100001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1101010110000011000000000000000000000000000000000000000000000000000000...

result:

ok 7 lines

Test #28:

score: 13
Accepted
time: 15ms
memory: 11864kb

input:

5
150 116
342 827 2879 2289 2518 3483 3773 2502 93 1455 3686 891 1859 2686 1841 782 397 7 1177 959 25 10 23 5 11 21 14 23 28 8 13 16 3 29 24 10 215963 52732 142067 32665 48160 75838 107590 126840 206296 21920 130510 47541 307063 112326 503737 336836 431879 372327 304986 418577 7337 2206 510 145 368 ...

output:

101101010010001100111111010100010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11111001100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 5 lines

Test #29:

score: 13
Accepted
time: 23ms
memory: 11732kb

input:

3
200 223
6 6 6 5 2 1 5 1 3 1 3 4 3 1 5 1 6 3 4 4 6 3 1 1 5 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37594 36958 37170 37170 40226 35642 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 37170 ...

output:

1101100111001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1101111001000000010100000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 3 lines

Test #30:

score: 13
Accepted
time: 17ms
memory: 11856kb

input:

3
250 165
1247 3240 3176 3311 1631 3260 210 2284 3550 3873 308 1722 1862 2539 758 2458 3800 2625 3271 625 1915 1343 3535 1184 2867 1823 1094 3175 2228 2171 752 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 256 13377 11241 8550 8875 13111 ...

output:

1100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1000001000101000000000000000000000000000...

result:

ok 3 lines

Test #31:

score: 13
Accepted
time: 22ms
memory: 11868kb

input:

1
750 685
991851 951695 791934 944958 760235 738815 654692 634319 586497 560946 543963 535942 534421 381142 372011 290105 202422 80956 8 993888 991607 957955 928742 880837 877006 848607 677866 647039 571464 563656 561736 544683 304297 294404 294285 157497 290030 145862 142082 80732 135182 953058 926...

output:

100000100111101010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100000100111101010010000000000...0000000000000000000000000000000'

Test #32:

score: 13
Accepted
time: 22ms
memory: 11868kb

input:

1
750 611
69950 70237 66895 66608 65861 65730 65484 65178 65027 64491 64476 64788 64165 63356 61527 60101 60327 60057 58427 57477 58954 55169 56359 53750 52814 53114 52597 52252 51584 51410 51441 50840 50698 50379 50016 49149 49100 49003 47766 47201 47347 47226 47183 46856 46616 46564 45663 45254 45...

output:

100010100011100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100010100011100110000000000000...0000000000000000000000000000000'

Test #33:

score: 13
Accepted
time: 19ms
memory: 11896kb

input:

1
750 726
1575 10116 9505 1425 429 4075 11705 620 1001 13769 511 1040 3323 16681 9732 323 27941 3843 2954 12713 252 11363 2891 49141 8051 798 19115 8122 74757 91292 31765 156814 16499 23782 20476 18223 61772 61976 2385 30403 31278 52091 12484 38115 17434 6344 3196 7600 95960 24851 164873 37758 23015...

output:

100101100110000010001000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000001000000000111111111111111111111111111110101001101011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100101100110000010001000000000...0000000000000000000000000000000'

Test #34:

score: 13
Accepted
time: 29ms
memory: 11956kb

input:

1
750 707
78134 9655 24577 14650 6006 8951 64146 131538 59469 18864 52081 135298 66460 69815 30471 47803 65102 363 198273 85038 100141 3764 161753 31670 67997 52426 6449 122156 24715 108505 58029 8156 84128 6944 54511 201710 147 99864 20249 169027 50320 33147 52328 56855 35643 208656 63507 39552 361...

output:

110100001100110100100000000000100101111110101011100101010001011000000100001010100110001100000000001000000000100000110000000111010010001001000000110000000001010001111110100010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110100001100110100100000000000...0000000000000000000000000000000'

Test #35:

score: 13
Accepted
time: 22ms
memory: 9812kb

input:

1
750 709
77840 18872 153844 82892 854321 128451 125071 632708 505428 134942 544929 66142 428616 501214 9640 379987 304461 100366 472545 115166 297322 572903 517017 23345 461300 228057 687534 117142 613666 493430 225807 328876 411765 176993 546620 237803 152613 362441 166364 581887 441569 276126 421...

output:

101100000010000111000100101111011101110100000001000010000011001000000011001001000011001101000000111001101010001011110100001110110111011000010101010100010001100101101110010111011011000000100100101011100110010101100011011011111001101001101100111010011010010010100100111011011010011000011000111110000000...

result:

ok single line: '101100000010000111000100101111...0000000000000000000000000000000'

Test #36:

score: 13
Accepted
time: 20ms
memory: 11856kb

input:

1
750 709
7 1 6 8 8 6 7 8 5 2 7 5 1 3 7 4 2 3 3 3 6 6 3 4 2 7 3 5 6 8 6 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 436318 9772...

output:

110101010001011001011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '110101010001011001011111111111...0000000000000000000000000000000'

Test #37:

score: 13
Accepted
time: 29ms
memory: 9820kb

input:

1
750 588
262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262144 262...

output:

101001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101001100000000000000000000000...0000000000000000000000000000000'

Test #38:

score: 13
Accepted
time: 30ms
memory: 11956kb

input:

1
750 698
514953 59288 237086 241652 128676 331325 312136 442630 156248 467019 342240 445518 394774 90673 251991 444033 276514 64266 404496 399869 34761 183068 392202 350868 24410 306591 43889 127465 72706 130428 17008 37634 49191 21637 87733 17046 29279 16384 16384 16384 16384 16384 16384 16384 163...

output:

111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111000000000000000000000000000...0000000000000000000000000000000'

Test #39:

score: 13
Accepted
time: 15ms
memory: 11884kb

input:

1
750 569
999999 999999 999998 999999 999998 999999 999998 999998 999999 1000000 1000000 999998 999998 1000000 1000000 1000000 999998 999999 1000000 1000000 1000000 1000000 999999 1000000 1000000 999998 1000000 999998 1000000 999999 999999 1000000 999999 999998 999999 1000000 999998 999998 999998 99...

output:

111101000010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111101000010010000000000000000...0000000000000000000000000000000'

Subtask #4:

score: 20
Accepted

Dependency #3:

100%
Accepted

Test #40:

score: 20
Accepted
time: 4ms
memory: 11872kb

input:

416
6 2
10460 1997 39182 3350 3250 9084
6 4
68341 843327 188208 286683 4 3
6 25
5 319892 319892 319892 319892 3
6 4
11487 5 6832 4 2 3
6 6
137683 137683 137683 137683 137683 7
6 6
1446 1211 59 213 4 2
6 3
31815 40226 217967 196457 10506 18977
6 4
361801 327548 2 3 309103 7
6 3
5 536072 606486 4106 2...

output:

11100110000000100000
100100000111000101101100
100111000011001101000000
100101111110100100
10000110011110000100000
10111001100000
11000100011101110001000
100101101110111110100000
1001010000010001011000000
1110111101111010100000
1010000011111101000100000
1110101100011101100000
1100011011100000000
1101...

result:

ok 416 lines

Test #41:

score: 20
Accepted
time: 7ms
memory: 9684kb

input:

250
10 6
44943 2645 129102 184902 143912 170072 220794 164803 4 2
10 19
1 3 2 5 18743 18743 18743 18743 18743 3
10 4
12165 239364 1004 1400 97363 301194 93855 168 59489 100406
10 6
687 716 320 935 668 1329 1022 26 3 2
10 8
7 3 4 4 492757 492757 492757 492757 492757 2
10 2
6072 6034 6178 16533 7075 8...

output:

110101111001111010000000000
100100100111101000000000
111010111011011100000000000
10101001100000000000
1111000010011011001000000000
1101000011001110100000000
10000101000000000
10101110101111111110000000
110010000100100101000000000000
1001011001010000110001000
110110100001100000000000
1000101110010111...

result:

ok 250 lines

Test #42:

score: 20
Accepted
time: 20ms
memory: 11872kb

input:

100
25 18
128230 594 23636 44240 2273 21926 8365 3408 40081 17221 17691 9272 4337 701 3899 44045 15031 27935 10010 1111 14103 38553 36835 668 3645
25 62
4 4 1 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 66 3 5 5
25 24
139489 187343 128728 133215 112992 93270 89485 77927 65249 61328 9141 38...

output:

1000110100001010111000000000000000000000
100001000000000000000000000000
1010100101010001000000000000000000000000000
1111011000100100110000000000000000000
1110110110101101010000000000000000000000000
100001110000000000000000000000000000
1001110011100011100000000000000000000000
110111111100111000000000...

result:

ok 100 lines

Test #43:

score: 20
Accepted
time: 32ms
memory: 9680kb

input:

50
50 39
25375 65885 121636 206569 161343 232738 224421 248634 349693 276967 317267 390362 405686 459117 437200 498412 518808 560978 656926 568077 551331 532556 441134 528329 388963 372069 354002 333307 270557 220466 320382 183435 198384 176337 174850 139112 152741 127583 92477 37370 65825 647431 61...

output:

10001011010010100100011100110111001111001110011100000000000000000000
10001101011010110010000000000000000000000000000000000000000000000
11010110000001101111101001010110000000000000000000000000000000000
100110001011011111110000000000000000000000000000000000000000000000000
10010010100110111010011100100...

result:

ok 50 lines

Test #44:

score: 20
Accepted
time: 42ms
memory: 11888kb

input:

25
100 88
104119 74466 183847 384335 13016 137752 335907 451970 469761 154206 105597 626384 138614 297706 22053 98483 11116 54284 79593 14583 9195 46791 204440 124970 45452 207149 131060 112728 87899 27886 213686 206301 447125 219103 297406 24228 659326 63522 145417 19672 59430 28300 285317 37652 11...

output:

11001010001010101111111111111111111001010000100000000000000000000000000000000000000000000000000000000000000000000000
1001011011101101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1001001111111100100111111101000001101010101000000000000000000000000...

result:

ok 25 lines

Test #45:

score: 20
Accepted
time: 56ms
memory: 11728kb

input:

16
150 120
1 3 6 1 5 3 7 1 2 5 5 4 5 4 3 3 5 1 6 2 5 1 7 2 2 6 2 6 1 7 19005 19005 19005 19005 19005 19005 19005 19005 40951 8032 19005 19005 19005 19005 19005 19005 19005 19005 19005 19005 19005 19005 19005 19005 43091 6962 19005 19005 19005 19005 19005 19005 19005 43237 6889 19005 19005 19005 1900...

output:

101011001110010111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110110101110000110000000000000000000000000000000
11001110010001001100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 16 lines

Test #46:

score: 20
Accepted
time: 54ms
memory: 11872kb

input:

12
200 179
5 4 3 6 2 7 1 1 1 7 6 4 6 5 7 4 6 5 2 7 2 3 2 1 5 1 7 1 1 5 3 3 2 4 2 529154 529154 529154 529154 529154 529154 529154 552120 517671 529154 529154 529154 529154 529154 529154 529154 529154 529154 529154 529154 563562 511950 529154 529154 529154 529154 529154 529154 529154 570876 553437 50...

output:

110000011100100000110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11100011101000111101111100101110001100111011100001001101100001001111100101001000011...

result:

ok 12 lines

Test #47:

score: 20
Accepted
time: 46ms
memory: 11732kb

input:

10
250 230
206513 74178 187826 285843 169198 172641 353827 121706 348603 238523 109433 162287 272655 9551 421199 48702 313450 243705 191880 252430 262411 108371 180586 288568 169688 141747 5710 253482 252412 6499 69052 191964 3160 236606 915 94306 119544 175128 187810 175272 106271 118892 332076 266...

output:

100000010111010100000000000000000010010000000000010001110100000010000000010000011110010001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
11110110011100111011100011111111...

result:

ok 10 lines

Test #48:

score: 20
Accepted
time: 57ms
memory: 11856kb

input:

6
400 389
8044 1219 8060 2043 3654 7523 3809 2887 3921 3519 3847 2179 2856 1664 65 2491 6683 5987 7799 5978 7271 5939 6293 2495 1623 2292 5876 4726 3066 686 7720 2391 552 537 7631 3319 6628 5642 3900 4122 7010 7589 530 2345 581 5945 147 5853 2619 969 6436 7955 4259 753 2042 1179 1488 249 2361 3286 4...

output:

110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 6 lines

Test #49:

score: 20
Accepted
time: 69ms
memory: 11860kb

input:

5
500 501
4 2 5 2 7 6 4 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555060 555...

output:

100001111000001100111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 5 lines

Test #50:

score: 20
Accepted
time: 80ms
memory: 12148kb

input:

1
2500 2368
994167 978283 935215 932493 924861 917123 898345 862142 847249 833213 737183 733971 726003 724101 703825 696348 674248 645172 630661 598032 591959 578669 545833 568864 531881 520471 482542 473761 429079 427761 426506 414366 373755 371566 364498 358826 347994 334192 333309 297589 295487 2...

output:

111101110100011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111101110100011100000000000000...0000000000000000000000000000000'

Test #51:

score: 20
Accepted
time: 103ms
memory: 11904kb

input:

1
2500 2267
635706 90620 86293 339143 25641 248535 381023 262658 502660 480135 21493 155610 424583 71290 224949 31435 8333 27923 272638 158388 107208 262932 625575 49480 663551 139843 273908 29537 148442 111073 132814 145103 58356 29192 102575 568892 311279 459642 392519 159292 344109 4759 250680 23...

output:

111110010111010100010011111111101001010111011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111110010111010100010011111111...0000000000000000000000000000000'

Test #52:

score: 20
Accepted
time: 117ms
memory: 12120kb

input:

1
2500 2418
176108 32380 69918 17475 54335 39808 13293 47861 59679 50121 31509 81508 61035 2816 69653 63322 9918 86050 15714 97745 64827 29509 12658 85467 24462 91263 17345 42054 38060 41237 36440 13872 25690 67834 24833 134795 72398 105923 7319 96600 17835 16913 38475 58092 11017 126701 47440 13183...

output:

110001100000100101001001010100000001001100000100000010000100011000101001000110101111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110001100000100101001001010100...0000000000000000000000000000000'

Test #53:

score: 20
Accepted
time: 90ms
memory: 10076kb

input:

1
2500 2470
106548 40559 116231 170154 25735 89551 132396 30361 165361 5644 30182 88591 149308 163629 55930 28284 456043 196890 327727 217209 382800 291338 123680 557730 260041 338039 574161 59939 665141 232331 56829 451580 71010 697619 282284 353124 151983 598171 46586 129499 538888 262484 171118 7...

output:

101100000110111111001100100110100111101101001011000101100010110000111110000011001101100011111100110110010101110010000000011011110000100110101110001011101001101111111011101101001110110011000110101010111011101100010001111011111011001111100011110100000110110001101100011101100110011001100010000111001110...

result:

ok single line: '101100000110111111001100100110...0000000000000000000000000000000'

Test #54:

score: 20
Accepted
time: 109ms
memory: 10076kb

input:

1
2500 2460
13627 16436 2211 4281 2025 24938 1031 23438 2956 8199 24072 21109 172008 8854 32152 160804 6791 248523 14374 67347 3267 100912 243829 71139 49799 45238 38758 11030 119043 19034 86970 133869 310217 103303 411051 81736 289215 155663 125764 132399 209352 243530 111304 54581 298333 39287 480...

output:

111000100011000111000010101111001000111001100010101000100011010110001110000011111000010000100001010101010010100001100000100001001010011011010101001101100011010101100010101001100111001011111110011100000100011100001100000000101100010110111110110101110110101100010011111001111000101011110111100110010011...

result:

ok single line: '111000100011000111000010101111...0000000000000000000000000000000'

Test #55:

score: 20
Accepted
time: 101ms
memory: 12140kb

input:

1
2500 10904
8 7 7 6 214708 214708 214708 214708 214708 214708 214708 214708 214708 214708 214708 285556 179284 214708 214708 214708 214708 214708 214708 214708 214708 460834 91645 214708 214708 214708 214708 214708 287288 178418 214708 214708 214708 214708 214708 299640 172242 214708 214708 214708 ...

output:

100110110111110110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100110110111110110100000000000...0000000000000000000000000000000'

Test #56:

score: 20
Accepted
time: 84ms
memory: 12144kb

input:

1
2500 11650
3 7 4 6 3 4 1 4 6 7 1 1 1 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 75213 752...

output:

110111000101100111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110111000101100111000000000000...0000000000000000000000000000000'

Test #57:

score: 20
Accepted
time: 126ms
memory: 10080kb

input:

1
2500 2374
105889 119020 115325 213432 221015 91636 94097 248498 23669 205394 237774 14548 112215 248863 162243 225453 108429 107230 193288 199164 186713 65469 103506 23436 23009 50645 163911 1922 4026 351 3138 2544 3576 1367 2768 3817 3088 1296 2922 1413 533 3192 3245 4072 823 917 1287 644 3479 14...

output:

101010011001111100001110100101001000100000101100100101110011011000010001000001011110000111010101011000110010010100110111010011011001001011101110111010000111011001111011100110000010001010111110100111110101110001110101110000011100111001001100111101110100111101111110111000101100111100000010101110001100...

result:

ok single line: '101010011001111100001110100101...0000000000000000000000000000000'

Test #58:

score: 20
Accepted
time: 145ms
memory: 12068kb

input:

1
2500 1470
64 207 152 115 245 127 64 241 111 46 27 144 171 163 176 55 245 16 208 74 57 31 172 122 97 188 28 245 107 69 254 217 50 229 237 62 161 140 250 136 195 136 234 248 218 61 76 242 212 103 160 204 250 83 40 255 74 93 131 118 118 40 231 253 224 208 66 79 256 200 158 71 16 99 62 142 42 199 139 ...

output:

111000101111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111000101111000000000000000000...0000000000000000000000000000000'

Test #59:

score: 20
Accepted
time: 85ms
memory: 11864kb

input:

1
2500 15991
999998 999999 999998 1000000 999998 999998 999998 999999 999999 1000000 1000000 1000000 999998 999999 999998 999998 999998 999999 999999 999999 1000000 999999 999998 1000000 999999 999998 1000000 1000000 999998 1000000 999999 1000000 999998 999999 999998 999999 1000000 999998 1000000 99...

output:

101101110001101011101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101101110001101011101000000000...0000000000000000000000000000000'

Subtask #5:

score: 17
Accepted

Test #60:

score: 17
Accepted
time: 16ms
memory: 11860kb

input:

1666
6 1
282 719 29 355 388 275
6 1
348 766 91 299 474 96
6 23
5 2 8554 8554 8554 2
6 1
84 195 23 37 120 117
6 3
8 3 51 62 28 5
6 3
3 64 64 4 4 2
6 9
5 552 552 552 552 5
6 3
3611 1144 417 3461 459 755
6 3
777 315 1007 5 2 1061
6 6
1300 2101 4 1877 360 2434
6 1
384 713 168 25 524 390
6 3
203 18 305 1...

output:

110000100100000
111011010000000
1000010110111000000
1111000100000
11111000000
11110000000
100011001000000
100010001101100000
10000100101000000
100110000010000000
1000001100100000
10011001100000
111001011010000000
1100000110100000
1110111111110000
101011111000000
1000011110000
100101000000000
1011110...

result:

ok 1666 lines

Test #61:

score: 17
Accepted
time: 32ms
memory: 11864kb

input:

1000
10 10
1765 725 287 2983 1959 3 855 1094 2960 4
10 4
856 92 85 15 31 233 718 137 64 213
10 8
4575 2773 2373 497 8150 5057 2455 9107 5 5
10 8
216 189 143 218 154 222 153 147 2 5
10 3
77 74 30 27 241 85 57 8 66 86
10 7
3471 3468 5868 2881 478 3775 2 470 1 3
10 5
317 2460 139 3033 107 359 4 1716 3 ...

output:

101110011000000000000
1010110010000000000
1100010110011110000000
11011110000000000
10101111110000000
110110001111000000000
100100100101100000000
1101111101000000000
10111010010110000000
1111110111101100
10100101000100000000
10100110000110000000
1011110110101000000000
10011110100000000000
10000100100...

result:

ok 1000 lines

Test #62:

score: 17
Accepted
time: 93ms
memory: 9816kb

input:

400
25 16
678 1005 3339 2086 1363 1802 549 124 406 305 325 742 3344 2194 640 2744 383 1494 2369 1209 667 120 423 243 91
25 16
5 6 5 4 4 37 6 2 2 2 2 2 2 2 2 7 13 12 9 10 15 32 32 1 4
25 18
848 963 139 413 186 82 1329 524 629 70 40 324 1255 282 581 193 439 189 81 268 769 733 22 36 332
25 23
61 41 39 ...

output:

11111011010000000000000000000000000
11001000000000000000000000000
1011111100101000000000000000000000
110110010001110110001100000
1100011111111100000000000000000000000
11000001001110000000000000000000000
110000110110000000000000000000000000
100110110000101000000000000000000
11010000111000000000000000...

result:

ok 400 lines

Test #63:

score: 17
Accepted
time: 157ms
memory: 11884kb

input:

200
50 38
1635 1767 1420 565 1815 1952 1969 1438 1749 21 415 15 1257 1883 22 26 13 22 19 12 22 9 16 19 20 19 25 11 28 21 519 29 653 315 987 806 450 651 102 77 101 87 40 2 5 3 3 1 5 3
50 39
157 165 46 80 176 17 4 41 47 213 8 18 161 53 10 56 21 5 400 10 173 35 73 263 161 33 88 102 132 55 173 3 11 6 48...

output:

1110000000000000000000000000000000000000000000000000000
100110011111111000011100000000000000000000000000000000000
1010111111111101011101101000000000000000000000000000000000000
110011111001000000000000000000000000000000000000000000000000
1010101101101000000000000000000000000000000000000000000000000
1...

result:

ok 200 lines

Test #64:

score: 17
Accepted
time: 206ms
memory: 11860kb

input:

100
100 385
2 1 3 1 2 3 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 806 2332 43 806 806 806 806 806 806 806 806 806 806 806 806 806 1438 490 806...

output:

10010110111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
101001111101111111111111111111111111111111111111111111111111111111111010111011010000000000000000000000000000
11001111111011000100110000110100010110100001000110111101000000000010010111110010...

result:

ok 100 lines

Test #65:

score: 17
Accepted
time: 233ms
memory: 9812kb

input:

66
150 146
1 4 5 4 2 1 1 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8778 8325 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8476 8926 8251 8476 8476 8476 ...

output:

100001101111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111101111011100100000000000
11011011111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 66 lines

Test #66:

score: 17
Accepted
time: 247ms
memory: 9816kb

input:

50
200 180
124 41 159 16 91 31 179 200 68 35 70 40 45 20 6 10 84 54 286 83 35 51 28 87 148 51 55 54 262 76 81 9 42 184 4 201 32 67 234 97 147 50 2122 737 934 356 10 1140 495 1732 975 816 278 163 107 683 53 481 54 18 44 126 27 44 52 38 81 125 30 34 58 38 25 6 12 194 29 75 52 21 45 31 4 10 34 5 28 133...

output:

10100101000001001110000000100000000010010001000011010001111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 50 lines

Test #67:

score: 17
Accepted
time: 289ms
memory: 11732kb

input:

40
250 242
3 3 1 2 4 5 1 1 1 1 2 3 5 5 2 3 3 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 4892 ...

output:

1001100100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1010101001011111111111111111111111111...

result:

ok 40 lines

Test #68:

score: 17
Accepted
time: 308ms
memory: 11860kb

input:

25
400 210
607 519 565 500 475 467 467 465 440 409 413 407 393 390 389 380 375 346 316 295 293 230 283 220 198 148 137 84 58 51 55 50 27 19 18 11 3 659 658 657 650 644 638 620 615 615 613 606 602 581 576 574 565 559 551 533 514 498 501 487 484 476 476 474 473 459 456 446 443 423 404 394 389 383 383 ...

output:

101101110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 25 lines

Test #69:

score: 17
Accepted
time: 295ms
memory: 11864kb

input:

20
500 1830
1 1 3 2 1 2 2 2 3 318 396 279 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 318 31...

output:

100010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 20 lines

Test #70:

score: 17
Accepted
time: 303ms
memory: 11732kb

input:

10
1000 966
227 854 269 649 117 305 721 162 627 451 343 2299 1160 760 1660 1148 1038 594 1136 1458 699 885 908 826 1595 1013 776 1321 1067 1475 1058 1410 1307 907 959 939 1418 1378 1260 1302 610 900 1199 1158 864 968 1040 1470 1054 1355 853 1042 973 841 1230 752 1074 1604 1210 901 992 761 1672 1104 ...

output:

110101011100111010011110101100000100011111000010111010100101110111100111101011101110000000011011001001001101111111001100011000011111100100111111001010011011111011100101100011010011110001100010100110011000110001000111011111111111010011111111110100110010001100011010101101010000100010011011110111111100...

result:

ok 10 lines

Test #71:

score: 17
Accepted
time: 440ms
memory: 10048kb

input:

5
2000 1986
1331 697 1326 1672 5277 3351 1483 3596 5998 687 3808 1162 4416 5025 1787 6521 383 2314 5256 2012 5664 2729 904 3679 3607 1441 1861 3657 3618 5656 1856 5128 3618 3877 3704 2877 1916 3889 3199 943 5676 252 5167 789 4404 3020 4841 2545 1629 1773 6902 548 1639 2020 3527 4759 3620 905 2324 25...

output:

111111010111011111011111000100111000000000000111010100101100101111001011010110101111000111000000001001101101110110100111010111101001110111011001111011110001011001110000011000101000101000111101111001100100010101111100011101000010101110101111000000111000111110010011011110111100001010010010001101101101...

result:

ok 5 lines

Test #72:

score: 17
Accepted
time: 445ms
memory: 12120kb

input:

1
10000 8725
184 222 381 454 624 641 653 705 856 927 964 1083 1095 1140 1154 1229 1241 1303 1385 1468 1315 1530 1518 1606 1710 1666 1721 1734 1776 1936 1967 1977 2025 2194 2296 2299 2304 2321 2352 2355 2453 2509 2514 2571 2576 2590 2616 2588 2636 2686 2642 2687 2736 2796 2768 2827 2835 2893 3005 304...

output:

101111011110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101111011110000000000000000000...0000000000000000000000000000000'

Test #73:

score: 17
Accepted
time: 428ms
memory: 12156kb

input:

1
10000 7109
592 1121 1861 1919 2294 2814 2888 3848 5173 6212 6315 6906 6405 7118 7656 7716 7828 8250 8964 9177 1 5 24 33 26 54 111 140 170 195 219 197 274 254 277 289 291 304 356 363 376 416 380 417 420 421 424 435 459 466 489 471 499 520 502 568 593 604 635 631 649 696 703 761 728 762 799 830 850 ...

output:

110100000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110100000111000000000000000000...0000000000000000000000000000000'

Test #74:

score: 17
Accepted
time: 775ms
memory: 12088kb

input:

1
10000 9840
1444 3407 180 5543 1757 544 1288 3714 6932 1392 2839 2027 2181 186 1189 1703 2333 977 1387 2390 676 764 4806 1842 1132 2755 5466 1367 848 719 1521 241 3906 5546 1654 126 4598 4920 5779 2152 4755 743 948 871 536 1038 704 1689 1536 1663 11 8476 1565 2075 1856 2585 3447 5895 999 1388 926 9...

output:

101010001010100100110111111010100111111011111011111000111100100001010000011101010011110001110100100111111010001001011111101000111011010011111111011101110101100011100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101010001010100100110111111010...0000000000000000000000000000000'

Test #75:

score: 17
Accepted
time: 425ms
memory: 12156kb

input:

1
10000 9983
279 67 158 342 280 2751 3370 997 824 50 729 859 4489 156 858 1139 179 457 782 1942 350 95 567 456 379 667 1141 334 590 1816 683 2022 2379 3105 17 2847 1990 780 1785 1142 11 1324 35 719 1567 250 669 402 817 232 1152 1162 1739 33 1814 386 1571 405 5361 3734 776 1724 1981 183 5193 4298 285...

output:

110100010000111000111010100010011111111010100011010100000000000101011110100110001000100111101000101111011011000111010010101111101111111010100110101101101010110010001100110010000111000011111110110000101100011101010010100111101001110010001111110101100010110011100010000100101101101101100010011100010110...

result:

ok single line: '110100010000111000111010100010...0000000000000000000000000000000'

Test #76:

score: 17
Accepted
time: 655ms
memory: 11772kb

input:

1
10000 31297
6 3 3 6 6 1 4 5 1 6 3 2 5 1 3 3 1 1 1 2 5 6 2 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 7534 ...

output:

100000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100000000100000000000000000000...0000000000000000000000000000000'

Test #77:

score: 17
Accepted
time: 594ms
memory: 11648kb

input:

1
10000 8280
84 45 72 60 119 46 93 87 24 53 128 111 50 86 96 67 60 36 128 88 28 34 85 82 35 58 128 29 47 94 120 109 66 68 127 115 97 67 66 119 76 97 87 118 72 46 93 32 107 57 124 58 62 127 121 66 71 119 24 41 67 50 97 95 108 66 126 89 89 81 54 70 53 71 120 119 64 54 65 50 114 60 55 89 106 93 27 21 2...

output:

110100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110100000000000000000000000000...0000000000000000000000000000000'

Test #78:

score: 17
Accepted
time: 513ms
memory: 12796kb

input:

1
10000 6863
517 527 452 1020 971 691 756 649 932 1000 853 345 863 271 435 507 527 921 880 669 442 435 931 455 386 967 303 760 559 660 276 352 965 920 944 508 893 692 740 586 1019 12 2 9 29 13 20 28 10 11 30 30 26 19 12 9 19 17 12 3 5 9 26 12 16 23 31 10 21 14 28 29 15 16 16 10 7 2 21 25 25 14 17 6 ...

output:

101011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101011000000000000000000000000...0000000000000000000000000000000'

Test #79:

score: 17
Accepted
time: 907ms
memory: 12440kb

input:

1
10000 72276
9999 10000 10000 9998 9999 9998 10000 9998 9998 10000 10000 9999 10000 9999 10000 10000 10000 10000 9998 10000 9998 9999 9998 9999 10000 9998 9998 9999 9999 9999 10000 10000 10000 10000 10000 9998 10000 9998 9998 9999 10000 10000 10000 9999 9999 9998 9999 10000 9999 9999 9998 9999 9998...

output:

111010100101010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111010100101010000000000000000...0000000000000000000000000000000'

Subtask #6:

score: 16
Accepted

Test #80:

score: 16
Accepted
time: 34ms
memory: 9812kb

input:

3333
6 1000000000
131727 7 4 170194 6 59263
6 1000000000
417714 286613 7 310122 6 4
6 1000000000
63764 2430 2696 6699 8478 22261
6 1000000000
217 131 6 1487 2927 2
6 1000000000
26225 27991 3842 72525 4521 5231
6 1000000000
34409 26001 23563 19345 30764 24919
6 1000000000
97981 138532 59280 82393 128...

output:

10100110001101001000000
10010111011100001100000
101011011110101000000
10110111001100000
110010000010110110000
111100110010110100000
11111011000100010000000
11001111100101100
1100000101001001010100000
100000000000
100111000110001000000
101110110010100111000000
10000000000000000000000
1100000111101000...

result:

ok 3333 lines

Test #81:

score: 16
Accepted
time: 59ms
memory: 11732kb

input:

2000
10 1000000000
4 225227 95031 258432 108444 260818 190505 154686 1 5
10 1000000000
541067 480522 7 372550 533382 366492 200177 240412 6 1
10 1000000000
10004 14230 86468 2812 9690 7106 21976 45928 9749 30567
10 1000000000
12217 2718 4247 9981 12911 1845 2048 4 1387 16384
10 1000000000
46966 1438...

output:

11110100000110100010000000
101001100100010010010000000
1111111110010010000000000
1000000000000000000000000
11010100011000000000
110010110111010010100000000
11000010111011011011000000000
1001001110000111010000000000
11110110001100100100000000
101110111011100111000000000
100001001101001011110000000
10...

result:

ok 2000 lines

Test #82:

score: 16
Accepted
time: 169ms
memory: 11860kb

input:

800
25 1000000000
87944 70771 86657 342502 146802 122800 216223 248367 121688 22026 9518 1128 64025 63379 231058 292954 218186 35314 64373 10501 20550 32081 39386 10095 78181
25 1000000000
54665 3 129508 98607 92526 68177 57466 62726 21642 52766 23748 16110 18286 9033 4 6 3 6 2 5 7 5 7 1 4
25 100000...

output:

100110001011001010000000000000000000000000
11001101110010100000000000000
1101110010100110110000000000000000000000
1011101001000100000000000000000000000000
10100110000000000000000000000000
1001111010011010010000000000000000000000
10010000010110010011000000000000000000000000
10000010010000000000000000...

result:

ok 800 lines

Test #83:

score: 16
Accepted
time: 286ms
memory: 11732kb

input:

400
50 1000000000
36192 37096 41075 279152 132449 170424 203877 76049 163616 193360 220325 66999 100454 253404 184659 123538 175852 228265 36430 14534 5082 24007 9240 14589 22365 47490 42236 267799 144852 218552 99653 6256 50634 80363 90985 168540 213317 114099 2231 11664 17529 37776 44616 44454 102...

output:

11010001010111010000000000000000000000000000000000000000000000000
1100100111001001000000000000000000000000000000000000000000000000
100011011111111110000000000000000000000000000000000000000000000000
111000010111000000000000000000000000000000000000000000000000
11010001100000000000000000000000000000000...

result:

ok 400 lines

Test #84:

score: 16
Accepted
time: 390ms
memory: 9812kb

input:

200
100 1000000000
99999 166651 172330 201875 281584 356526 387368 439633 573276 7 589135 554082 510762 510397 480338 447887 425040 385075 276710 246377 209934 170427 48543 40575 32050 1 505193 443771 362419 314334 311097 166747 98814 76005 2 10873 14027 30940 63000 69322 74238 141599 179046 183231 ...

output:

100011000010000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
101110111001101111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1011000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 200 lines

Test #85:

score: 16
Accepted
time: 456ms
memory: 11856kb

input:

133
150 1000000000
1942 801 89 110 53 71 56 89 43 107172 74849 78209 81044 26034 72943 20353 159713 1904 259866 59454 130859 49737 129495 27090 42758 133410 214036 201815 47 166 49 103 16 7298 26210 91925 198065 158 384 430 255 348 437 391 249 303 140 21494 204750 131296 60676 94483 261236 65302 244...

output:

11100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
100011100101101111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 133 lines

Test #86:

score: 16
Accepted
time: 476ms
memory: 11728kb

input:

100
200 1000000000
68988 89086 7535 29066 45938 115647 147461 36265 29182 53020 24083 195128 142671 97759 132186 88028 84300 44019 25085 21501 38052 25645 294 23101 183153 51327 20117 123035 33735 19868 25692 77782 18038 87484 41683 47422 30012 64925 37422 57891 38887 40214 62062 16612 57733 23508 5...

output:

10101011101001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
100000100000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 100 lines

Test #87:

score: 16
Accepted
time: 512ms
memory: 9728kb

input:

80
250 1000000000
2 1 1 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 17442 ...

output:

1011110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1100011011000110000000000000000000000000000...

result:

ok 80 lines

Test #88:

score: 16
Accepted
time: 582ms
memory: 11812kb

input:

50
400 1000000000
7 4 3 5 5 5 4 7 7 5 3 2 1 3 208121 12815 77917 77917 292407 93104 16701 77917 77917 140969 46391 77917 77917 77917 77917 77917 157905 37923 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 77917 7791...

output:

110010001001110001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 50 lines

Test #89:

score: 16
Accepted
time: 578ms
memory: 11928kb

input:

40
500 1000000000
6 5 5 3 2 7 3 1 3 2 7 6 5 2 5 7 1 6 4 7 1 1 3 7 1 1 7 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 57814 ...

output:

111000110100010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 40 lines

Test #90:

score: 16
Accepted
time: 665ms
memory: 9948kb

input:

20
1000 1000000000
35011 107253 17084 23079 14468 91157 8766 71170 100683 77649 102585 41811 52110 72889 127738 14698 113096 128602 62156 113896 34339 68178 21711 4341 79439 123261 98814 56920 82589 103476 100130 115924 9932 150407 150463 155355 231281 83194 145249 46979 179629 37254 27083 131554 13...

output:

101011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 20 lines

Test #91:

score: 16
Accepted
time: 746ms
memory: 11868kb

input:

10
2000 1000000000
4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 4096 1283 6199 9523 12039 15208 4265 10932 13211 12799 8910 4623 10997 7140 1254 8790 13329 84 11212 12260 937 7032 16266 5897 1562 12357 4040 13876 9915 1900 8457 8423 3415 69...

output:

101100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 10 lines

Test #92:

score: 16
Accepted
time: 902ms
memory: 10600kb

input:

4
5000 1000000000
72704 42406 83412 91510 45197 84742 102974 80059 40591 122856 92213 13567 89306 76332 30522 72602 374001 251873 113099 105084 186031 225143 180562 154750 209758 230389 78465 352294 223749 248952 35979 156563 124117 277416 270540 117702 117978 252072 108561 213113 278454 169801 1978...

output:

101101010110111011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 4 lines

Test #93:

score: 16
Accepted
time: 1011ms
memory: 13176kb

input:

1
20000 1000000000
985228 998317 980875 979822 967763 964012 963624 961052 960800 957465 955402 946738 945459 943337 941718 934960 931563 925132 907825 907224 890168 888509 888381 877596 873401 873132 872476 857370 853281 868008 853119 853088 848863 845784 839872 830336 826175 826063 816414 810632 8...

output:

100010011000111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100010011000111111000000000000...0000000000000000000000000000000'

Test #94:

score: 16
Accepted
time: 1442ms
memory: 13344kb

input:

1
20000 1000000000
1104 1991 3192 3907 4091 4479 5000 7057 7323 7987 8361 9026 9739 10594 13021 13198 13426 13498 13835 14410 14720 15288 15702 17528 18342 19391 19805 21091 22100 22650 23411 25293 25498 25814 26319 27093 27352 27447 30326 30392 30799 31279 31787 31970 33641 34804 36146 37582 39799 ...

output:

110001110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110001110110000000000000000000...0000000000000000000000000000000'

Test #95:

score: 16
Accepted
time: 780ms
memory: 13216kb

input:

1
20000 1000000000
78377 119938 52037 128259 337829 25789 15527 34029 86310 125410 113689 409271 100691 599162 139635 573334 91771 133804 161560 161345 101754 219239 490448 564718 3057 216852 529491 22808 423778 148945 74358 194207 665370 479995 83273 105802 322902 27639 175872 180791 347785 261029 ...

output:

100110010100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100110010100110000000000000000...0000000000000000000000000000000'

Test #96:

score: 16
Accepted
time: 958ms
memory: 13184kb

input:

1
20000 1000000000
1728 294 84 703 1696 53 206 1675 974 394 187 392 77 713 1917 1211 355 98 2424 304 78 32 3475 12400 1573 2948 8766 14792 4681 7773 3180 459 3728 5623 2382 4569 4442 872 1514 1158 3130 15920 7389 2249 6817 183 1522 702 1607 308 1727 3090 5206 12162 8954 1412 10974 5173 426 1164 921 ...

output:

101010011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101010011100000000000000000000...0000000000000000000000000000000'

Test #97:

score: 16
Accepted
time: 1021ms
memory: 13348kb

input:

1
20000 1000000000
133032 205042 40352 621364 304895 346795 638201 159138 571835 469101 116571 353324 467309 553563 371998 200831 440785 309832 195968 566382 183763 593648 101699 700267 89178 481842 482539 125742 382587 534009 299054 474104 355090 332165 281112 636323 483352 194901 251019 250860 461...

output:

100100001101101110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100100001101101110000000000000...0000000000000000000000000000000'

Test #98:

score: 16
Accepted
time: 1490ms
memory: 13220kb

input:

1
20000 1000000000
71570 88889 515822 162392 236766 60763 125021 117430 318992 121550 143064 106065 249883 199551 210114 44919 341914 271973 212926 71914 154634 334529 272131 100466 251193 231267 103876 274898 14930 247019 300970 171813 315978 263105 151535 220572 174919 140260 176484 231458 173914 ...

output:

110111001000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110111001000011100000000000000...0000000000000000000000000000000'

Test #99:

score: 16
Accepted
time: 1740ms
memory: 13228kb

input:

1
20000 1000000000
2 5 4 2 5 5 1 6 5 5 7 6 5 7 1 8 3 8 1 1 5 761160 572691 635514 635514 635514 635514 635514 635514 635514 635514 635514 731178 681558 588576 635514 635514 635514 856662 524940 635514 635514 635514 642338 632102 635514 865178 520682 635514 635514 635514 635514 635514 635514 635514 6...

output:

110111000110110011011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110111000110110011011000000000...0000000000000000000000000000000'

Test #100:

score: 16
Accepted
time: 1913ms
memory: 13216kb

input:

1
20000 1000000000
7 3 2 2 1 5 1 2 6 3 6 1 6 2 7 5 1 2 5 3 2 1 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962 168962...

output:

110000010110100100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110000010110100100000000000000...0000000000000000000000000000000'

Test #101:

score: 16
Accepted
time: 1729ms
memory: 13344kb

input:

1
20000 1000000000
28776 41 1090 24827 21319 19511 18985 30480 23334 4249 26245 16610 24697 30398 23925 30800 30838 8913 16148 12488 12294 10119 22283 24024 27818 11396 21929 16951 15774 20660 29094 10977 28129 7971 31037 22827 21819 12410 22130 24604 25984 17908 17004 24724 24667 19094 5173 1073 24...

output:

101011010110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101011010110000000000000000000...0000000000000000000000000000000'

Test #102:

score: 16
Accepted
time: 1212ms
memory: 13216kb

input:

1
20000 1000000000
999998 1000000 999999 999998 999998 999998 999999 999998 1000000 999998 1000000 1000000 1000000 1000000 999998 999999 999998 999998 999998 999999 999998 999998 999999 999999 999999 999998 999999 1000000 1000000 999998 1000000 999999 999998 999999 1000000 999999 999999 999998 10000...

output:

100110100001000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100110100001000111100000000000...0000000000000000000000000000000'

Subtask #7:

score: 22
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #103:

score: 22
Accepted
time: 33ms
memory: 9808kb

input:

3333
6 1
44642 69098 19539 6147 54088 48191
6 7
125988 125988 125988 125988 125988 4
6 17
286885 286885 286885 286885 286885 6
6 1
31765 18906 38470 23539 45432 8468
6 1
94958 120542 47116 70781 107387 3887
6 6
9 35 29981 3 3 60940
6 5
371585 418958 309688 54111 4 5
6 15
7 1 97654 140358 76302 4
6 6...

output:

1101001101001000000000
1111011000010110000000
100011000001011000100000
1001011001000110000000
11010001101111011000000
1110111000001100000000
10101111110111010101010
10001001000100011000000
111000110001111110000000
101111011111101100000
10101000111011000000
1000101000001010000000
11101001111010111010...

result:

ok 3333 lines

Test #104:

score: 22
Accepted
time: 56ms
memory: 11876kb

input:

2000
10 9
694293 133153 514675 335819 53219 232749 133628 162554 38282 9703
10 10
2 1 3 4 30663 30663 30663 30663 30663 2
10 47
6 5 3 6 14902 14902 36460 4123 14902 4
10 5
64 2361 717 123462 77111 9232 20 379503 39173 7
10 11
3 3 7 437937 438430 439320 439063 438251 436590 4
10 4
2770 54785 2907 208...

output:

110111011100001000010010110
111011111001011000000000
100011100110110000000000
110111111001001010100000000
1101011010000011000000000000
111010011011111110000000
1001110001011010100100000000
1100011000010101100000
1000001010001001000000000000
100111100000110000000000
1001101010100010000000000
10110011...

result:

ok 2000 lines

Test #105:

score: 22
Accepted
time: 160ms
memory: 11860kb

input:

800
25 15
44562 102495 57524 19239 1225 5640 6650 17957 1339 22951 593 785 59 893 6 7 5 2 1 7 4 1 5 3 1
25 17
122387 562657 247150 347516 306921 158457 174585 391940 182378 199270 293116 28428 45863 59671 55517 49802 580943 212152 322721 153043 198757 23007 72071 165364 29678
25 19
373 24691 56078 1...

output:

11000100011101110011010000000000000
1010101011100010100000000000000000000000000
1001001100100001111011011001111000000
1001110100000011111000010001000
1111110011101001000000000000000000000000
10101010110000011011110000000000000000000
101011100000010101000000000000000000000000000
111110000100000000000...

result:

ok 800 lines

Test #106:

score: 22
Accepted
time: 262ms
memory: 9768kb

input:

400
50 32
28 272 20286 193095 7887 63064 13078 147 1082 24015 2797 7939 6 3067 1297 1665 1691 1434 215 414 130 805 835 912 1073 979 1097 952 1246 293 23060 7732 923 6335 2771 653 1625 16159 4874 377 384 6230 920 263 536 388 774 603 1097 498
50 28
118528 90356 36421 530 957 401 672 554 268 188 689 20...

output:

1010100100100110110111000000000000000000000000000000000000000
1001111010001010000000000000000000000000000000000000000000000000
11111110010101100101111110100110100011110100000000000000000000000
100101010010011001001101111110000000000000000000000000000000000000
1010010010011110011000011010000000000000...

result:

ok 400 lines

Test #107:

score: 22
Accepted
time: 360ms
memory: 11856kb

input:

200
100 142
2 5 2 1 7 2 2 2 3 3 7 7 7 2 3 4 4 6 5 7 2 7 5 5 4 3 2 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 139141 312581 52421 139141 139141 139141 139141 377473 19975 139141 139141 139141 139141 139141 251321 83051 139141 139141...

output:

10101000001110110010000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1000000011001101111111111111111111111111111111111111111111110000010001101110000000000000000000000000000000000
1101011010001011000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 200 lines

Test #108:

score: 22
Accepted
time: 425ms
memory: 11856kb

input:

133
150 117
15128 25326 90976 113166 39258 109304 118612 125801 213520 135615 215887 191707 187964 216935 227515 285942 274355 287279 331706 336424 402505 448077 388821 429849 373224 347404 354364 263749 309674 257885 223718 172400 102943 180604 369926 34482 437371 171763 308272 71200 301009 247654 ...

output:

11111010110110110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
101011000111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 133 lines

Test #109:

score: 22
Accepted
time: 413ms
memory: 9680kb

input:

100
200 171
14916 15513 23228 14548 6974 3603 12139 1321 21584 16950 13018 20707 17627 70668 44887 21966 33144 52010 41738 9253 53482 26321 47130 43477 23532 38664 39285 48613 41663 28666 47647 19190 34304 55261 13166 55059 18820 36379 33777 49476 33409 43186 32788 29348 29765 35294 32269 41418 3743...

output:

11000101100110000101111001101001101111001000010001101101011011000011101000110011010000000000001101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
111001011001110110000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 100 lines

Test #110:

score: 22
Accepted
time: 478ms
memory: 9772kb

input:

80
250 186
39791 58806 69560 66859 115914 119293 121569 124313 127997 136452 171871 239500 246814 373504 391381 400360 420498 425582 426505 432166 437274 438818 439821 456640 446604 459972 471996 487198 544665 549517 573058 573555 581503 7 547228 534681 402085 361475 343422 241069 104770 587423 5463...

output:

1000011110101011010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
1100101101101011111011001011111...

result:

ok 80 lines

Test #111:

score: 22
Accepted
time: 546ms
memory: 11892kb

input:

50
400 285
476188 463186 436548 196687 87054 88822 61349 22643 426715 433384 425278 422641 410432 410875 408710 392612 389716 387484 349491 295931 313803 291570 238693 286203 190720 234885 228219 168762 137567 135274 108030 105898 27932 11775 10198 5512 5 16429 25833 24570 30209 31947 41778 38408 47...

output:

101000100001010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 50 lines

Test #112:

score: 22
Accepted
time: 575ms
memory: 9812kb

input:

40
500 480
154835 219882 315068 282605 65472 45516 59359 143148 416519 99198 599699 244291 270890 57633 660090 228953 363552 288776 115529 330678 118620 521645 87674 227363 114928 53131 746226 154554 6037 548442 159355 321478 312232 351132 91268 173247 39470 106304 25065 203350 1867 77643 412632 107...

output:

100000011100001010000101000000000000000000000000100000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000011010001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 40 lines

Test #113:

score: 22
Accepted
time: 694ms
memory: 11864kb

input:

20
1000 900
109514 224991 329896 100405 103633 5362 66377 16374 50663 29716 59582 67388 237847 13692 35901 126675 81568 2498 41177 31169 22746 5832 34585 120480 145520 52909 38844 20948 128182 56588 16836 81595 94724 46342 17803 61747 12927 3793 24872 79638 94862 5413 77382 98025 45720 117141 27178 ...

output:

100010111001110011010010010001111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 20 lines

Test #114:

score: 22
Accepted
time: 697ms
memory: 10076kb

input:

10
2000 1965
50596 31266 28365 60339 2682 8835 27622 23995 15655 16867 16931 13943 35351 48520 46246 56120 565093 282589 101316 406620 324991 94009 160588 69910 99859 37327 446538 352219 242651 285982 239318 118509 216980 421213 88839 339407 26141 68291 69290 425200 264174 325766 136213 24880 101142...

output:

111101000001011000110011101100101100010101000110111110111011010010001011100010000001110000110111100100001011100001001010011001110001011000000000000111110101100110010100011110100011011000001111100000100100001101101000011111010101111111001010000011010110000000011000101101011100010110001110110000011001...

result:

ok 10 lines

Test #115:

score: 22
Accepted
time: 890ms
memory: 12008kb

input:

4
5000 4968
19992 91857 44358 89850 51726 48727 63337 87185 71302 31963 73747 32243 94988 43393 46497 575063 444994 336058 173157 339086 15503 427535 30900 159453 301374 360368 56627 121746 365047 96474 339531 255655 14190 100519 167150 90824 450629 95154 201565 406566 145145 243875 16960 490386 294...

output:

101110011111001110100011000000101111010011100110100010110101001100100010100100010100000100100111100000011110011010110011110100111011001111110011100001000100001101011101101101000001111101110010111111100101110010010101110111100101000110101000101111110000000101010100010011110011101001110010001000000001...

result:

ok 4 lines

Test #116:

score: 22
Accepted
time: 837ms
memory: 13352kb

input:

1
20000 17953
999503 995956 992894 988266 979808 979469 974798 972659 970135 965182 958601 959775 948923 946983 944466 942637 939674 938335 936425 934700 926420 921885 921530 921403 919985 919624 918407 902110 902990 897221 896221 891961 883402 877316 880227 877049 874908 873612 863470 858261 850945...

output:

111011010010001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111011010010001011000000000000...0000000000000000000000000000000'

Test #117:

score: 22
Accepted
time: 1087ms
memory: 13348kb

input:

1
20000 19934
46359 49531 51242 133076 8469 8318 27530 139201 7139 10818 39595 265885 51800 61334 22447 169628 72357 110266 7941 112749 170944 197322 739950 15463 480999 177660 677836 168492 167200 289478 362974 276366 61034 46681 96162 206022 10650 152313 87485 161203 108688 10856 252549 90232 2158...

output:

110011000000111010000000000000000000000000000000000000000000000000000000000000000000000010000000000000010000010000001001000000000000000001001000000000000000000001000000000000000000000000000000010000000000000010000001000000000000000000000000000000000000000000000000000000000000000000000000000000010100...

result:

ok single line: '110011000000111010000000000000...0000000000000000000000000000000'

Test #118:

score: 22
Accepted
time: 1025ms
memory: 13352kb

input:

1
20000 19818
52828 59826 11573 31271 83452 79701 33041 17969 45424 238437 29810 157800 9083 244875 175732 48919 129345 195211 101601 159822 54857 195923 32185 9194 21735 13928 44660 75094 28171 284075 10572 234230 195198 60771 4582 94904 159170 22972 48302 46853 38093 38482 255612 22939 13814 78760...

output:

101111111001011000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000010000000000000001001111111111111111111011100110100110000000000000000000000000000000000000000000000...

result:

ok single line: '101111111001011000000000000000...0000000000000000000000000000000'

Test #119:

score: 22
Accepted
time: 1024ms
memory: 13324kb

input:

1
20000 19984
118525 50650 197783 64427 127421 134967 88213 31678 92227 120436 602291 227456 268772 616076 26048 489281 220790 387393 252384 307107 186521 180932 749392 256163 375826 446429 3268 354456 308990 506981 318588 141557 202242 535185 395917 212336 365828 395557 322687 231754 558235 409039 ...

output:

110000100111010011100011000111110001111011001111000111011001110110001000110110001010100110010100101101001001001010101000001011111010001001011110011010010010000010101001110000010100110011100001110100011110110001011111101110101100011111100110101100110010101011001011011011110001000011101100111001110001...

result:

ok single line: '110000100111010011100011000111...0000000000000000000000000000000'

Test #120:

score: 22
Accepted
time: 863ms
memory: 13260kb

input:

1
20000 23973
6 3 1 4 7 6 6 2 4 3 7 5 7 1 8 6 2 7 3 3 6 2 6 5 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 471593 ...

output:

100101100000100010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100101100000100010001000000000...0000000000000000000000000000000'

Test #121:

score: 22
Accepted
time: 1645ms
memory: 13232kb

input:

1
20000 78341
1 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63907 63...

output:

101110110011101001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101110110011101001000000000000...0000000000000000000000000000000'

Test #122:

score: 22
Accepted
time: 722ms
memory: 13284kb

input:

1
20000 10311
5086 9834 1204 29201 17103 3649 18901 19734 28980 32510 10355 12772 21927 19810 29914 17741 10119 25346 28584 8889 26978 21660 5853 5276 1780 23497 12561 7444 7692 14923 20612 9086 488 16757 15442 29525 11111 15558 22783 29163 2316 12820 26946 3174 5970 29039 156025 78670 102627 97457 ...

output:

110100001001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110100001001000000000000000000...0000000000000000000000000000000'

Test #123:

score: 22
Accepted
time: 1357ms
memory: 13280kb

input:

1
20000 16110
144617 180411 48766 111782 248782 154061 99298 126117 62439 66059 121359 117029 222671 234666 169547 173285 16644 41931 215105 78354 171795 153773 223017 203731 125882 68801 149196 81160 191787 190282 241129 261840 252790 78407 248386 67168 260229 88117 209501 224868 171497 95977 16999...

output:

111001010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111001010000000000000000000000...0000000000000000000000000000000'

Test #124:

score: 22
Accepted
time: 1159ms
memory: 13324kb

input:

1
20000 245603
999998 999999 999998 1000000 1000000 1000000 999999 1000000 999999 999999 999999 999998 999998 999999 1000000 1000000 1000000 1000000 999999 999998 999998 1000000 999998 999999 999998 1000000 1000000 999999 1000000 999998 999998 999998 999999 1000000 1000000 999999 999999 999998 99999...

output:

101101110001101011101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '101101110001101011101000000000...0000000000000000000000000000000'