QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#385745#8598. AND МасивQingyu100 ✓3939ms21204kbC++233.1kb2024-04-11 01:25:332024-04-12 13:22:15

Judging History

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

  • [2024-04-12 13:22:15]
  • 管理员手动重测该提交记录
  • 测评结果:100
  • 用时:3939ms
  • 内存:21204kb
  • [2024-04-11 01:25:33]
  • 评测
  • 测评结果:100
  • 用时:3893ms
  • 内存:21400kb
  • [2024-04-11 01:25:33]
  • 提交

answer

#pragma GCC target("avx2")
#include<bits/stdc++.h>
using namespace std;
uint32_t ins = 0, qry = 0;

vector<uint32_t> rev;

template<int type>
struct Jump {
    int n1, n2;
    vector<int> jump;
    Jump(int n1, int n2) : n1(n1), n2(n2), jump(1<<(n1+n2), 1<<30) {}
    void insert(uint32_t msk, int val) {
        if(!type) msk = rev[msk];
        uint32_t A, B;
        A = msk & ((1<<n1) - 1);
        B = msk - A;
        swap(A, B);
        
        int iter, minBit = 0;
        iter = 1<<(n2 - __builtin_popcount(A));
        minBit = 1<<n1;
        
        uint32_t Asub = A;
        while(iter--) {
            // ins++;
            jump[Asub | B] = val;
            // std::cout << (Asub|B) << " = " << val << endl;
            Asub = (Asub + minBit) | A;
        }
    }
    int get(uint32_t msk) {
        if(!type) msk = rev[msk];
        uint32_t A, B;
        A = msk & ((1<<n1) - 1);
        B = msk - A;
        swap(A, B);
        
        uint32_t Bsub = B;
        int best = 1<<30;
        do {
            // qry++;
            best = min(best, jump[A | Bsub]);
            Bsub = (Bsub - 1) & B;
            // std::cout << (Bsub|A) << " < " << jump[Bsub|A] << endl;
        } while(Bsub != B);
        return best;
    }
};

vector<long long> solve(vector<uint32_t> a, int b) {
    int M = 1<<b;
    
    rev.resize(M);
    for(int i = 0; i < M; i++) {
        for(int j = 0; j < b; j++) {
            rev[i] |= ((i >> j) & 1)<<(b-1-j);
        }
        // cout << i << " " << rev[i] << endl;
    }
    
    
    const int L = b * 0.5;
    Jump<0> Jlow(b - L, L);
    Jump<1> Jhigh(L, b - L);
    
    int low = (1<<L) - 1;
    int high = M - 1 - low;
    
    int n = a.size();
    vector<long long> answers(n);
    vector<int> next(M, n);
    long long zero_sum = 0;
    for(int i = n; i--;) {
        if(a[i]) {
            // next[a[i]] = i;
            Jlow.insert(a[i], i);
            Jhigh.insert(a[i], i);
        } else {
            zero_sum += 1+i;
        }
        
        for(int banned = 0; banned < b; banned++) {
            uint32_t z = 1u<<banned;
            long long cur_ans = 0;
            while(true) {
                uint32_t free_bits = M - 1 - z;
                // int j = Jlow.get(free_bits); 
                int j;
                if(__builtin_popcount(free_bits & low) >=
                    __builtin_popcount(free_bits & high))
                    j = Jlow.get(free_bits);//b - L higher bits used
                else
                    j = Jhigh.get(free_bits);//L lower bits used
                // cout << i << " " << j << " " << z << " " << free_bits << endl;
                if(j >= n) break;
                cur_ans += 1 + j;
                z |= a[j];
            }
            answers[i] += cur_ans + zero_sum;
        }
    }
    cerr << "Ins: " << ins << "; Qry: " << qry << endl;
    return answers;
}

int main() {
    cin.tie(0)->sync_with_stdio(0);
    int n, b;
    cin >> n >> b;
    vector<uint32_t> a(n);
    for(auto &i : a) cin >> i;
    auto res = solve(a, b);
    for(auto i : res) cout << i << " "; cout << endl;
}

详细

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 37ms
memory: 19848kb

input:

2000 20
251931 620255 725521 330111 783060 690627 489092 1019106 84341 631993 231500 920886 604265 342966 152434 588032 469990 805072 809795 12697 699326 433747 754394 567737 603087 199524 539078 775214 872735 454953 106496 93877 933762 36223 211878 168057 53977 782675 171782 455544 869778 47128 955...

output:

10212 4259 4815 9101 17193 17617 22629 16642 10432 10731 11766 20234 27120 17990 24654 22106 18877 14050 9217 10109 4283 9341 11741 13465 13724 9572 11200 4046 7660 7001 6512 12634 13360 10494 19745 15300 12727 17726 14188 10472 12754 7995 10571 11290 14862 19370 16785 13328 13589 17425 23190 17082 ...

result:

ok single line: '10212 4259 4815 9101 17193 176... 39925 39961 39974 43987 18000 '

Test #2:

score: 0
Accepted
time: 67ms
memory: 19408kb

input:

2000 20
2080 32772 278528 256 2560 1056 528384 2056 132 144 768 98304 36864 262152 262400 81920 264192 16448 294912 786432 8194 16388 9 520 49152 2 262272 20 131584 528384 514 4352 12288 36 32800 72 16392 32 129 8 1028 131080 12288 8193 8320 528 1026 24576 8192 10240 163840 524288 262400 278528 2785...

