QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#874244#9685. nim 游戏cooluo72 1383ms31312kbC++238.1kb2025-01-27 21:19:372025-01-27 21:19:42

Judging History

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

  • [2025-01-27 21:19:42]
  • 评测
  • 测评结果:72
  • 用时:1383ms
  • 内存:31312kb
  • [2025-01-27 21:19:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ul unsigned ll
#define LL __int128_t
#define db double
#define DB long db
#define pii pair<int, int>
#define fi first
#define se second
#define mkpr make_pair
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define rsz resize
#define eb emplace_back
#define all(c) (c).begin(), (c).end()
#define bit(k) (1 << (k))
#define Bit(k) (1ll << (k))
#define BIT(k) ((LL)1 << (k))
#define lowbit(x) ((x) & -(x))
#define bin(s, k) ((s) >> (k) & 1)
#define lg2(x) (31 - __builtin_clz(x))
#define LG2(x) (63 - __builtin_clzll(x))
#define popcnt(x) __builtin_popcount(x)
#define mem(a, x) memset(a, x, sizeof(a))
#define req(i, l, r) for (int i(l), i##End(r); i < i##End; i = -~i)
#define rep(i, l, r) for (int i(l), i##End(r); i <= i##End; i = -~i)
#define per(i, r, l) for (int i(r), i##End(l); i >= i##End; i = ~-i)

#ifdef JYR
#include "debug.h"
#define errs(x) fputs(x "\n", stderr)
#define errm(x, ...) fprintf(stderr, x, ##__VA_ARGS__)
#else
#define dbg(...) 0
#define dbgArr(...) 0
#define errs(x) 0
#define errm(x, ...) 0
#endif

template<typename T, typename U> void chkmx(T &_a, U _b) { if (_a < _b) _a = _b; }
template<typename T, typename U> void chkmn(T &_a, U _b) { if (_b < _a) _a = _b; }

bool Mbe;

struct FastIO {
    char buf[1 << 20], *p1, *p2;
    char puf[1 << 20], *pf;

    FastIO() : p1(buf), p2(buf), pf(puf) {}
    ~FastIO() { fwrite(puf, 1, pf - puf, stdout); }

    char gc() {
        if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin);
        return p1 == p2 ? EOF : *p1++;
    }

    bool blank(char c) { return c == ' ' || c == '\r' || c == '\n' || c == '\t'; }

    char rd() {
        char c = gc(); while (blank(c)) c = gc();
        return c;
    }

    template<typename T> T rd() {
        T x = 0; int f = 0; char c = gc();
        while (!isdigit(c)) f = (c == '-'), c = gc();
        while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
        return f ? -x : x;
    }

    int rds(char *s) {
        char c = gc(), *S = s;
        while (blank(c)) c = gc();
        while (!blank(c) && c != EOF) *s++ = c, c = gc();
        return *s = 0, abs(s - S);
    }

    int rdl(char *s) {
        char c = gc(), *S = s;
        while (c == '\r' || c == '\n') c = gc();
        while (c != '\r' && c != '\n' && c != EOF) *s++ = c, c = gc();
        return *s = 0, abs(s - S);
    }

    void rd(char &c) { c = rd(); }

    void rd(char *s) {
        char c = gc();
        while (blank(c)) c = gc();
        if (c == EOF) { *s = 0; return; }
        while (!blank(c) && c != EOF) *s++ = c, c = gc();
        *s = 0;
    }

    template<typename T> void rd(T &x) {
        x = 0; int f = 0; char c = gc();
        while (!isdigit(c)) f = (c == '-'), c = gc();
        while (isdigit(c)) x = (x << 1) + (x << 3) + (c - '0'), c = gc();
        if (f) x = -x;
    }

    template<typename T, typename... Ts>
    void rd(T& x, Ts&... xs) { rd(x), rd(xs...); }

    void pc(const char &c) {
        if (pf - puf == 1 << 20) fwrite(pf = puf, 1, 1 << 20, stdout);
        *pf++ = c;
    }

    void prt(char c) { pc(c); }
    void prt(char* s) { while (*s) pc(*s++); }
    void prt(const char* s) { while (*s) pc(*s++); }

    template<typename T> void prt(T x) {
        static int st[41], tp = 0;
        if (x == 0) { pc('0'); return; }
        if (x < 0) x = -x, pc('-');
        while (x) st[++tp] = x % 10, x /= 10;
        while (tp) pc(st[tp--] + '0');
    }

    template<typename T> void prt(T *x) { while (*x) pc(*x++); }

    template<typename T, typename... Ts>
    void prt(T x, Ts... xs) { prt(x), prt(xs...); }

    void prts(const char *s, char c = '\n') {
        while (*s) pc(*s++);
        if (c) pc(c);
    }
} IO;

