QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#868063#9684. 倾诉le0n62 3676ms31556kbC++207.5kb2025-01-24 11:39:232025-01-24 11:39:24

Judging History

This is the latest submission verdict.

  • [2025-01-24 11:39:24]
  • Judged
  • Verdict: 62
  • Time: 3676ms
  • Memory: 31556kb
  • [2025-01-24 11:39:23]
  • Submitted

answer

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

const int N = 3e4 + 5, B = 20;
const int mod[3] = {998244353, (int)1e9 + 7, (int)1e9 + 9}, inf = (int)1e9 + 5;
int pw[3][N];
int sum[3][N];
int val[N][35], mx[N], pos[N], a[N], n;
int qry(int l, int r)
{
    if(r - l <= B)
        return val[r][r - l];
    return mx[r] - (l > pos[r]);
}
struct node
{
    int l, r, k;
    node(int l0 = 0, int r0 = 0, int k0 = 0)
    {
        l = l0;
        r = r0;
        k = k0;
    }
    int qval()
    {
        return qry(l, r) >> k;
    }
    int qbit(int x)
    {
        x -= k;
        if(x < 0)
            return (qry(l, r) >> (-x)) & 1;
        if(x > r - l)
            return 0;
        return qry(l, r - x) & 1;
    }
    int hs(int x)
    {
        x -= k;
        if(x < 0)
        {
            int v = qry(l, r) >> (-x);
            return v;
        }
        if(x > r - l)
            return (sum[0][l] + (ll)(mod[0] - pw[0][r - l + 1]) * sum[0][r + 1]) % mod[0] * pw[0][x - r + l] % mod[0];
        return (qry(l, r - x) + 2 * (sum[0][r - x + 1] + (ll)(mod[0] - pw[0][x]) * sum[0][r + 1])) % mod[0];
    }
};
bool chk(node A, node B) // A < B
{
    int lim = n + 30;
    if(A.hs(lim) == B.hs(lim))
        return make_pair(make_pair(A.l, A.r), A.k) < make_pair(make_pair(B.l, B.r), B.k);
    // printf("A\n");
    if(A.qval() != B.qval())
        return A.qval() < B.qval();
    // printf("B\n");
    int l, r, mid;
    l = 1;
    r = lim;
    while(l <= r)
    {
        mid = (l + r) >> 1;
        // printf("PP%d %d %d\n", mid, A.hs(mid)[0], B.hs(mid)[0]);
        if(A.hs(mid) == B.hs(mid))
            l = mid + 1;
        else
            r = mid - 1;
    }
    // printf("OO%d %d %d\n", l, A.qbit(l), B.qbit(l));
    return A.qbit(l) < B.qbit(l);
}
ll dp[N][35];
int lp[N][35], L[N][35], R[N][35];
ll mnv[21][N];
node ans;
vector<int> out;