output:

10532 10275 11389 7400 12269 14740 10975 9199 12307 10890 12090 11861 12707 12449 12586 12195 12260 14273 18795 18089 19280 21369 14169 17819 13755 16253 14945 14538 24799 24439 23275 17968 19797 19977 21225 18864 16595 21665 22140 32768 31494 29782 27849 20911 26304 21480 25191 22840 30738 26969 22...

result:

ok single line: '10532 10275 11389 7400 12269 1...11837 109909 73963 71982 36000 '

Test #3:

score: 0
Accepted
time: 49ms
memory: 19388kb

input:

2000 20
81937 164096 131652 98564 263184 69665 2596 557184 286848 22544 49416 196872 65816 2179 45056 135232 352 1120 8832 32801 131776 98328 528385 51456 266400 396288 65573 328200 528512 26 65700 2248 8328 322 557312 16516 34050 66624 721152 45060 524353 2448 65984 16899 20993 137 265248 33808 665...

output:

10265 12832 12649 13394 14831 13921 19818 8209 7716 12652 12292 11823 12491 12133 17047 7964 8283 15911 12563 12580 12125 10806 12966 12370 19648 11631 12192 16886 17717 20174 20336 25578 15349 16556 21621 20009 14907 18092 15498 24250 21725 21223 14614 15274 10702 16692 16601 15963 14431 23066 1801...

result:

ok single line: '10265 12832 12649 13394 14831 ... 75882 73929 95952 63984 32000 '

Subtask #2:

score: 10
Accepted

Test #4:

score: 10
Accepted
time: 3939ms
memory: 21160kb

input:

100000 20
262144 16 65536 8 256 1024 32 262144 16 262144 256 1024 1 64 2 131072 4096 2048 2 32 8192 4 2 262144 32768 1 524288 262144 262144 2048 8 64 1 2 8192 131072 256 64 8192 1 262144 4 32 4 524288 1 32768 16 64 128 8192 16 32 4096 16384 16384 4 131072 32768 16384 131072 2 16 2048 32768 16 4 4096...

output:

7752 7885 8018 9329 9842 9956 10070 10317 10355 11096 11362 11856 12958 13205 13547 13623 14003 14706 14934 15010 15447 15713 16093 16302 16378 16796 16929 17271 17290 17518 18164 19114 19228 19361 19893 19969 20387 21147 21356 21584 21698 23332 23370 23560 23807 24510 25688 25916 25992 26486 27322 ...

result:

ok single line: '7752 7885 8018 9329 9842 9956 ...599886 5699943 3799981 1900000 '

Test #5:

score: 0
Accepted
time: 3035ms
memory: 21016kb

input:

100000 20
1 8 8 8 8 8 4 8 4 8 2 1 2 1 2 1 4 8 4 2 8 2 1 2 8 4 4 2 1 2 1 4 4 4 2 4 1 8 4 8 1 1 4 2 4 4 8 4 1 8 2 1 2 8 4 8 8 4 2 4 1 2 1 4 4 4 4 1 1 4 8 4 2 2 1 4 8 2 2 4 2 8 8 4 2 1 4 4 8 1 4 4 4 4 8 8 4 8 1 2 1 2 1 1 4 2 8 2 2 2 2 8 2 2 2 4 8 2 8 1 8 4 2 1 1 1 4 8 4 4 8 4 8 2 4 4 4 1 2 4 4 16 1 2 1...

output:

17159147 17159356 17159375 17159394 17159413 17159432 17159470 17159508 17159546 17159698 17159850 17159888 17159926 17159964 17160002 17160097 17160230 17160268 17160325 17160458 17160496 17160572 17160610 17160724 17160800 17161047 17161066 17161161 17161199 17161237 17161332 17161446 17161465 171...

result:

ok single line: '17159147 17159356 17159375 171...899943 1899962 1899981 1900000 '

Subtask #3:

score: 15
Accepted

Test #6:

score: 15
Accepted
time: 38ms
memory: 4676kb

input:

100000 8
98 78 5 190 79 234 162 79 118 176 115 130 10 9 233 56 97 15 148 13 46 87 92 65 150 62 50 46 159 101 48 86 203 71 29 124 23 228 55 161 240 80 139 74 251 143 167 207 183 52 50 252 17 185 40 145 167 164 227 166 172 60 182 62 173 227 232 243 251 134 109 241 44 33 217 149 51 6 110 201 242 196 23...

output:

152631657 152630131 152630001 152630939 152631411 152631998 152630663 152631609 152631606 152630657 152631172 152632208 152631468 152631040 152631058 152630747 152631208 152630998 152631307 152631149 152631038 152631013 152631782 152631146 152631829 152632118 152632297 152632294 152631891 152632567 ...

result:

ok single line: '152631657 152630131 152630001 ... 1199980 1199981 699995 500000 '

Test #7:

score: 0
Accepted
time: 45ms
memory: 4708kb

input:

100000 8
132 32 160 18 136 6 72 24 129 32 5 96 128 33 144 12 3 68 24 132 144 128 80 12 40 36 130 132 3 5 144 136 33 65 3 18 24 68 2 4 17 5 129 17 80 24 80 66 96 3 80 132 40 24 33 4 16 32 16 160 136 65 68 36 17 33 48 130 129 132 72 144 136 80 32 4 72 130 12 2 68 80 3 16 144 72 18 66 160 72 5 12 96 33...

output:

5952637 5952720 5953709 5952776 5952715 5952598 5952795 5953843 5953869 5954350 5953227 5952731 5953557 5953953 5953969 5953654 5952917 5952989 5954434 5954010 5954470 5953077 5954247 5953906 5953896 5954919 5954403 5954223 5953545 5953497 5953678 5953920 5954491 5954953 5954882 5954021 5954016 5954...

result:

ok single line: '5952637 5952720 5953709 595277... 1299969 799987 1199994 600000 '

Test #8:

score: 0
Accepted
time: 37ms
memory: 4848kb

input:

100000 8
141 194 198 43 134 49 74 204 148 34 240 131 116 50 147 146 20 76 161 60 99 38 3 38 98 24 164 98 240 149 99 163 27 82 108 184 37 26 102 152 25 3 77 78 73 141 53 137 78 130 226 81 212 226 162 149 41 177 112 29 7 197 216 13 74 154 161 28 50 99 113 216 14 57 134 131 135 51 6 69 141 73 116 194 7...

output:

4055305 4050887 4052706 4047838 4067390 4067423 4056658 4059069 4044709 4044152 4050128 4050231 4087336 4087869 4062113 4069179 4054377 4053586 4047213 4080771 4060526 4077103 4045902 4077653 4042666 4050004 4061909 4050714 4046983 4048224 4041638 4049613 4093973 4080069 4071289 4050701 4067381 4049...

result:

ok single line: '4055305 4050887 4052706 404783...74 799983 799989 699995 400000 '

Test #9:

score: 0
Accepted
time: 31ms
memory: 4648kb

input:

100000 8
124 54 93 174 195 135 125 181 30 79 220 243 226 188 57 193 148 73 234 185 187 119 205 143 234 191 151 222 135 198 153 113 180 75 79 62 204 175 150 204 248 59 165 232 124 207 171 15 105 211 241 47 235 181 99 46 109 38 187 222 27 218 149 158 106 196 143 146 59 118 151 185 246 22 215 51 209 11...

output:

8334577 8411953 8475901 8619180 8653164 8489145 8500880 8394518 8477544 8448102 8432858 8562386 8402286 8379389 8400932 8370201 8397679 8371556 8408604 8457393 8490636 8418500 8324620 8331736 8301641 8278722 8296598 8312416 8381676 8311669 8389405 8526662 8512198 8463133 8270940 8316768 8345109 8249...

result:

ok single line: '8334577 8411953 8475901 861918...77 799983 699990 699996 500000 '

Test #10:

score: 0
Accepted
time: 29ms
memory: 4688kb

input:

100000 8
9 2 3 8 5 69 5 3 67 9 11 5 6 10 5 6 5 4 5 21 6 10 6 10 9 137 2 8 3 67 1 5 9 5 8 9 6 2 6 5 10 12 6 8 9 6 10 3 10 6 9 5 6 3 1 9 4 2 3 9 1 9 4 9 10 6 1 9 3 6 10 6 8 2 9 6 5 9 5 1 5 8 4 9 6 4 5 6 9 8 12 8 4 2 8 5 4 9 10 4 2 6 5 2 5 1 4 132 3 9 6 70 5 9 8 5 3 11 10 9 3 6 9 10 18 10 3 5 4 8 3 8 9...

output:

210888808 210888792 210888825 210888885 210888889 210695006 210888901 210889018 210695102 210888908 210888918 210888940 210888996 210888949 210889001 210889024 210889009 210889167 210889030 210884920 210889091 210889379 210889105 210889452 210889468 210609577 210889672 210889451 210889500 210695597 ...

result:

ok single line: '210888808 210888792 210888825 ...76 599983 599988 599995 400000 '

Test #11:

score: 0
Accepted
time: 31ms
memory: 4632kb

input:

100000 8
6 132 129 5 4 5 128 1 129 5 2 128 5 2 129 5 132 1 129 1 5 13 6 132 5 6 129 5 2 4 132 5 6 1 4 2 6 132 5 132 128 129 132 5 132 6 10 128 129 128 132 128 4 6 130 6 132 129 4 5 4 5 6 129 6 8 6 1 4 132 129 137 6 1 5 129 161 128 129 145 5 4 6 5 1 128 5 6 5 1 5 6 132 2 6 130 128 130 129 5 2 128 2 1...

output:

102876418 102876497 102876497 102876524 102876578 102876561 102876753 102876788 102876694 102876630 102876648 102876669 102876774 102876732 102876693 102876941 102876827 102876924 102876733 102876938 102876957 102876591 102876796 102876930 102876984 102876813 102876975 102877083 102877299 102877348 ...

result:

ok single line: '102876418 102876497 102876497 ...75 699982 699987 699994 600000 '

Test #12:

score: 0
Accepted
time: 34ms
memory: 4648kb

input:

100000 8
128 130 64 68 64 128 136 64 128 192 128 64 192 128 160 128 160 128 160 128 64 0 0 0 0 64 128 64 128 160 0 128 64 128 160 128 136 128 64 72 128 64 192 128 64 66 64 128 64 96 64 192 64 128 132 128 136 128 64 128 192 128 130 0 64 128 192 64 96 0 0 128 160 128 64 128 64 66 64 65 0 144 64 128 13...

output:

4529471788 4529097423 4529471823 4529172203 4529471837 4529471858 4529246891 4529471879 4529471907 4529471843 4529471921 4529471942 4529471873 4529472005 4529470225 4529472019 4529470239 4529472033 4529470253 4529472047 4529472096 4529472131 4529471955 4529471771 4529471579 4529471379 4529471393 452...