#define rd IO.rd
#define rdl IO.rdl
#define ri rd<int>()
#define rl rd<ll>()
#define prt IO.prt
#define prs IO.prts
#define edl IO.pc('\n')

#define MC

#define N 100005
#define mod 998244353
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f

#define pli pair<ll, int>
#define vli vector<pli>
#define pb pop_back

int TID, n, m;
ll ans;
ll a[N];
int p[63][N];
int vt[N], tp;
vli st;
vector<vli> res;
bool vs[N];

ll dfs1(ll xs, int k, bool fg) {
    if (k < 0) return 0;
    ll K = BIT(k) - 1;
    if (bin(xs, k)) {
        rep(_, 1, n) if (int i = p[k][_]; !vs[i] && !bin(a[i], k)) {
            vs[i] = 1;
            ll x = K + 1 - (a[i] & K) + dfs1(xs ^ (a[i] & K), k - 1, 1);
            return vs[i] = 0, x;
        }
        if (fg) return K + 1 + dfs1(xs, k - 1, fg);
        return INF;
    }
    ll x = dfs1(xs, k - 1, fg);
    if (!fg) rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
        if (bin(a[i], k)) break;
        rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
            if (bin(a[j], k)) break;
            vs[i] = vs[j] = 1;
            chkmn(x, K + 1 - (a[i] & K) - (a[j] & K) + K + 1
                 + dfs1(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1));
            return vs[i] = vs[j] = 0, x;
        }
    }
    return x;
}

int dfs2(ll xs, int k, bool fg, ll su) {
    dbg(xs, k, fg, su, st);
    if (su > ans) return -1;
    if (k < 0) {
        if (res.size() == m) return 0;
        return res.eb(st), 1;
    }
    ll K = BIT(k) - 1;
    bool bk = 0;
    if (bin(xs, k)) {
        rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
            if (bin(a[i], k)) break;
            vs[i] = 1, st.eb(K + 1 - (a[i] & K), i), vt[++tp] = i;
            int tg = dfs2(xs ^ (a[i] & K), k - 1, 1, su + K + 1 - (a[i] & K));
            vs[i] = 0, st.pb(), tp--;
            if (!tg) return bk;
            if (!~tg) break;
            bk = 1;
        }
        if (fg) {
            rep(_, 1, tp) {
                int i = vt[_];
                st.eb(K + 1, i);
                int tg = dfs2(xs, k - 1, fg, su + K + 1);
                if (st.pb(); !tg) return bk;
                if (!~tg) break;
                bk = 1;
            }
        }
        return bk;
    }
    bk = dfs2(xs, k - 1, fg, su);
    if (k == 3 && su == 0) dbgArr(p[k] + 1, n), dbgArr(vs + 1, n);
    rep(_, 1, n) if (int i = p[k][_]; !vs[i]) {
        dbg(_, k, p[k][_], i);
        if (bin(a[i], k)) break;
        rep(__, _ + 1, n) if (int j = p[k][__]; !vs[j]) {
            dbg(__, k, p[k][__], j);
            if (bin(a[j], k)) break;
            ll x = K + 1 - (a[i] & K), y = K + 1 - (a[j] & K);
            vs[i] = vs[j] = 1, st.eb(x, i), st.eb(y, j), vt[++tp] = i, vt[++tp] = j;
            int tg = dfs2(xs ^ (a[i] & K) ^ (a[j] & K), k - 1, 1, su + x + y);
            vs[i] = vs[j] = 0, st.pb(), st.pb(), ----tp;
            if (!tg) return bk;
            if (!~tg) break;
            bk = 1;
        }
    }
    return bk;
}

