QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#628483#9249. Elimination Series Once Morenjupt_zyAC ✓1865ms294608kbC++232.3kb2024-10-10 20:31:172024-10-10 20:31:18

Judging History

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

  • [2024-10-10 20:31:18]
  • 评测
  • 测评结果:AC
  • 用时:1865ms
  • 内存:294608kb
  • [2024-10-10 20:31:17]
  • 提交

answer

#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;

using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;

constexpr int M = 21, N = (1 << (M - 1)) + 9;
struct Node {
    int l, r;
    int cnt;
} tr[21 * N];
int a[N], rt[N], rtl[(1 << (M + 1)) + 10], rtr[(1 << (M + 1)) + 10], b[N];
int n, k, idx;

inline int read() {
    int x = 0; char c = getchar(), fs = 0; while(! isdigit(c)) fs |= (c == '-'), c = getchar();
    while(isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
    return fs ? -x : x;
}

void build(int p, int l, int r) {
    rtl[p] = l, rtr[p] = r;
    if (l == r) return b[l] = p, void();
    int m = (l + r) >> 1;
    build(p << 1, l, m);
    build(p << 1 | 1, m + 1, r);
}

void add(int p, int &q, int l, int r, int x, int v) {
    tr[q = ++idx] = tr[p];

    if (l == r) return tr[q].cnt += v, void();

    int m = l + r >> 1;
    if (x <= m) add(tr[p].l, tr[q].l, l, m, x, v);
    else add(tr[p].r, tr[q].r, m + 1, r, x, v);

    tr[q].cnt = tr[tr[q].l].cnt + tr[tr[q].r].cnt;
}

int query(int p, int q, int l, int r, int x, int y) {
    if (l > y || r < x) return 0;

    if (l >= x && r <= y) return tr[q].cnt - tr[p].cnt;

    int m = l + r >> 1;
    return query(tr[p].l, tr[q].l, l, m, x, y) + query(tr[p].r, tr[q].r, m + 1, r, x, y);
}

bool check(int i, int x) {
    int now = b[i] / (1 << x);
    int l = rtl[now], r = rtr[now], cnt = query(rt[l - 1], rt[r], 1, (1 << n), a[i] + 1, (1 << n));
    int len = r - l + 1, has = a[i] - 1, use = len - cnt - 1;
    has -= use;
    if (cnt <= k && has >= cnt) {
        return true;
    }

    return false;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> n >> k;

    const int m = (1 << n);
    for (int i = 1; i <= m; i++) {
        cin >> a[i];
        add(rt[i - 1], rt[i], 1, m, a[i], 1);
    }

    build(1, 1, m);

    for (int i = 1; i <= m; i++) {
        int lo = 0, hi = n;

        while (lo < hi) {
            int m = (lo + hi + 1) / 2;
            if (check(i, m)) {
                lo = m;
            } else {
                hi = m - 1;
            }
        }
        printf("%d ", lo);
        // cout << lo << " ";
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 9940kb

input:

2 1
1 2 3 4

output:

0 1 1 2 

result:

ok 4 number(s): "0 1 1 2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 10000kb

input:

3 5
2 4 7 5 3 8 6 1

output:

1 2 2 2 1 3 2 0 

result:

ok 8 numbers

Test #3:

score: 0
Accepted
time: 1ms
memory: 9932kb

input:

3 0
1 2 7 4 5 8 3 6

output:

0 1 2 0 0 3 0 1 

result:

ok 8 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 9932kb

input:

3 5
3 7 1 2 4 8 5 6

output:

1 2 0 1 2 3 2 2 

result:

ok 8 numbers

Test #5:

score: 0
Accepted
time: 1ms
memory: 10056kb

input:

3 3
3 4 8 2 7 6 1 5

output:

1 2 3 1 2 2 0 2 

result:

ok 8 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 10128kb

input:

3 3
4 2 6 8 3 5 1 7

output:

2 1 2 3 1 2 0 2 

result:

ok 8 numbers

Test #7:

score: 0
Accepted
time: 1ms
memory: 9932kb

input:

3 4
5 8 1 3 2 4 6 7

output:

2 3 0 1 1 2 2 2 

result:

ok 8 numbers

Test #8:

score: 0
Accepted
time: 1ms
memory: 10008kb

input:

3 1
7 3 8 6 5 2 4 1

output:

2 1 3 1 2 1 2 0 

result:

ok 8 numbers

Test #9:

score: 0
Accepted
time: 1ms
memory: 9960kb

input:

3 4
1 2 5 3 6 7 4 8

output:

0 1 2 1 2 2 2 3 

result:

ok 8 numbers

Test #10:

score: 0
Accepted
time: 1ms
memory: 10004kb

input:

3 2
2 4 8 6 3 7 5 1

output:

1 2 3 2 1 2 2 0 

result:

ok 8 numbers

Test #11:

score: 0
Accepted
time: 1ms
memory: 10080kb

input:

10 780
495 929 348 345 426 543 187 419 839 812 320 1018 251 284 944 258 721 640 730 528 316 247 313 195 809 948 261 615 805 213 388 894 1005 77 599 636 881 444 144 923 240 520 592 465 96 455 563 943 237 860 531 269 106 989 740 506 23 224 84 475 108 718 3 16 731 436 591 627 672 300 573 613 253 637 46...

output:

8 9 8 8 8 9 7 8 9 9 8 9 7 8 9 8 9 9 9 9 8 7 8 7 9 9 8 9 9 7 8 9 9 6 9 9 9 8 7 9 7 9 9 8 6 8 9 9 7 9 9 8 6 9 9 8 4 7 6 8 6 9 1 4 9 8 9 9 9 8 9 9 7 9 8 9 9 9 6 7 6 7 9 9 9 9 9 7 6 8 8 8 9 9 6 6 9 9 9 8 9 9 6 9 9 8 6 7 8 8 3 8 8 9 6 9 7 8 8 9 9 9 9 8 7 9 8 8 7 7 9 9 9 9 9 8 8 9 6 9 9 9 9 9 9 6 9 8 8 9 ...

result:

ok 1024 numbers

Test #12:

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

input:

10 175
10 301 861 580 539 53 822 97 923 133 952 870 438 265 55 825 557 784 976 584 993 897 981 259 875 18 106 399 1019 692 336 485 491 9 565 114 738 128 678 23 562 538 869 787 768 385 494 640 655 666 332 930 798 418 801 266 1009 846 54 37 967 139 394 802 168 503 233 848 340 329 240 898 251 1023 779 ...

output:

3 7 9 8 8 5 9 6 9 7 9 9 8 7 5 9 8 9 9 8 9 9 9 7 9 4 6 8 9 9 8 8 8 3 8 6 9 7 9 4 8 8 9 9 9 8 8 8 8 8 8 9 9 8 9 7 9 9 5 5 9 7 8 9 7 8 7 9 8 8 7 9 7 9 9 9 8 8 9 9 8 7 9 7 8 6 8 5 5 9 9 7 8 9 6 5 8 9 8 5 7 8 9 7 6 9 8 9 8 2 6 9 8 9 9 8 8 5 9 8 9 7 9 9 9 6 9 9 7 10 9 8 9 9 9 7 8 7 8 8 8 6 7 6 7 4 8 9 9 8...

result:

ok 1024 numbers

Test #13:

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

input:

10 15
829 331 590 799 39 456 888 779 60 411 796 148 678 930 101 653 81 429 4 457 455 703 780 260 251 21 291 122 366 177 665 326 114 96 445 123 154 340 522 113 895 170 144 857 447 865 874 891 679 541 867 731 436 219 871 596 285 1008 435 263 881 798 16 275 14 97 845 269 974 782 343 404 561 540 443 482...

output:

6 4 5 6 4 5 7 5 4 4 6 4 5 7 4 5 4 5 2 5 5 5 6 4 4 4 4 4 4 4 5 4 4 4 4 4 4 4 5 4 7 4 4 6 5 6 7 7 5 5 6 5 4 4 6 5 4 9 4 4 7 6 4 4 3 4 6 4 8 6 4 4 5 5 4 5 7 7 4 4 4 4 4 5 9 4 4 7 5 8 4 4 6 4 6 9 6 4 8 5 5 4 4 4 5 4 5 5 4 4 4 4 5 4 5 5 4 5 4 4 5 4 4 6 4 9 5 6 8 6 5 6 6 7 4 4 4 4 4 4 4 3 4 4 4 4 6 7 7 5 ...

result:

ok 1024 numbers

Test #14:

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

input:

10 215
910 367 1011 675 689 697 604 665 730 306 743 225 210 1008 546 439 411 475 529 640 54 505 420 481 213 406 1012 933 392 121 751 554 265 550 621 537 212 908 49 918 768 125 16 927 507 863 1000 44 900 7 645 543 784 461 569 669 984 249 189 727 497 994 719 282 666 691 58 795 119 515 682 150 53 494 6...

output:

9 8 9 9 9 9 9 9 9 8 9 7 7 9 8 8 8 8 8 9 5 8 8 8 7 8 9 9 8 6 9 8 8 8 9 8 7 9 5 9 9 6 4 9 8 9 9 5 9 2 9 8 9 8 8 9 9 7 7 9 8 9 9 8 9 9 5 9 6 8 9 7 5 8 9 8 9 9 7 9 8 9 9 9 8 9 7 5 8 7 9 8 8 6 9 9 8 6 5 9 8 8 9 8 7 9 9 8 6 4 9 6 9 8 8 9 7 8 9 8 5 8 8 9 8 9 8 9 9 8 8 7 5 9 9 9 9 9 8 8 9 9 6 8 6 8 6 9 9 9 ...

result:

ok 1024 numbers

Test #15:

score: 0
Accepted
time: 1ms
memory: 10088kb

input:

10 358
714 252 544 999 507 766 720 169 379 856 698 40 910 610 564 125 278 426 285 205 746 43 23 284 81 525 848 540 827 604 630 741 27 313 452 724 9 745 762 263 44 901 864 445 418 596 310 719 988 536 799 625 202 895 412 153 847 145 353 297 133 260 717 893 158 314 90 356 108 315 1016 510 1015 1007 747...

output:

9 7 9 9 8 9 9 7 8 9 9 5 9 9 9 6 8 8 8 7 9 5 4 8 6 9 9 9 9 9 9 9 4 8 8 9 3 9 9 8 5 9 9 8 8 9 8 9 9 9 9 9 7 9 8 7 9 7 8 8 7 8 9 9 7 8 6 8 6 8 9 8 9 9 9 7 9 9 7 9 6 9 9 7 8 7 9 7 8 7 9 9 7 9 9 4 8 9 8 9 9 9 7 9 6 9 8 9 9 9 8 9 9 9 8 3 8 9 4 7 8 8 8 8 8 8 9 6 8 6 9 7 9 9 8 7 9 9 9 9 7 8 9 8 9 8 9 7 8 9 ...

result:

ok 1024 numbers

Test #16:

score: 0
Accepted
time: 1ms
memory: 10268kb

input:

10 409
720 603 348 938 361 756 506 176 661 192 318 599 115 548 681 692 915 148 721 93 424 707 404 392 695 342 247 799 743 814 82 120 365 428 461 355 184 372 224 810 225 569 630 800 480 226 802 867 136 592 723 412 248 619 817 67 891 72 74 315 624 250 1001 73 536 397 859 553 647 143 575 733 468 298 71...

output:

9 9 8 9 8 9 8 7 9 7 8 9 6 9 9 9 9 7 9 6 8 9 8 8 9 8 7 9 9 9 6 6 8 8 8 8 7 8 7 9 7 9 9 9 8 7 9 9 7 9 9 8 7 9 9 6 9 6 6 8 9 7 9 6 9 8 9 9 9 7 9 9 8 8 9 6 9 9 8 9 9 9 7 8 8 9 5 9 7 7 7 9 9 9 8 7 8 9 8 8 8 8 4 8 8 9 9 8 6 9 9 9 2 9 7 9 8 9 8 7 8 7 9 6 6 9 9 9 7 9 9 8 9 9 9 9 8 9 8 8 8 9 9 9 8 9 6 9 8 9 ...

result:

ok 1024 numbers

Test #17:

score: 0
Accepted
time: 1ms
memory: 10080kb

input:

10 700
469 249 763 385 977 949 423 11 825 442 744 993 553 908 410 860 465 291 751 234 50 897 64 346 481 1010 444 88 605 268 531 167 853 367 389 191 784 723 783 277 916 649 418 932 516 972 714 905 358 364 334 293 391 337 785 837 721 568 555 102 456 554 165 141 253 852 43 109 699 963 915 611 16 156 83...

output:

8 7 9 8 9 9 8 3 9 8 9 9 9 9 8 9 8 8 9 7 5 9 6 8 8 9 8 6 9 8 9 7 9 8 8 7 9 9 9 8 9 9 8 9 9 9 9 9 8 8 8 8 8 8 9 9 9 9 9 6 8 9 7 7 7 9 5 6 9 9 9 9 4 7 6 8 9 9 9 7 6 5 8 8 9 8 8 8 9 7 8 9 8 8 7 9 7 9 6 6 8 9 5 9 9 8 9 8 9 9 9 8 9 8 8 9 7 9 8 6 8 6 9 9 6 9 9 5 8 7 8 9 8 8 9 6 7 7 9 8 9 9 9 9 9 6 9 9 7 6 ...

result:

ok 1024 numbers

Test #18:

score: 0
Accepted
time: 1ms
memory: 10080kb

input:

10 655
971 111 296 479 453 490 163 686 195 492 1014 762 1021 15 351 618 137 181 853 758 876 598 703 486 125 35 41 266 603 682 733 294 391 967 373 508 860 501 1018 1003 642 365 531 883 89 674 869 311 442 734 886 165 701 139 447 271 540 190 983 474 816 769 1015 101 896 904 692 627 643 750 615 20 406 5...

output:

9 6 8 8 8 8 7 9 7 8 9 9 9 3 8 9 7 7 9 9 9 9 9 8 6 5 5 8 9 9 9 8 8 9 8 8 9 8 9 9 9 8 9 9 6 9 9 8 8 9 9 7 9 7 8 8 9 7 9 8 9 9 9 6 9 9 9 9 9 9 9 4 8 8 7 8 7 9 9 8 2 9 9 9 9 9 9 5 8 7 9 9 7 8 8 6 7 7 7 8 9 9 9 9 9 7 9 9 9 5 9 9 7 7 9 9 8 9 7 6 7 8 9 8 4 9 8 9 9 9 8 9 8 8 9 5 8 7 4 9 9 9 6 8 8 9 8 9 9 8 ...

result:

ok 1024 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 10160kb

input:

10 827
692 816 52 570 178 260 248 531 852 777 232 378 955 632 325 256 328 599 802 165 966 493 166 125 488 942 965 716 947 276 156 894 194 742 933 185 384 152 277 333 991 424 487 435 423 504 113 106 307 205 745 155 654 226 16 518 884 757 1009 133 401 392 451 510 682 717 922 608 148 206 854 355 728 51...

output:

9 9 5 9 7 8 7 9 9 9 7 8 9 9 8 8 8 9 9 7 9 8 7 6 8 9 9 9 9 8 7 9 7 9 9 7 8 7 8 8 9 8 8 8 8 8 6 6 8 7 9 7 9 7 4 9 9 9 9 7 8 8 8 8 9 9 9 9 7 7 9 8 9 8 7 7 5 7 8 9 8 8 8 9 9 7 9 6 9 8 6 6 4 9 8 5 9 6 9 9 7 9 9 6 9 9 8 8 9 9 9 9 9 9 8 2 6 9 9 9 7 8 9 9 2 8 7 8 8 8 7 9 9 8 9 8 4 9 9 8 9 8 8 9 4 8 9 9 9 6 ...

result:

ok 1024 numbers

Test #20:

score: 0
Accepted
time: 0ms
memory: 10108kb

input:

10 328
454 408 810 540 254 321 33 682 91 53 398 761 1023 243 581 545 825 892 100 356 17 326 487 878 787 756 996 707 770 924 945 272 428 686 339 908 390 645 238 337 517 364 717 404 533 394 849 435 894 947 482 806 657 39 781 946 75 656 129 476 676 984 456 412 463 160 562 592 345 141 145 501 921 991 21...

output:

8 8 9 9 7 8 5 9 6 5 8 9 9 7 9 9 9 9 6 8 4 8 8 9 9 9 9 9 9 9 9 8 8 9 8 9 8 9 7 8 9 8 9 8 9 8 9 8 9 9 8 9 9 5 9 9 6 9 7 8 9 9 8 8 8 7 9 9 8 7 7 8 9 9 7 8 6 5 9 9 3 9 9 6 9 9 6 9 1 9 9 8 8 8 8 8 8 9 8 9 8 5 8 9 7 9 8 7 8 9 9 8 8 2 9 7 8 9 7 9 8 9 9 9 8 8 9 9 9 8 9 6 7 9 9 8 8 9 7 9 9 9 9 9 9 9 9 4 6 9 ...

result:

ok 1024 numbers

Test #21:

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

input:

10 825
601 142 625 471 287 405 117 857 340 984 863 530 575 994 436 394 529 25 141 332 735 966 1 831 673 896 89 272 649 81 384 242 864 817 174 382 145 469 577 715 893 275 914 455 667 169 179 521 305 925 976 213 40 380 659 499 918 725 561 616 948 924 1022 721 235 485 85 781 540 52 892 982 254 461 381 ...

output:

9 7 9 8 8 8 6 9 8 9 9 9 9 9 8 8 9 4 7 8 9 9 0 9 9 9 6 8 9 6 8 7 9 9 7 8 7 8 9 9 9 8 9 8 9 7 7 9 8 9 9 7 5 8 9 8 9 9 9 9 9 9 9 9 7 8 6 9 9 5 9 9 7 8 8 9 9 6 9 9 9 9 8 4 5 7 9 9 8 5 9 9 9 7 9 6 8 9 2 6 9 8 9 7 7 9 9 9 9 9 9 7 8 8 9 9 9 6 9 8 7 9 9 6 9 9 9 4 9 8 9 9 9 8 7 8 7 8 7 8 9 8 4 9 9 9 6 7 7 9 ...

result:

ok 1024 numbers

Test #22:

score: 0
Accepted
time: 1089ms
memory: 293368kb

input:

20 0
179487 921757 700836 1026745 871114 487101 416568 943369 555729 702080 475044 257810 489454 716476 879881 237658 884615 645342 654881 754504 537330 488794 60810 581898 627225 134547 267586 35544 535278 202909 1006004 182486 863804 12271 705426 1000913 315415 495258 494119 323180 59354 347058 62...

output:

0 1 0 5 1 0 0 2 0 2 1 0 0 1 3 0 3 0 0 1 1 0 0 2 2 0 1 0 1 0 4 0 1 0 0 3 0 2 1 0 0 1 0 2 1 0 6 0 4 0 0 1 0 1 0 2 2 0 0 1 0 3 0 1 4 0 0 1 2 0 0 1 0 1 0 3 0 1 2 0 2 0 1 0 3 0 0 1 1 0 12 0 2 0 1 0 0 1 4 0 0 1 2 0 0 3 0 1 0 1 0 2 1 0 2 0 0 1 3 0 0 1 0 5 0 1 2 0 1 0 0 3 1 0 0 2 1 0 4 0 2 0 0 1 1 0 2 0 0 5...

result:

ok 1048576 numbers

Test #23:

score: 0
Accepted
time: 1148ms
memory: 293840kb

input:

20 0
423991 752898 398498 684927 789044 263019 482251 912839 731501 161924 299043 221772 386164 726231 81052 522548 2147 664063 669633 811292 646801 487230 645801 231433 697608 767873 119403 655574 294512 625240 464604 171777 37789 989183 13473 24697 1013507 285860 816836 313163 256565 724812 246357...

output:

0 2 0 1 1 0 0 5 3 0 1 0 0 2 0 1 0 1 0 4 2 0 1 0 0 3 0 1 0 2 1 0 0 2 0 1 3 0 1 0 0 2 1 0 0 1 0 6 4 0 1 0 0 2 0 1 1 0 0 3 1 0 0 2 0 1 2 0 0 3 1 0 0 5 1 0 0 1 2 0 2 0 1 0 1 0 4 0 0 3 0 1 2 0 1 0 0 1 3 0 2 0 0 1 8 0 0 1 1 0 2 0 1 0 0 3 0 1 2 0 4 0 1 0 0 2 1 0 6 0 1 0 1 0 2 0 1 0 0 2 1 0 3 0 0 1 0 4 2 0 ...

result:

ok 1048576 numbers

Test #24:

score: 0
Accepted
time: 1101ms
memory: 293780kb

input:

20 0
983530 824894 353093 559444 613542 519778 1010412 455455 935622 219374 221225 1002197 688110 472174 221344 689249 527925 36045 510374 449980 724144 993684 416271 594751 888484 336792 425268 493926 392740 391689 841678 822738 12764 433848 349413 450603 182285 354617 758953 176599 70237 340919 10...

output:

2 0 0 1 1 0 6 0 1 0 0 3 1 0 0 2 2 0 1 0 0 4 0 1 3 0 0 1 1 0 2 0 0 1 0 2 0 1 4 0 0 1 0 3 0 1 0 2 0 3 0 1 1 0 2 0 0 5 0 1 0 2 0 1 1 0 2 0 0 1 0 4 1 0 0 2 0 1 0 3 0 2 1 0 7 0 1 0 0 3 1 0 0 1 2 0 0 1 2 0 1 0 0 4 0 2 0 1 1 0 0 3 0 2 0 1 0 1 0 3 0 5 1 0 1 0 2 0 4 0 0 1 0 2 0 1 2 0 1 0 3 0 1 0 1 0 6 0 0 2 ...

result:

ok 1048576 numbers

Test #25:

score: 0
Accepted
time: 1136ms
memory: 293828kb

input:

20 0
473443 822631 836606 745020 669384 831958 929557 812459 979454 261979 335172 118201 544502 229223 877541 915721 504368 226689 582157 166448 910835 805293 989769 735782 836472 212234 901652 203944 246343 341883 923372 761793 496413 774045 10709 822705 804842 393237 234688 760980 575433 264037 29...

output:

0 1 2 0 0 1 3 0 4 0 1 0 1 0 0 2 1 0 2 0 1 0 5 0 1 0 2 0 0 1 3 0 0 1 0 3 2 0 0 1 1 0 0 6 2 0 0 1 0 1 0 2 0 1 0 3 1 0 2 0 0 4 0 1 0 1 8 0 2 0 1 0 1 0 0 3 2 0 0 1 0 1 0 3 0 2 1 0 2 0 0 1 1 0 0 4 1 0 3 0 1 0 2 0 2 0 0 1 4 0 0 1 2 0 1 0 1 0 3 0 0 2 1 0 0 1 5 0 2 0 1 0 0 4 1 0 3 0 0 1 1 0 0 2 0 6 0 1 2 0 ...

result:

ok 1048576 numbers

Test #26:

score: 0
Accepted
time: 1171ms
memory: 294608kb

input:

20 0
379980 596897 473700 685210 871737 592347 265581 99773 654162 711671 796026 221716 77951 211806 1016499 68541 105291 832026 37890 741817 787 338525 847057 564452 291439 25137 796527 274136 516811 336906 65693 431115 565546 913432 505987 731031 411514 962171 317881 69424 7338 181350 326333 89987...

output:

0 1 0 2 3 0 1 0 0 1 2 0 0 1 5 0 0 2 0 1 0 1 4 0 1 0 3 0 2 0 0 1 0 2 0 1 0 4 1 0 0 1 0 3 1 0 2 0 0 6 0 1 2 0 1 0 0 1 2 0 0 3 1 0 0 3 1 0 0 1 2 0 0 2 0 1 4 0 1 0 0 3 0 1 2 0 1 0 1 0 0 2 1 0 5 0 2 0 0 1 1 0 4 0 0 1 0 3 2 0 1 0 1 0 0 2 1 0 3 0 0 1 2 0 1 0 0 8 0 3 1 0 0 2 1 0 1 0 0 2 5 0 1 0 0 1 0 2 1 0 ...

result:

ok 1048576 numbers

Test #27:

score: 0
Accepted
time: 1865ms
memory: 293104kb

input:

20 966077
920272 22829 905052 391939 529694 220017 113245 305146 1033496 776070 372388 649193 372732 578999 535089 376914 300958 674096 713438 294435 185108 175377 843411 186645 326129 937577 777304 855769 317353 63291 166972 152975 982092 882338 296632 371732 94559 247688 915006 853946 1012694 9336...

output:

19 14 19 18 19 17 16 18 19 19 18 19 18 19 19 18 18 19 19 18 17 17 19 17 18 19 19 19 18 15 17 17 19 19 18 18 16 17 19 19 19 19 19 18 19 19 18 18 17 19 18 19 8 19 17 19 18 15 18 18 19 19 18 19 18 18 19 19 18 19 18 15 19 19 19 19 19 19 19 19 18 19 19 19 18 19 19 19 19 19 18 19 19 19 19 18 19 19 17 10 1...

result:

ok 1048576 numbers

Test #28:

score: 0
Accepted
time: 1848ms
memory: 293676kb

input:

20 555721
1021880 172635 932280 918167 428846 525908 637187 103654 49068 457344 839373 885403 875027 863134 159977 579040 304249 818545 817257 382257 340884 241982 600075 712988 202019 851311 748360 695531 253852 133923 1008492 733146 54917 186299 303527 503548 507480 252648 624742 477048 106320 821...

output:

19 17 19 19 18 19 19 16 15 18 19 19 19 19 17 19 18 19 19 18 18 17 19 19 17 19 19 19 17 17 19 19 15 17 18 18 18 17 19 18 16 19 19 18 19 18 19 19 19 19 18 18 19 19 19 18 18 18 19 17 18 19 19 18 19 18 19 18 19 18 16 18 18 19 16 19 19 19 18 17 18 19 17 17 14 17 17 19 19 19 17 19 19 17 19 18 19 18 19 19 ...

result:

ok 1048576 numbers

Test #29:

score: 0
Accepted
time: 1201ms
memory: 293736kb

input:

20 2
87510 685288 54938 588070 730372 367883 146344 699592 300414 900908 862877 34670 608547 282283 117736 44808 999805 244617 341801 858399 835822 519712 716403 614366 485823 268639 172640 546962 812810 157814 475854 213833 81808 987188 847699 726734 206379 1012914 844523 385962 511314 353768 94378...

output:

2 3 1 2 4 2 1 3 2 5 5 1 3 2 2 1 6 1 2 4 4 1 2 2 3 2 1 3 3 1 2 2 1 5 3 2 1 6 2 2 2 1 4 3 3 2 2 1 2 1 7 3 1 4 2 2 4 1 3 2 2 3 2 1 4 1 2 3 2 2 4 1 3 1 2 3 2 1 4 2 2 1 3 5 2 1 3 2 1 6 2 2 1 5 3 2 1 2 5 2 1 4 2 3 1 3 2 4 1 2 2 3 1 3 2 2 2 3 1 3 2 9 2 1 1 10 2 4 2 1 4 3 2 2 5 1 2 5 3 1 1 2 3 2 1 2 3 2 3 2...

result:

ok 1048576 numbers

Test #30:

score: 0
Accepted
time: 1159ms
memory: 293956kb

input:

20 3
924274 728807 143468 851897 609988 262663 982977 610373 135163 134795 923793 569204 875986 702834 971502 187748 476516 975902 30626 644269 750325 1008247 323883 860636 159423 598401 812886 286710 132495 750781 261871 354651 706866 180913 835118 817970 433926 930245 403851 555752 127938 224375 6...

output:

4 3 2 3 2 2 6 2 2 2 4 2 3 3 5 2 2 5 2 2 3 6 2 4 2 3 4 2 2 3 2 3 3 2 4 4 2 5 2 2 2 2 3 3 2 5 2 3 2 2 3 4 3 2 4 2 2 8 2 3 2 3 7 2 3 5 2 2 4 3 2 2 4 2 2 2 3 3 2 5 4 5 2 3 2 5 2 2 3 3 2 4 2 2 3 2 2 3 4 7 4 2 2 2 2 6 2 2 2 3 3 3 2 3 2 4 3 2 7 2 2 3 2 2 2 4 3 6 2 2 6 3 5 2 2 3 3 2 2 2 3 4 8 2 2 2 2 4 3 2 ...

result:

ok 1048576 numbers

Test #31:

score: 0
Accepted
time: 1133ms
memory: 292892kb

input:

20 0
902882 664857 1047224 183618 88593 382161 107917 67910 527299 367280 276070 1032135 680366 72379 583921 516904 965765 513924 476186 648968 534455 800221 24161 171781 528257 795611 1385 536913 485662 465619 713814 725103 525557 690722 90305 573527 1015872 121873 542098 949802 127102 958923 53236...

output:

1 0 9 0 0 2 1 0 1 0 0 3 2 0 1 0 4 0 0 1 0 2 0 1 0 3 0 1 1 0 0 2 0 2 0 1 5 0 0 1 0 3 0 1 0 1 2 0 4 0 0 1 0 2 0 1 0 2 1 0 1 0 0 3 2 0 0 1 1 0 5 0 0 1 0 3 1 0 0 2 0 2 0 1 0 3 0 1 2 0 1 0 0 1 4 0 1 0 4 0 2 0 1 0 0 2 0 1 1 0 0 3 0 6 0 1 0 2 0 1 0 3 1 0 0 1 0 2 2 0 0 1 0 7 1 0 0 1 0 2 0 1 3 0 0 2 1 0 1 0 ...

result:

ok 1048576 numbers

Test #32:

score: 0
Accepted
time: 1ms
memory: 10060kb

input:

1 1
2 1

output:

1 0 

result:

ok 2 number(s): "1 0"

Test #33:

score: 0
Accepted
time: 0ms
memory: 9952kb

input:

1 0
1 2

output:

0 1 

result:

ok 2 number(s): "0 1"

Test #34:

score: 0
Accepted
time: 1695ms
memory: 293688kb

input:

20 1048575
924274 728807 143468 851897 609988 262663 982977 610373 135163 134795 923793 569204 875986 702834 971502 187748 476516 975902 30626 644269 750325 1008247 323883 860636 159423 598401 812886 286710 132495 750781 261871 354651 706866 180913 835118 817970 433926 930245 403851 555752 127938 22...

output:

19 19 17 19 19 18 19 19 17 17 19 19 19 19 19 17 18 19 14 19 19 19 18 19 17 19 19 18 17 19 17 18 19 17 19 19 18 19 18 19 16 17 19 18 17 19 15 18 19 16 19 19 19 18 19 17 19 19 19 19 19 19 19 17 19 19 12 18 19 18 14 16 19 16 15 16 19 18 14 19 19 19 16 18 17 19 18 17 19 19 16 19 16 14 18 16 18 19 19 19 ...

result:

ok 1048576 numbers

Extra Test:

score: 0
Extra Test Passed