result:

ok single line: '4529471788 4529097423 45294718...1499980 1499986 1399994 800000 '

Subtask #4:

score: 15
Accepted

Dependency #3:

100%
Accepted

Test #13:

score: 15
Accepted
time: 90ms
memory: 4712kb

input:

100000 12
1699 3853 2080 3113 1621 1093 1489 3535 3677 2642 910 3652 1475 2806 1692 766 1965 1550 2260 2540 1510 1476 2726 480 2923 3526 3269 3492 3137 3775 3045 2721 97 3067 1196 3539 3870 3216 2142 2031 1966 3108 3002 2564 3903 1602 178 2907 1123 3860 889 3607 1474 1719 3621 3869 1211 626 242 1673...

output:

16382341 16361818 16367923 16348883 16344610 16333084 16342996 16335969 16337411 16326940 16328076 16341795 16339977 16338632 16340764 16331520 16336347 16338440 16342590 16355874 16359684 16363133 16392553 16350018 16347637 16337586 16344148 16348104 16333350 16346050 16339229 16338909 16353593 163...

result:

ok single line: '16382341 16361818 16367923 163...1499973 1799975 1099989 400000 '

Test #14:

score: 0
Accepted
time: 133ms
memory: 4676kb

input:

100000 12
2049 130 516 2560 2 40 2049 132 1280 576 33 1536 2 288 2560 2056 2064 192 3 96 65 33 2176 2052 68 260 129 2049 513 640 2304 40 2064 72 520 128 2052 80 160 260 640 68 160 4 20 384 36 2112 2064 1040 2052 6 258 129 2064 34 1028 132 6 1026 132 24 2049 5 2056 1032 132 3072 257 160 258 1152 96 3...

output:

3110 3178 1395 1397 1542 1630 1898 1739 2622 3471 2144 2904 4424 3508 4815 4839 4581 5483 5491 5242 4685 5315 5350 4987 4503 4830 4697 4657 4235 5119 5152 4680 5381 5268 6636 5042 5574 5406 5609 5764 6490 5498 5007 4780 6103 5691 6779 7774 7296 7086 6457 7188 6990 8593 7797 7755 7436 7305 7740 7335 ...

result:

ok single line: '3110 3178 1395 1397 1542 1630 ...999940 2999970 1999990 1000000 '

Test #15:

score: 0
Accepted
time: 95ms
memory: 4696kb

input:

100000 12
528 2196 1286 840 1097 14 2070 139 208 3584 424 3120 261 2368 288 3076 2241 3840 140 1300 2752 401 268 41 600 194 2592 2212 1576 2309 262 3585 2057 1282 208 660 1065 2568 649 2055 2432 1664 330 676 593 1416 75 3076 77 392 2081 2072 3264 1061 261 1028 3216 152 2309 1105 1289 2089 1037 2200 ...

output:

66249 75050 110721 61035 54040 111677 58954 116979 49170 58688 125786 150725 90737 21917 86382 98728 81829 108359 110586 78603 47797 20835 36789 50587 79205 139612 100946 144124 102704 116408 115307 99200 79850 87656 103778 55543 122810 57512 98374 114999 93791 105126 90827 54006 89190 160559 141509...

result:

ok single line: '66249 75050 110721 61035 54040... 1099971 1099981 999992 800000 '

Test #16:

score: 0
Accepted
time: 79ms
memory: 4712kb

input:

100000 12
2131 2156 2732 1813 2171 740 3844 92 372 3652 2666 2755 1462 2257 679 538 286 3221 2156 1733 2250 3214 284 866 860 1549 1139 570 1035 3107 498 2736 2656 2595 1254 2281 1348 3219 701 1009 1802 344 315 1358 1925 684 2150 845 1537 1043 2862 1197 3848 2461 3459 139 345 2281 972 159 2830 542 66...

output:

537144 356701 335532 445369 472146 655423 761096 811341 560192 495239 376861 327762 406683 509443 214676 370502 289867 328810 385286 205681 158608 180987 288410 472282 779702 780970 883890 505115 620968 544578 735782 772613 605386 432150 155021 155812 249465 534080 248805 442566 444144 449809 553900...

result:

ok single line: '537144 356701 335532 445369 47...63 999975 999984 799994 500000 '

Test #17:

score: 0
Accepted
time: 120ms
memory: 4732kb

input:

100000 12
4 17 1 33 6 70 33 1 9 17 24 32 288 9 17 18 20 33 35 33 32 3 33 34 16 24 17 6 34 9 16 20 24 20 6 12 14 18 5 12 9 17 5 34 17 2 6 3 18 10 3 17 33 18 10 18 3 5 1 10 2 18 24 33 6 9 4 18 24 17 24 17 6 9 6 2054 10 3 9 5 1 20 9 10 12 16 33 20 8 18 17 32 24 1 2 12 24 2072 33 9 8 12 24 10 5 9 10 12 ...

output:

119303222 119302748 119302201 119302096 119302126 119297829 119302386 119302516 119302590 119302980 119302688 119302658 118960827 119302757 119303214 119302738 119303488 119303318 119302755 119303338 119303033 119303535 119303290 119303195 119303570 119303118 119304046 119303636 119303318 119303721 ...

result:

ok single line: '119303222 119302748 119302201 ...68 999977 899986 799994 700000 '