/*

7 7 7 6 2 2 3
0111
0111
0111
0110
0010
0010
0011

*/

void mslv() {
    rd(n, m), st.clear(), res.clear();
    ll xs = 0;
    rep(i, 1, n) xs ^= a[i] = rl;
    rep(k, 0, 60) {
        rep(i, 1, n) p[k][i] = i;
        ll K = BIT(k) - 1;
        sort(p[k] + 1, p[k] + n + 1, [&](int i, int j) {
            return (bin(a[i], k) ? -1 : a[i] & K)
                 > (bin(a[j], k) ? -1 : a[j] & K);
        });
    }
    ans = dfs1(xs, 60, 0), dfs2(xs, 60, 0, 0);
    prt(ans, '\n', res.size(), '\n');
    for (auto ve : res) {
        sort(all(ve), [](pli x, pli y) { return x.se < y.se; });
        vli vc;
        for (auto [x, i] : ve) {
            if (vc.empty() || vc.back().se != i) vc.eb(x, i);
            else vc.back().fi += x;
        }
        prt(vc.size(), '\n');
        for (auto [x, i] : vc) prt(i, ' '); edl;
        for (auto [x, i] : vc) prt(x, ' '); edl;
    }
}

void mprw() {}

bool Med;

int main() {
    #ifdef JYR
    errs("Running!");
    freopen("Test.in", "r", stdin);
    freopen("Test.out", "w", stdout);
    #endif
    mprw();
    #ifdef MC
    int _; rd(TID, _);
    while (_--) mslv();
    #else
    mslv();
    #endif
    errm("%.3lfMB %.0lfms\n", abs(&Med - &Mbe) / 1048576., clock() * 1000. / CLOCKS_PER_SEC);
    return 0;
}

詳細信息

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 151ms
memory: 28520kb

input:

1 10000
2 1
324097321 555675086
2 1
304655177 991244276
2 1
9980291 383616352
2 1
1071036550 795625380
2 1
682098056 68370721
2 1
969101726 685975156
2 1
973896269 354857775
2 1
196188000 606494155
2 1
754416123 467588829
2 1
495704303 558090120
2 1
618002000 491488050
2 1
741575237 9937018
2 1
1002...

output:

231577765
1
1
1 
231577765 
686589099
1
1
1 
686589099 
373636061
1
1
1 
373636061 
275411170
1
1
2 
275411170 
613727335
1
1
2 
613727335 
283126570
1
1
2 
283126570 
619038494
1
1
2 
619038494 
410306155
1
1
1 
410306155 
286827294
1
1
2 
286827294 
62385817
1
1
1 
62385817 
126513950
1
1
2 
12651...

result:

ok correct answer

Subtask #2:

score: 12
Accepted

Test #2:

score: 12
Accepted
time: 0ms
memory: 30292kb

input:

2 5
5 2000
0 13 3 4 10
5 2000
0 3 9 1 11
5 2000
0 13 7 3 5
5 2000
0 1 13 9 2
5 2000
0 8 14 7 13

output:

0
1
0


0
1
0


2
2
2
2 3 
1 1 
2
3 5 
1 1 
3
2
2
1 5 
1 2 
1
5 
3 
2
1
2
4 5 
1 1 

result:

ok correct answer

Test #3:

score: 12
Accepted
time: 0ms
memory: 30292kb

input:

2 5
5 2000
0 4 14 5 7
5 2000
0 2 15 0 12
5 2000
0 1 14 0 5
5 2000
0 13 4 12 3
5 2000
0 10 10 1 11

output:

6
2
3
1 4 5 
4 1 1 
2
4 5 
1 5 
1
4
1
1 
1 
1
2 
1 
1
4 
1 
1
5 
1 
8
8
3
1 2 5 
2 3 3 
3
2 4 5 
3 2 3 
2
2 5 
3 5 
2
2 5 
5 3 
3
1 2 5 
4 1 3 
3
2 4 5 
1 4 3 
2
2 5 
1 7 
2
2 5 
7 1 
2
4
2
1 5 
1 1 
2
3 5 
1 1 
2
4 5 
1 1 
1
5 
2 
10
13
3
1 2 4 
2 1 7 
3
1 3 4 
2 1 7 
2
1 4 
2 8 
2
1 4 
3 7 
2
1 4 ...