int main()
{
    mt19937_64 rng(123823);
    int T, k, i, j, p, fl, l, r, mid;
    ll tmp, tot, x;
    node qwq;
    n = 3e4;
    for(j = 0; j < 3; j++)
    {
        pw[j][0] = 1;
        for(i = 1; i <= n; i++)
            pw[j][i] = 2ll * pw[j][i - 1] % mod[j];
    }
    scanf("%d", &T);
    while(T--)
    {
        scanf("%d%d", &n, &k);
        for(i = 1; i <= n; i++)
            scanf("%d", a + i);
        for(j = 0; j < 3; j++)
        {
            sum[j][n + 1] = 0;
            for(i = n; i >= 1; i--)
                sum[j][i] = (2ll * sum[j][i + 1] + a[i]) % mod[j];
        }
        for(i = 1; i <= n; i++)
        {
            tmp = 0;
            memset(val[i], 0, sizeof(val[i]));
            mx[i] = pos[i] = 0;
            for(j = i; j >= max(i - B, 1); j--)
            {
                tmp = 2 * tmp + a[j];
                val[i][i - j] = (tmp >> (i - j));
                if(val[i][i - j] > mx[i])
                {
                    mx[i] = val[i][i - j];
                    pos[i] = j;
                }
            }
            if(mx[i - 1] / 2 + a[i] > mx[i])
            {
                mx[i] = mx[i - 1] / 2 + a[i];
                pos[i] = pos[i - 1];
            }
        }
        // for(i = 1; i <= n; i++)
        //     for(j = i; j <= n; j++)
        //         printf("??%d %d %d\n", i, j, qry(i, j));
        ans = node(n, n, -1);
        tot = 0;
        for(i = 1; i <= n; i++)
            for(j = 0; j <= B; j++)
            {
                L[i][j] = 1;
                R[i][j] = i;
                tot += R[i][j] - L[i][j] + 1;
            }
        // printf("#%d\n", chk(node(1, 1, 1), node(6, 9, 0)));
        // return 0;
        while(tot)
        {
            x = rng() % tot + 1;
            fl = 0;
            qwq = node(n, n, -1);
            for(i = 1; i <= n; i++)
            {
                for(j = 0; j <= B; j++)
                    if(x <= R[i][j] - L[i][j] + 1)
                    {
                        fl = 1;
                        qwq = node(L[i][j] - 1 + x, i, j);
                        break;
                    }
                    else
                        x -= max(R[i][j] - L[i][j] + 1, 0);
                if(fl)
                    break;
            }
            for(i = 1; i <= n; i++)
                for(j = 0; j <= B; j++)
                    if(i == qwq.r && j == qwq.k)
                        lp[i][j] = qwq.l;
                    else
                    {
                        l = 1;
                        r = i;
                        while(l <= r)
                        {
                            mid = (l + r) >> 1;
                            if(chk(node(mid, i, j), qwq))
                                r = mid - 1;
                            else
                                l = mid + 1;
                        }
                        lp[i][j] = l;
                    }
            // printf("#%lld %d %d %d\n", tot, qwq.l, qwq.r, qwq.k);
            // for(i = 1; i <= n; i++)
            //     for(j = 0; j <= B; j++)
            //         printf("!!%d %d: %d %d %d\n", i, j, L[i][j], R[i][j], lp[i][j]);
            // return 0;
            for(i = 0; i <= B; i++)
                dp[0][i] = 0;
            for(i = 1; i <= n; i++)
            {
                for(j = 0; j <= B; j++)
                {
                    dp[i][j] = (j ? dp[i][j - 1] : inf);
                    if(lp[i][j] >= i - B)
                    {
                        for(p = i; p >= lp[i][j]; p--)
                            dp[i][j] = min(dp[i][j], dp[p - 1][min(j + i - p, B)] + j + i - p);
                        continue;
                    }
                    for(p = i; p >= i - B; p--)
                        dp[i][j] = min(dp[i][j], dp[p - 1][min(j + i - p, B)] + j + i - p);
                    // for(p = i - B - 1; p >= lp[i][j]; p--)
                    //     dp[i][j] = min(dp[i][j], dp[p - 1][B] + j + i - p);
                    int Lp = lp[i][j], Rp = i - B - 1;
                    int oo = __lg(Rp - Lp + 1);
                    dp[i][j] = min(dp[i][j], min(mnv[oo][Rp], mnv[oo][Lp + (1 << oo) - 1]) + j + i);
                }
                mnv[0][i] = dp[i - 1][B] - i;
                for(j = 1; j <= __lg(i); j++)
                    mnv[j][i] = min(mnv[j - 1][i], mnv[j - 1][i - (1 << (j - 1))]);
            }
            if(dp[n][0] <= k)
            {
                ans = qwq;
                for(i = 1; i <= n; i++)
                    for(j = 0; j <= B; j++)
                        L[i][j] = max(L[i][j], lp[i][j] + (i == qwq.r && j == qwq.k));
            }
            else
                for(i = 1; i <= n; i++)
                    for(j = 0; j <= B; j++)
                        R[i][j] = min(R[i][j], lp[i][j] - 1);
            tot = 0;
            for(i = 1; i <= n; i++)
                for(j = 0; j <= B; j++)
                    tot += max(R[i][j] - L[i][j] + 1, 0);
        }
        // printf("#%d %d %d\n", ans.l, ans.r, ans.k);
        out.clear();
        p = n - ans.k - ans.r + ans.l;
        while(p--)
            out.emplace_back(0);
        tmp = 0;
        for(i = ans.l; i <= ans.r; i++)
        {
            if(i > ans.l)
                out.emplace_back(tmp & 1);
            tmp = tmp / 2 + a[i];
        }
        while(tmp)
        {
            out.emplace_back(tmp & 1);
            tmp /= 2;
        }
        reverse(out.begin(), out.end());
        for(auto o: out)
            printf("%d", o);
        printf("\n");
        // return 0;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 1ms
memory: 16576kb

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: 1ms
memory: 16576kb

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: 1ms
memory: 16580kb

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: 1ms
memory: 14524kb

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: 14468kb

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: 2ms
memory: 16504kb

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: 2ms
memory: 16396kb

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: 2ms
memory: 16572kb

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: 1ms
memory: 16408kb

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: 3ms
memory: 16584kb

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: 2ms
memory: 16576kb

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: 3ms
memory: 14528kb

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: 8ms
memory: 16556kb

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: 12ms
memory: 16404kb

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: 21ms
memory: 16572kb

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: 17ms
memory: 16368kb

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: 27ms
memory: 18636kb

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: 15ms
memory: 18640kb

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: 20ms
memory: 14520kb

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: 22ms
memory: 18640kb

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: 20ms
memory: 16572kb

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: 19ms
memory: 18636kb

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: 10ms
memory: 16572kb

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: 15ms
memory: 16540kb

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: 29ms
memory: 16584kb

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: 42ms
memory: 16576kb

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: 58ms
memory: 16080kb

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: 68ms
memory: 16580kb

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: 49ms
memory: 16444kb

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: 84ms
memory: 16576kb

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: 126ms
memory: 18288kb

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: 89ms
memory: 16644kb

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: 152ms
memory: 16640kb

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: 121ms
memory: 16544kb

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: 183ms
memory: 18512kb

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: 121ms
memory: 18636kb

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: 124ms
memory: 16588kb

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: 142ms
memory: 18348kb

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: 136ms
memory: 16388kb

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: 32ms
memory: 14520kb

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: 48ms
memory: 16568kb

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: 90ms
memory: 16296kb

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: 138ms
memory: 16376kb

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: 190ms
memory: 16572kb

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: 223ms
memory: 18636kb

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: 255ms
memory: 16516kb

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: 267ms
memory: 18632kb

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: 312ms
memory: 18352kb

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: 318ms
memory: 16580kb

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: 590ms
memory: 18660kb

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: 488ms
memory: 18528kb

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: 503ms
memory: 18544kb

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: 470ms
memory: 26888kb

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: 636ms
memory: 18652kb

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: 566ms
memory: 18460kb

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: 463ms
memory: 16608kb

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: 554ms
memory: 18648kb

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: 557ms
memory: 16432kb

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: 616ms
memory: 16788kb

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: 125ms
memory: 14524kb

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: 192ms
memory: 16572kb

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: 378ms
memory: 16428kb

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: 578ms
memory: 16428kb

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: 776ms
memory: 16576kb

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: 943ms
memory: 16448kb

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: 1063ms
memory: 16468kb

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: 1117ms
memory: 16444kb

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: 1264ms
memory: 16588kb

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: 1396ms
memory: 18640kb

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: 1725ms
memory: 16588kb

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: 1973ms
memory: 16600kb

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: 2821ms
memory: 29360kb

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: 2893ms
memory: 22924kb

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: 2971ms
memory: 20948kb

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: 2530ms
memory: 31556kb

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: 3193ms
memory: 29440kb

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: 2680ms
memory: 31296kb

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: 3676ms
memory: 31284kb

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: 3210ms
memory: 29328kb

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: 0
Time Limit Exceeded

Test #80:

score: 16
Accepted
time: 254ms
memory: 16332kb

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: 386ms
memory: 14396kb

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: 758ms
memory: 18632kb

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: 1123ms
memory: 16376kb

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: 1568ms
memory: 18636kb

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: 1834ms
memory: 16448kb

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: 2046ms
memory: 16472kb

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: 2174ms
memory: 16308kb

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: 2546ms
memory: 18580kb

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: 2835ms
memory: 18496kb

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: 3387ms
memory: 18396kb

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: 0
Time Limit Exceeded

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:


Subtask #7:

score: 0
Skipped

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

0%