Test #18:

score: 0
Accepted
time: 111ms
memory: 4800kb

input:

100000 12
6 20 36 6 48 18 20 36 34 6 34 20 1056 1040 1041 34 1026 1040 32 4 48 2096 6 4 2 1040 4 18 2 34 1040 16 1024 8 20 4 1028 4 18 2066 32 1040 1024 32 1028 48 1026 8 20 1026 6 1026 10 20 52 18 1056 34 1056 18 34 2 18 1040 10 20 34 1056 1024 6 48 36 34 2 4 6 1056 1040 34 18 6 1040 1056 18 2 16 1...

output:

26293120 26293170 26293155 26293193 26293290 26293241 26293226 26293263 26293308 26293318 26293333 26293335 26293725 26293404 25785709 26293450 26293737 26293724 26293804 26293877 26293661 26230890 26293830 26294090 26294123 26294134 26294193 26294292 26294316 26293949 26294679 26295019 26294634 262...

result:

ok single line: '26293120 26293170 26293155 262...57 999970 999981 599995 400000 '

Test #19:

score: 0
Accepted
time: 116ms
memory: 4716kb

input:

100000 12
0 2048 3072 512 1024 2048 2112 2048 2049 512 1024 2048 1024 1536 1024 1040 2048 2049 1024 512 1024 2048 2052 1024 1088 1024 512 2048 1024 1028 2048 2049 2048 2056 2048 2050 2048 1024 1040 1024 512 1024 2048 512 1024 1280 2048 1024 512 1536 1024 512 1024 0 2064 1024 512 2048 2112 2048 2560 ...

output:

6397044299 6397044287 6397044251 6397044331 6397044397 6397044463 6396709155 6397044485 6396211009 6397044529 6397044639 6397044661 6397044716 6397044528 6397044738 6396543722 6397044782 6396211307 6397044837 6397044859 6397044936 6397044969 6396378845 6397045035 6396709727 6397045057 6397045090 639...

result:

ok single line: '6397044299 6397044287 63970442...099967 1099979 1099989 1000000 '

Subtask #5:

score: 25
Accepted

Dependency #4:

100%
Accepted

Test #20:

score: 25
Accepted
time: 267ms
memory: 5852kb

input:

100000 16
18724 50677 1778 2841 46161 43713 3250 44364 5099 23594 62281 22305 24702 28878 60573 51314 39670 13956 63050 63230 28565 59512 25472 65351 32084 51075 37786 45554 41916 1224 57275 14953 37351 9084 31151 53493 44108 15503 31970 709 20975 61963 1715 56175 48523 61604 14652 20404 45442 28758...

output:

2019917 1864874 2046814 1919231 1660308 1389947 1445657 1463119 1615657 1733606 2195811 1715961 1330003 1453621 1667302 1963301 1998857 2017877 1920579 1711134 1836781 1794888 1979832 1967159 2526163 1674140 1574906 1897886 1795667 1458664 1792150 1720741 1801593 1791075 1850388 1609827 1479040 1536...

result:

ok single line: '2019917 1864874 2046814 191923...1499973 1499980 1399990 800000 '

Test #21:

score: 0
Accepted
time: 512ms
memory: 5688kb

input:

100000 16
24576 129 130 2112 8193 320 34 260 320 4128 16385 5 16 80 1028 4097 96 4 72 33280 10 4098 258 272 72 260 2064 16640 24 16512 17408 8208 1040 8193 16385 40960 6144 8256 256 4100 520 129 8704 16640 513 32776 136 4100 2176 4098 4104 4097 16416 768 24576 4104 4128 1 32768 514 2176 8200 16640 4...

output:

4166 4504 3707 4121 3736 6123 9497 6878 6215 5582 5711 9785 6656 7523 7225 7855 6907 5890 6652 10255 12316 8172 7829 7979 7509 9910 8984 11922 11771 9273 8754 9239 9633 13217 12783 13322 13393 12017 10815 10111 10223 11681 12791 9895 11115 11109 11523 13817 18179 18347 12661 14101 12716 14341 14426 ...

result:

ok single line: '4166 4504 3707 4121 3736 6123 ...299929 4199958 2799986 1400000 '

Test #22:

score: 0
Accepted
time: 349ms
memory: 5740kb

input:

100000 16
8392 320 18437 84 2088 15 1297 1057 16577 1172 4169 16422 20610 8352 326 34821 2310 804 3585 41 17424 16545 32780 140 6672 533 35844 269 3208 32820 4146 32803 610 354 2313 16436 18498 37008 536 3088 16448 1050 24586 4200 25 832 50178 6784 34817 1128 1029 33088 144 33282 5664 10256 34819 32...

output:

410095 186559 154790 210881 332452 118593 183423 274484 245787 331328 296256 415334 273882 114883 146972 220534 142402 315625 444029 183296 168885 279237 185982 90480 139470 308433 326494 198859 169800 175605 141024 373918 193177 199643 200061 185328 396769 319421 283952 486313 330384 503769 383470 ...

result:

ok single line: '410095 186559 154790 210881 33...699956 2599961 1499987 1200000 '

Test #23:

score: 0
Accepted
time: 264ms
memory: 5716kb

input:

100000 16
10761 32955 485 14466 585 48896 47146 63744 1984 19016 4742 34085 50732 18725 41812 24593 35089 1051 21769 25731 58373 5057 3500 2332 1073 41729 4156 57476 35863 9388 9865 2390 49537 43968 9749 18312 6624 55488 23312 9398 49808 17689 22872 904 46616 18665 6158 28417 46616 3621 8793 3592 23...