result:

ok correct answer

Test #4:

score: 12
Accepted
time: 0ms
memory: 30228kb

input:

2 5
5 2000
0 6 15 10 1
5 2000
0 15 0 13 10
5 2000
0 5 7 5 1
5 2000
0 13 3 2 15
5 2000
0 2 4 7 0

output:

2
5
2
1 5 
1 1 
2
2 5 
1 1 
2
4 5 
1 1 
1
5 
2 
1
1 
2 
8
2
1
1 
8 
1
3 
8 
4
2
2
2 5 
1 3 
2
4 5 
1 3 
1
1
1
2 
1 
1
4
1
1 
1 
1
2 
1 
1
3 
1 
1
5 
1 

result:

ok correct answer

Subtask #3:

score: 12
Accepted

Dependency #2:

100%
Accepted

Test #5:

score: 12
Accepted
time: 0ms
memory: 30552kb

input:

3 5
6 2000
0 45 517 811 107 132
6 2000
0 382 576 805 419 579
6 2000
0 379 809 441 331 67
6 2000
0 565 776 959 852 383
6 2000
0 613 383 829 47 441

output:

146
20
5
1 2 3 4 6 
1 19 1 1 124 
4
2 3 4 6 
19 1 1 125 
4
2 3 4 6 
20 1 1 124 
4
2 3 4 6 
19 1 2 124 
4
2 3 4 6 
19 2 1 124 
4
1 2 4 6 
2 19 1 124 
3
2 4 6 
19 1 126 
3
2 4 6 
21 1 124 
3
2 4 6 
19 3 124 
5
1 2 3 5 6 
1 19 1 1 124 
4
2 3 5 6 
19 1 1 125 
4
2 3 5 6 
20 1 1 124 
4
2 3 5 6 
19 1 2 124...

result:

ok correct answer

Test #6:

score: 12
Accepted
time: 1ms
memory: 30288kb

input:

3 5
6 2000
0 75 173 555 637 905
6 2000
0 934 118 906 367 728
6 2000
0 244 321 598 625 469
6 2000
0 573 489 24 480 459
6 2000
0 424 356 750 623 871

output:

557
483
5
1 2 3 5 6 
8 53 342 131 23 
5
1 2 3 5 6 
8 53 341 132 23 
5
1 2 3 5 6 
8 54 341 131 23 
5
1 2 3 5 6 
8 53 341 131 24 
5
1 2 3 5 6 
9 53 341 131 23 
5
1 2 3 5 6 
8 53 340 133 23 
5
1 2 3 5 6 
8 53 339 134 23 
5
1 2 3 5 6 
8 54 339 133 23 
5
1 2 3 5 6 
8 53 339 133 24 
5
1 2 3 5 6 
9 53 339 ...

result:

ok correct answer

Test #7:

score: 12
Accepted
time: 0ms
memory: 30544kb

input:

3 5
6 2000
0 886 972 226 813 407
6 2000
0 219 190 742 101 572
6 2000
0 590 423 516 1017 46
6 2000
0 388 807 207 205 647
6 2000
0 408 180 238 300 694

output:

176
25
5
1 2 4 5 6 
8 10 30 19 109 
5
1 2 4 5 6 
8 10 34 19 105 
5
1 2 4 5 6 
8 14 30 19 105 
5
1 2 4 5 6 
8 10 30 23 105 
5
1 2 4 5 6 
12 10 30 19 105 
5
1 2 4 5 6 
4 10 30 19 113 
4
2 4 5 6 
10 30 19 117 
4
2 4 5 6 
10 34 19 113 
4
2 4 5 6 
14 30 19 113 
4
2 4 5 6 
10 30 23 113 
5
1 2 4 5 6 
4 10 ...

result:

ok correct answer

Subtask #4:

score: 0
Time Limit Exceeded

Test #8:

score: 12
Accepted
time: 454ms
memory: 30668kb

input:

4 257
100000 100
32768 65536 262144 32768 8388608 1048576 4 67108864 16384 32768 262144 8192 512 134217728 65536 4194304 262144 67108864 1024 262144 64 32 65536 2097152 268435456 1 2048 4194304 16777216 8 16384 2 2048 16777216 268435456 262144 1048576 8388608 16 268435456 2 128 4194304 262144 32768 ...

output:

303389274
100
13
4330 6806 12450 15412 16083 20338 30949 31755 45139 48217 59387 59608 74711 
1048576 262144 33554432 16384 8 2048 2 512 4096 16 64 65536 268435456 
13
4330 6806 12450 15412 16083 20338 31755 45139 48217 59387 59608 74711 86656 
1048576 262144 33554432 16384 8 2048 512 4096 16 64 655...

result:

ok correct answer

Test #9:

score: 12
Accepted
time: 391ms
memory: 30344kb

input:

4 266
100000 100
134217728 524288 8388608 4 8 8388608 33554432 4 536870912 4 16 8 33554432 33554432 256 65536 8 16 64 8 256 2048 268435456 256 8192 2 1024 65536 32 2048 134217728 8 1048576 8 16777216 33554432 1024 33554432 131072 16 2 33554432 8192 512 4194304 2048 268435456 256 536870912 16777216 1...

output:

269988539
100
15
13562 13762 17189 20281 27367 35295 36434 37041 63519 83351 89105 91384 93134 97947 98862 
131072 8 8192 65536 512 2 262144 1048576 268435456 1 128 32 16 4096 32768 
15
13562 13762 17189 20281 27367 35295 36434 37041 40104 63519 89105 91384 93134 97947 98862 
131072 8 8192 65536 512...

result:

ok correct answer

Test #10:

score: 12
Accepted
time: 456ms
memory: 30668kb

input:

4 269
100000 100
1048576 2 64 67108864 1024 67108864 268435456 32768 8388608 32 256 2 268435456 262144 524288 262144 2 524288 64 8192 262144 536870912 2097152 64 1024 2 1048576 128 2 8388608 512 32768 1 8388608 4 2 268435456 128 67108864 65536 2 8388608 2048 16 2048 4096 32768 1048576 32768 32 83886...

output:

471323918
100
15
2378 11432 11631 25319 25494 26527 34575 39820 41927 70784 73839 83717 90258 91404 93397 
65536 256 134217728 32768 262144 4 131072 16384 67108864 268435456 4096 1024 1048576 8 2 
15
2378 11432 11631 25319 25494 26527 34575 39820 41927 44844 70784 73839 83717 90258 91404 
65536 256 ...

result:

ok correct answer

Test #11:

score: 0
Time Limit Exceeded

input:

4 2
100000 5000
32768 2 1024 1 65536 32768 4194304 4 2 33554432 1048576 268435456 4194304 268435456 268435456 4194304 32768 2097152 131072 16777216 1024 262144 2048 65536 512 1024 8388608 128 512 33554432 1 32 134217728 8388608 2097152 4 2097152 1048576 1024 33554432 536870912 536870912 33554432 327...

output:


result:


Subtask #5:

score: 12
Accepted

Test #18:

score: 12
Accepted
time: 239ms
memory: 29192kb

input:

5 10000
10 1
0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823
10 1
0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823
10 1
0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741...

output:

1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 
...

result:

ok correct answer

Test #19:

score: 12
Accepted
time: 608ms
memory: 30696kb

input:

5 2323
100000 1
0 3170633 888529329 347839787 101667249 273239696 1028446182 411994109 710973319 298677951 299452068 519308796 361451040 488605068 74238166 997794448 478367019 532094220 747266199 217905213 682359917 774814810 234838947 456387659 38459020 434013070 633290806 173828476 94076883 568288...

output:

11962
1
15
2310 5529 8448 19231 33798 38129 47454 49541 62846 73205 78515 86883 91162 95106 99572 
1 19 54 1 8212 139 1 2165 1 1 1364 1 1 1 1 
1607036
1
11
4 6 7 12 15 16 22 26 28 29 36 
65471 32512 6 520064 978944 6136 3836 4 60 2 1 
106
1
3
1 2 3 
32 29 45 
3
1
2
1 2 
1 2 
126
1
5
1 3 5 9 10 
1 12...

result:

ok correct answer

Test #20:

score: 12
Accepted
time: 615ms
memory: 30544kb

input:

5 2205
100000 1
0 684191025 220215685 982495864 602362406 687396179 439432236 81065680 398068897 269754402 306183653 309939439 664994998 1011962742 338161922 629593565 926305057 1026259775 711874360 69406110 426672919 208267066 551253027 9384823 26156203 778817402 654214308 527029151 1065024353 2870...

output:

22539
1
18
9642 9986 11813 14681 19490 20042 21599 34215 38540 38873 39009 41244 55478 65772 71574 75575 89268 92825 
18405 1 5 1 1 1 2826 1 14 846 1 1 1 1 1 1 404 28 
5296170
1
10
3 8 9 11 12 16 19 20 30 38 
2 1048320 64 4194240 30 6142 31744 15360 16 252 
2997548
1
3
3 4 5 
7998 1031664 1957886 
1...

result:

ok correct answer

Test #21:

score: 12
Accepted
time: 641ms
memory: 30164kb

input:

5 2166
100000 1
0 58930516 543560994 783997157 728082180 789115629 549794748 81818067 214839912 203394814 711969322 908524000 570262778 992867922 359455295 88035653 412186516 937931728 331800409 545354553 535440658 894562512 657466952 555070606 469471475 1055263866 874958292 76960239 478302168 68009...

output:

8241
1
16
66 23578 24616 26786 29190 41382 46768 54258 55788 55893 61562 63038 68234 70775 72809 82425 
63 1 1 5 7798 1 1 156 1 1 1 1 192 1 4 14 
2846999
1
4
1 2 4 5 
131072 103522 2049874 562531 
1605
1
6
2 6 8 12 22 23 
1 96 1023 480 1 4 
21150
1
4
1 2 3 5 
32 13220 4050 3848 
13
1
2
1 2 
4 9 
0
1...

result:

ok correct answer

Subtask #6:

score: 16
Accepted

Test #22:

score: 16
Accepted
time: 3ms
memory: 30300kb

input:

6 23
1000 10
0 357293452 452461848 986047039 546588280 762710079 767831017 39741545 416114273 515599366 1018969624 603342125 928112286 1053016142 240953466 533088067 1028134429 504727014 371307863 834428873 968387878 478550336 1047217797 1046651542 777749850 866989319 92995163 251915198 363285573 10...

output:

264227
10
12
134 187 203 355 565 569 673 786 876 955 996 999 
5 1 2638 9 531 1 1 697 251113 10 5226 3995 
12
134 187 203 355 542 565 673 786 876 955 996 999 
5 1 2638 9 1 531 1 697 251113 10 5226 3995 
12
134 187 203 355 543 565 673 786 876 955 996 999 
5 1 2638 9 1 531 1 697 251113 10 5226 3995 
12...

result:

ok correct answer

Test #23:

score: 16
Accepted
time: 1ms
memory: 30300kb

input:

6 23
1000 10
0 978686021 287986921 276311856 889616598 739968417 1060147652 463275477 172393699 591333230 983197307 235514434 330494755 449056272 882229818 781111474 275587745 980041928 334198691 305313012 415758352 947298893 950211162 909723054 961622596 917454340 161928901 404346316 369133631 1038...

output:

709905
10
15
29 32 178 232 279 283 482 656 677 727 757 842 917 977 978 
1 56 1 1 3862 6 12836 4 1 47 1 693086 1 1 1 
15
29 32 178 243 279 283 482 656 677 727 757 842 917 977 978 
1 56 1 1 3862 6 12836 4 1 47 1 693086 1 1 1 
15
29 32 178 279 283 482 623 656 677 727 757 842 917 977 978 
1 56 1 3862 6 ...

result:

ok correct answer

Test #24:

score: 16
Accepted
time: 7ms
memory: 30288kb

input:

6 15
1000 10
0 631723071 149784582 965844254 515554472 887253148 467825521 981769969 1054193550 627909969 590277818 159342752 658063143 667914173 169490051 25536270 337269419 1056885019 980490575 750858271 553446484 347553447 376197986 1053224035 473470890 123586 97769047 761755924 510998818 2560945...

output:

737485
10
15
102 172 208 237 265 384 474 553 599 625 747 790 831 880 924 
1 27 1 1 227 215546 2917 1 6 7 87404 1600 16 41649 388082 
15
102 172 208 254 265 384 474 553 599 625 747 790 831 880 924 
1 27 1 1 227 215546 2917 1 6 7 87404 1600 16 41649 388082 
15
102 172 208 253 265 384 474 553 599 625 7...

result:

ok correct answer

Test #25:

score: 16
Accepted
time: 2ms
memory: 28268kb

input:

6 25
1000 10
0 751950140 901599329 987895071 306253500 278530668 539473653 911723672 948474628 722632384 369217860 428703545 999113214 567923990 53499297 1013528916 263060554 669297221 349021033 832596533 893306880 892438572 345611286 331257977 488113061 578929864 881846255 320356815 76057168 704694...

output:

1119212
10
14
97 122 125 215 236 431 528 552 576 717 774 887 920 950 
7 5641 1 149775 107 6002 26620 674 1237 6239 1 922903 1 4 
14
97 110 122 125 215 236 431 528 552 576 717 887 920 950 
7 1 5641 1 149775 107 6002 26620 674 1237 6239 922903 1 4 
14
69 97 122 125 215 236 431 528 552 576 717 887 920 ...

result:

ok correct answer

Test #26:

score: 16
Accepted
time: 2ms
memory: 30284kb

input:

6 2
1000 1
0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1...

output:

1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 

result:

ok correct answer

Subtask #7:

score: 16
Accepted

Dependency #3:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #27:

score: 16
Accepted
time: 1383ms
memory: 31312kb

input:

7 195
100000 1000
0 828483622 617711013 242092397 1034026464 456205583 731635466 382894773 533786631 582730039 74863848 661821965 368857719 541353387 662605236 580923280 798012506 54823622 333416217 39292129 995195996 477140985 1014499425 362164396 970752859 879997855 96768859 1005365898 576674982 4...

output:

23456
1000
17
2217 7223 8651 12609 18331 23290 26970 27646 49440 50862 57974 64628 78504 83761 94288 94649 96808 
3 1743 3 20988 1 1 34 4 1 1 1 1 1 1 279 1 393 
17
2217 7223 8651 12609 18331 23290 26970 27646 50862 57974 64628 78504 81075 83761 94288 94649 96808 
3 1743 3 20988 1 1 34 4 1 1 1 1 1 1 ...

result:

ok correct answer

Test #28:

score: 16
Accepted
time: 461ms
memory: 30968kb

input:

7 228
100000 1000
0 230727359 951312015 741711018 367230626 775024687 130794976 435788836 781961691 736694220 427610697 1016199868 798240399 340962994 1006804448 708169239 976753368 364431996 495851435 246658001 190094424 1054346726 639713727 218794912 229693460 313349630 85091951 418997497 27345904...

output:

5906
1000
18
27090 31031 36690 46676 49706 57375 60712 63184 67455 67985 71982 79294 81500 81568 94039 95355 97479 97656 
1 2 71 1 1 2 11 28 3 4034 1 1 1 1 20 1 1071 656 
18
27090 31031 36690 41368 46676 49706 57375 60712 63184 67455 67985 71982 81500 81568 94039 95355 97479 97656 
1 2 71 1 1 1 2 11...

result:

ok correct answer

Test #29:

score: 16
Accepted
time: 482ms
memory: 30960kb

input:

7 221
100000 1000
0 716795222 632538294 1008333912 248043863 1023411987 11954597 917179098 100756831 19780613 336926235 768679016 371044675 360783184 402042708 1056697208 567354265 284551620 146863144 1008241012 536649321 680142584 506474136 80860918 973856876 30288601 668537691 877380398 131785980 ...

output:

13893
1000
15
1833 7906 8817 12957 31013 48440 49780 53134 55435 68169 74227 78242 82418 93216 94588 
1 1 307 22 10 1 2415 1 1 2 1 1 33 1 11096 
15
1833 7906 8817 12957 31013 48440 49780 53134 55458 68169 74227 78242 82418 93216 94588 
1 1 307 22 10 1 2415 1 1 2 1 1 33 1 11096 
15
1833 7906 8817 129...

result:

ok correct answer

Test #30:

score: 16
Accepted
time: 19ms
memory: 28344kb

input:

7 1000
3 10
0 729041606 776089922
3 10
0 73695624 783752411
3 10
0 820372959 215264354
3 10
0 919645823 161862972
3 10
0 416211733 881194269
3 10
0 275811209 281074929
3 10
0 582815620 342763006
3 10
0 922520113 399127881
3 10
0 299636294 328307001
3 10
0 666654277 503934330
3 10
0 2735358 732598564...

output:

47048316
10
2
1 2 
33554432 13493884 
2
1 2 
33554434 13493882 
2
1 2 
33554496 13493820 
2
1 2 
33554498 13493818 
2
1 2 
33554688 13493628 
2
1 2 
33554690 13493626 
2
1 2 
33554752 13493564 
2
1 2 
33554754 13493562 
2
1 2 
33558528 13489788 
2
1 2 
33558530 13489786 
710056787
10
2
1 2 
13421772...

result:

ok correct answer

Test #31:

score: 16
Accepted
time: 39ms
memory: 30548kb

input:

7 2000
3 5
0 3978360 573616453
3 5
0 547375641 97549509
3 5
0 710402134 567209414
3 5
0 712013879 1031360933
3 5
0 118351677 538884285
3 5
0 96665729 441728559
3 5
0 1021357084 735021028
3 5
0 882151625 958055123
3 5
0 521548745 517316479
3 5
0 162247430 426447555
3 5
0 423460219 408674001
3 5
0 247...

output:

569638093
5
2
1 2 
33554432 536083661 
2
1 2 
33554433 536083660 
2
1 2 
33554436 536083657 
2
1 2 
33554437 536083656 
2
1 2 
33554496 536083597 
449826132
5
2
1 3 
8388608 441437524 
2
1 3 
8388609 441437523 
2
1 3 
8388616 441437516 
2
1 3 
8388617 441437515 
2
1 3 
8388624 441437508 
143192720
5...

result:

ok correct answer

Test #32:

score: 16
Accepted
time: 25ms
memory: 30296kb

input:

7 1000
4 10
0 827032080 596299879 377757837
4 10
0 139678996 620475310 982977750
4 10
0 327504523 973136882 1056046317
4 10
0 703538140 645917988 869157682
4 10
0 453817111 255127787 753233051
4 10
0 503195344 905031432 746786602
4 10
0 615183881 988518844 555461556
4 10
0 932813811 356392410 858830...

output:

28167702
10
3
1 2 3 
8388608 11828720 7950374 
3
1 2 3 
8388608 11828721 7950373 
3
1 2 3 
8388609 11828720 7950373 
3
1 2 3 
8388608 11828724 7950370 
3
1 2 3 
8388608 11828725 7950369 
3
1 2 3 
8388609 11828724 7950369 
3
1 2 3 
8388612 11828720 7950370 
3
1 2 3 
8388612 11828721 7950369 
3
1 2 3 ...

result:

ok correct answer

Test #33:

score: 16
Accepted
time: 346ms
memory: 31064kb

input:

7 2
100000 1
0 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823 1073741823...

output:

1073741823
1
1
1 
1073741823 
1073741823
1
1
1 
1073741823 

result:

ok correct answer

Test #34:

score: 16
Accepted
time: 491ms
memory: 30852kb

input:

7 204
100000 1000
0 867143449 289720871 62880653 256495758 373546157 114942061 524281177 164218453 261500635 241690011 911469619 794136322 460604293 201667773 1001245336 873383805 136426866 731765422 1036091702 428463064 474020221 916532901 913755707 704796468 745115429 387268771 611877390 101588067...

output:

1241
1000
11
17963 34351 38578 41368 47178 55333 66676 71548 72308 91443 98425 
132 1 1 1 11 1 119 1 970 1 3 
11
17963 34351 38578 47178 55333 66676 71548 72308 79332 91443 98425 
132 1 1 11 1 119 1 970 1 1 3 
11
17963 34351 38578 41348 47178 55333 66676 71548 72308 91443 98425 
132 1 1 1 11 1 119 1...

result:

ok correct answer

Subtask #8:

score: 0
Skipped

Dependency #7:

100%
Accepted

Dependency #4:

0%

Subtask #9:

score: 0
Skipped

Dependency #8:

0%