output:

543215 494761 415550 373237 426235 484550 485561 474806 451665 363585 353443 528509 518218 413485 388560 318487 296863 352930 438557 371119 497423 442286 456578 406156 380433 379576 471284 405891 625312 596787 519260 608753 502788 539922 457421 448181 499528 420777 341751 429464 334653 420730 504905...

result:

ok single line: '543215 494761 415550 373237 42...599960 1599977 1299990 1000000 '

Test #24:

score: 0
Accepted
time: 507ms
memory: 5856kb

input:

100000 16
128 40 18 40 12 8 136 18 24 12 96 80 40 5 3 24 36 68 18 6 17 33 1057 129 4 6 36 32804 5 48 9 128 20 24 4120 33 9 72 33 8 36 64 65 24 2 32 96 72 12 65 18 34 68 2 18 33 128 40 72 65 80 33 17 96 5 64 17 68 5 18 6 34 8 66 17 10 8 34 72 10 16394 66 6 20 128 12 96 12 10 9 24 8 68 3 66 36 65 20 4...

output:

57800638 57800849 57800877 57800947 57800513 57800835 57800637 57800609 57801142 57801673 57801233 57801286 57801627 57802344 57801490 57801768 57801183 57801595 57801659 57801926 57802626 57802577 57390517 57802109 57802828 57802299 57803559 56808252 57802351 57803500 57803005 57802497 57802872 578...

result:

ok single line: '57800638 57800849 57800877 578... 1399971 1099985 899993 600000 '

Test #25:

score: 0
Accepted
time: 490ms
memory: 5736kb

input:

100000 16
4112 4096 8208 8192 2 2064 192 8320 2064 48 130 2048 8320 8256 8194 8224 192 4128 8320 8192 8193 2048 96 160 2064 8320 4096 8194 4160 96 34 4128 192 8320 34 8192 4096 192 4160 4224 4112 8224 8192 192 32960 48 192 96 130 96 4096 2048 4098 96 48 4224 8224 12288 4112 34 8256 4112 8208 8216 20...

output:

32758221 32758216 32744961 32744916 32757224 32757412 32757454 32733547 32732853 32733087 32733765 32746991 32747141 32759186 32746345 32759788 32759708 32747239 32759869 32759697 31836915 32759885 32759005 32623642 32759108 32760438 32760532 32760068 32759756 32760836 32747958 32760831 32747997 326...

result:

ok single line: '32758221 32758216 32744961 327... 1099973 1099985 799995 400000 '

Test #26:

score: 0
Accepted
time: 439ms
memory: 5708kb

input:

100000 16
24576 33280 16384 8704 9216 4096 34816 2560 36864 5120 12288 2048 256 33792 6144 24576 1536 3584 24576 34816 5120 5121 1536 2560 32768 33024 18432 5120 24576 4096 12288 4096 33024 18432 34816 6144 3072 49152 36864 512 24576 40960 17408 10240 3072 33280 2560 9216 20480 24576 33792 4608 1740...

output:

6697596 6695132 6697180 6695393 6695791 6695497 6695369 6697007 6695436 6695894 6696125 6695989 6695583 6696453 6696540 6696564 6696606 6696584 6696669 6696809 6696867 5554070 6697787 6697097 6698061 6697006 6697104 6697306 6697362 6697550 6698681 6697580 6698010 6698325 6698495 6698341 6698293 6698...

result:

ok single line: '6697596 6695132 6697180 669539...5 1199976 999989 999994 700000 '

Subtask #6:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #27:

score: 25
Accepted
time: 1089ms
memory: 21164kb

input:

100000 20
458791 686009 334700 991630 882697 511971 1021476 1230 248202 754472 493410 704358 42805 194085 59329 178820 131785 853216 191866 487114 495209 542449 287321 389380 320294 363192 125388 943709 370599 949897 72711 544206 889278 891068 984299 73565 465393 839732 177444 470482 636038 775002 9...

output:

1324129 1737909 1373908 992320 1042264 964143 1134499 1080615 1372491 1273844 1481452 1350885 1322732 1602959 1627523 1409877 1347610 1533543 1326350 1228257 1024881 1265987 1013275 935027 1074066 923769 941377 994300 1023308 1143401 1281312 1300927 1271283 1243225 1193992 1148464 1473645 1700245 15...

result:

ok single line: '1324129 1737909 1373908 992320...999960 1899978 1799987 1400000 '

Test #28:

score: 0
Accepted
time: 2532ms
memory: 20992kb

input:

100000 20
96 130 160 147456 262208 67584 40 65600 72 524289 130 1032 65792 65 528384 4096 262400 32896 393216 9216 4224 131328 34 262208 163840 16400 524320 131080 2112 2064 16388 1280 66048 327680 4100 65537 32896 262400 262148 32 524800 163840 9 196608 1025 12288 65552 24 524416 49152 135168 17408...

output:

17809 17025 19187 17556 14957 13877 14315 33765 15695 24980 36999 23782 15908 11588 10319 15611 15066 18865 14163 17542 48393 33941 38961 18868 15827 12517 16635 18722 13701 15960 18271 16593 20571 26075 25403 16990 16678 22781 16624 24970 24259 23171 21146 22160 23845 27592 36176 46619 34626 20914 ...

result:

ok single line: '17809 17025 19187 17556 14957 ...499892 5399946 3599982 1800000 '

Test #29:

score: 0
Accepted
time: 1743ms
memory: 21040kb

input:

100000 20
279056 16460 917512 6404 8520 8225 33048 533632 66184 529409 147600 264832 5188 397328 26752 41216 786576 524338 295008 299520 77 30720 655370 139528 90240 525120 9984 10305 517 557316 262148 8392 328720 541184 2817 98464 5249 18946 459008 33540 657410 524417 544896 266496 272448 524577 47...

output:

136641 195962 154712 337026 330028 239344 236299 284417 659985 315564 417207 183464 287016 65800 448185 359485 234953 103139 106010 348593 323397 545321 122837 285653 311560 378457 228685 240577 266458 526279 107792 251363 303886 339669 170841 217405 515513 500155 545929 475300 468576 568354 564581 ...

result:

ok single line: '136641 195962 154712 337026 33...899915 4999950 3299984 1700000 '

Test #30:

score: 0
Accepted
time: 1286ms
memory: 21052kb

input:

100000 20
229420 2333 201284 491524 655782 284936 532515 29833 820264 676160 33805 577580 531072 200880 49809 133902 82963 624898 933928 354688 336688 109089 160769 426250 856100 557170 54804 332564 197665 262345 169512 563234 549953 792714 99076 435208 270419 395533 61505 534722 108866 241698 27880...

output:

95564 181454 234808 357011 339131 264900 54892 75037 491417 360723 231768 159605 344311 249380 200119 352490 222936 222353 273024 120841 118936 194733 120577 237392 221554 188294 324387 146867 133634 233947 188087 345069 390160 366559 477634 239353 211082 162027 148567 302846 123604 181529 292286 24...

result:

ok single line: '95564 181454 234808 357011 339...199936 2899956 1799986 1400000 '

Test #31:

score: 0
Accepted
time: 2375ms
memory: 21168kb

input:

100000 20
260 516 136 2184 288 96 260 40 144 264 96 132 18 132 12 10 48 144 72 272 10 8 80 5 10 72 34 10 40 36 258 136 257 66 9 24 192 130 260 80 160 132 68 48 192 33 66 40 130 2 96 18 20 96 64 24 192 65 33 66 288 257 66 17 16 320 272 132 10 264 256 264 24 18 272 18 80 34 48 132 48 258 5 12 17 18 12...

output:

44976615 44636603 44994900 44565805 44997509 44997334 44997500 44995352 44995234 44996723 44994899 44995457 44995493 44995882 44997680 44995802 44996103 44995522 44995993 44995879 44996206 44997245 44996331 44996538 44996279 44996364 44997808 44996256 44997905 44997767 44998980 44999017 44998817 449...

result:

ok single line: '44976615 44636603 44994900 445... 1499967 1199982 799994 500000 '

Test #32:

score: 0
Accepted
time: 2397ms
memory: 21020kb

input:

100000 20
327680 1028 6 36 258 65540 258 327680 66560 264192 1024 133120 1280 6 262400 6 4 2052 34 264192 67584 196608 1026 2052 67584 262176 133120 1056 288 65538 263168 258 1026 65538 288 34 262148 256 262176 2080 1280 132096 131072 139264 1056 67584 1028 67584 2 2080 131074 262146 262147 258 34 1...

output:

14615558 14615684 14611322 14610592 14617191 14617227 14617341 14611161 14611911 14611809 14612596 14611957 14616857 14611741 14611777 14611742 14612325 14612093 14612340 14613052 14613269 14612064 14613747 14612359 14612987 14612722 14612565 14614544 14613211 14613320 14614895 14613725 14613318 146...

result:

ok single line: '14615558 14615684 14611322 146... 1199973 1099984 899995 600000 '

Test #33:

score: 0
Accepted
time: 2823ms
memory: 21008kb

input:

100000 20
65536 262144 524288 528384 262144 524288 526336 262144 131072 262144 65536 524288 131072 65536 262144 524288 262144 524288 524544 524288 65536 81920 524288 65536 524288 65536 262144 65536 73728 65536 262144 65536 131072 65536 524288 262144 524288 262144 131072 524288 532480 262144 262176 6...

output:

28198167 28198357 28198414 27570505 28198471 28198528 27480604 28198642 28198680 28198756 28198851 28198908 28198984 28199364 28199497 28199535 28199573 28199763 27209999 28199801 28199858 27752777 28199915 28199953 28199991 28200181 28200219 28200295 27662493 28200333 28200371 28200466 28200504 282...

result:

ok single line: '28198167 28198357 28198414 275...70 899981 799988 399996 200000 '

Test #34:

score: 0
Accepted
time: 2746ms
memory: 21168kb

input:

100000 20
8 131080 1 8 4 1028 2 1 4 2 1 8 520 2 8 4 524292 2 8 1 2 4 1 4 5 2 1 2 4 8 2 4 8 262152 4 1 2 8 2 4 516 8 65544 4 12 2 8 1 2 8 2 4 1 2 1 2 65538 1 4 1 8 520 1 2 8 4 1 8 1 16385 2 1 2 8 1 4 1 8 2 1 2 66 1 524289 8 524296 4 1 2 4 132 8 262152 1 4 1 257 2 524290 8 4 2 8 2 4 8 1032 4 5 2 8 264...

output:

240072724 238627309 240072781 240072876 240073028 239258784 240073104 240073161 240073218 240073351 240073427 240073598 239348723 240073655 240073731 240073807 238449997 240073921 240073978 240074187 240074244 240074339 240074377 240074453 240073990 240074548 240074586 240074757 240074814 240074871 ...

result:

ok single line: '240072724 238627309 240072781 ...73 999980 699990 499996 300000 '

Test #35:

score: 0
Accepted
time: 3231ms
memory: 21092kb

input:

100000 20
256 1 65536 256 65792 65536 1024 256 65536 1024 256 1024 65536 131072 1 256 1 65536 1 65536 1 65536 256 65536 256 131328 65536 1024 256 1 256 258 1024 65536 256 65536 131072 65536 1024 256 257 1 256 384 256 1 256 1 256 1024 256 65536 256 1024 1 256 1024 256 1 256 65536 256 1 32769 65536 58...

output:

129246256 129246313 129246560 129246617 129246531 129246693 129246750 129246807 129246864 129246940 129246978 129247073 129247377 129247472 129247909 129247947 129248080 129248118 129248156 129248194 129248232 129248403 129248441 129248479 129248536 129247892 129248612 129248745 129248840 129248878 ...

result:

ok single line: '129246256 129246313 129246560 ...3 1099981 899991 699997 400000 '

Test #36:

score: 0
Accepted
time: 2399ms
memory: 21044kb

input:

100000 20
1 2 1 2 1 2 3 2 3 2 1 2 1 2 1 2 3 2 1 2 1 2 3 1 2 1 2 1 2 1 2 3 1 2 1 2 1 2 1 2 3 2 3 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 3 2 3 2 1 2 3 2 3 1 2 3 2 3 2 3 2 1 2 3 2 1 2 1 2 3 2 1 2 1 2 1 2 1 2 1 2 1 2 3 1 2 3 1 2 1 2 3 1 2 3 2 1 2 3 2 3 2 1 2 3 1 2 3 2 1 2 3 1 2 1 2 1 2 1 2 3 2 3 2 1 2 1 2 3 1 ...

output:

8363838 8363876 8363914 8363952 8363990 8364104 8363926 8364142 8363964 8364180 8364218 8364256 8364294 8364332 8364370 8364446 8364124 8364484 8364522 8364560 8364598 8364655 8364244 8364712 8364750 8364788 8364826 8364864 8364902 8364940 8364997 8364424 8365054 8365092 8365130 8365168 8365206 8365...

result:

ok single line: '8363838 8363876 8363914 836395...9924 1899944 1899962 1799982 0 '

Test #37:

score: 0
Accepted
time: 2584ms
memory: 21088kb

input:

100000 20
1024 2048 2049 2048 1024 1025 2048 2049 1024 2048 1024 2048 2049 2048 1024 2048 2049 2048 2049 2048 1024 1025 1024 2048 2049 1024 1025 2048 1024 1025 1024 2048 1024 2048 2049 1024 2048 1024 2048 1024 2048 2049 1024 2048 1024 2048 1024 1025 1024 2048 1024 1025 1024 1025 1024 2048 1024 2048 ...

output:

8350690 8350766 8350786 8350804 8350861 8350883 8350937 8350958 8350994 8351032 8351070 8351146 8351166 8351184 8351222 8351336 8351356 8351374 8351394 8351412 8351488 8351508 8351526 8351583 8351605 8351659 8351680 8351716 8351792 8351812 8351830 8351868 8351906 8351963 8351984 8352020 8352058 8352...

result:

ok single line: '8350690 8350766 8350786 835080...9925 1899943 1899963 1899981 0 '

Test #38:

score: 0
Accepted
time: 1280ms
memory: 20992kb

input:

100000 20
228352 523264 523265 261120 654336 523264 486400 515072 752640 482304 769024 785408 519168 490496 654336 261120 523264 392192 519168 261120 777216 654336 457728 523264 719872 784384 785408 785409 523264 777216 752640 261120 488448 261120 748544 513024 519168 523264 388096 501760 457728 457...

output:

126 146 158 168 181 205 216 235 249 262 290 330 343 360 389 403 418 429 444 471 485 505 535 548 563 590 615 627 638 651 668 681 694 710 723 759 808 821 832 849 880 893 917 928 948 964 978 991 1004 1023 1062 1091 1110 1142 1153 1179 1200 1219 1236 1249 1260 1293 1304 1319 1354 1375 1394 1411 1429 144...

result:

ok single line: '126 146 158 168 181 205 216 23... 999960 999971 999980 899991 0 '

Test #39:

score: 0
Accepted
time: 2728ms
memory: 21204kb

input:

100000 20
0 0 0 65536 262144 131072 262144 65536 524288 524800 65536 262144 65536 65544 131072 0 66048 131072 524288 526336 262144 65536 524288 131072 262144 65536 0 65536 524288 65536 524288 0 524288 262144 131072 524288 131072 262144 131072 524288 524416 524288 65536 524288 262144 65536 524288 262...

output:

10087572351 10087572331 10087572291 10087572231 10087572307 10087572345 10087572516 10087572611 10087572668 10086761166 10087572858 10087572896 10087573067 10086178166 10086761618 10086761675 10086761355 10087572975 10087573089 10086940609 10087573165 10087573241 10087573317 10087573431 10087573640 ...

result:

ok single line: '10087572351 10087572331 100875...899943 1899963 1899981 1800000 '

Extra Test:

score: 0
Extra Test Passed