QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#498945#5210. Lisa's SequencesPorNPtreeAC ✓484ms300944kbC++172.3kb2024-07-30 22:03:012024-07-30 22:03:09

Judging History

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

  • [2024-07-30 22:03:09]
  • 评测
  • 测评结果:AC
  • 用时:484ms
  • 内存:300944kb
  • [2024-07-30 22:03:01]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 1e6 + 5;

int a[N];

struct op {
    int v, ud, val, tlen, len;
    op *prev;

    op(int V = 0, int UD = 0, int VAL = 0, int TLEN = 0, int LEN = 0, op *PREV = NULL) {
        v = V, ud = UD, val = VAL, tlen = TLEN, len = LEN, prev = PREV;
    }

    int operator < (op y) {
        if (v != y.v) return v < y.v;
		if (len != y.len) return len < y.len;
        if (tlen != y.tlen) return tlen < y.tlen;
        if (ud != y.ud) return ud < y.ud;
        if (val != y.val) return val < y.val;
        return 0;
    }

    int operator > (op y) {
        return y < *this;
    }

    int operator == (op y) {
        return !(*this < y) && !(*this > y);
    }
};

vector<op> f[N];
int res[N];

signed main() {
    int n, m; scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
    f[1].push_back(op(1, 1, -1, 1, 1));
    f[1].push_back(op(0, 1, 0, 1, 1));
    f[1].push_back(op(0, -1, 0, 1, 1));
    f[1].push_back(op(1, -1, 1, 1, 1));
    for (int i = 2; i <= n; ++i) {
        for (auto &x : f[i - 1]) {
            if (x.ud != -1) f[i].push_back(op(x.v + 1, -1, -1, 1, x.tlen + 1, &x));
            if (x.ud != 1) f[i].push_back(op(x.v + 1, 1, 1, 1, x.tlen + 1, &x));
            int V = (x.val == -1 ? 0 : (!x.val ? a[i - 1] : 1e5)),
                ud = (a[i] == V ? x.ud : (a[i] < V ? -1 : 1)),
                tlen = (a[i] == V ? x.tlen + 1 : 1),
                len = (a[i] == V || ((a[i] > V) ^ (x.ud == -1)) ? x.len + 1 : x.tlen + 1);
            f[i].push_back(op(x.v, ud, 0, tlen, len, &x));
        }
        map< pair<int, int>, op> M;
        for (auto x : f[i]) if (x.len < m && (i == n || x.tlen + 1 < m)) {
            if (!M.count(make_pair(x.ud, x.val)) || M[make_pair(x.ud, x.val)] > x) {
                M[make_pair(x.ud, x.val)] = x;
            }
        }
        f[i].clear();
        for (auto [x, y] : M) f[i].push_back(y);
    }
    op now = *min_element(f[n].begin(), f[n].end());
    printf("%d\n", now.v);
    for (int i = n; i >= 1; --i) {
        res[i] = (now.val == -1 ? 0 : (!now.val ? a[i] : 1e5));
        if (i != 1) now = *(now.prev);
    }
    for (int i = 1; i <= n; ++i) printf("%d%c", res[i], " \n"[i == n]);
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 28344kb

input:

5 3
1 2 3 4 5

output:

2
1 2 0 4 0

result:

ok 2

Test #2:

score: 0
Accepted
time: 3ms
memory: 30348kb

input:

6 3
1 1 1 1 1 1

output:

3
1 0 1 0 1 0

result:

ok 3

Test #3:

score: 0
Accepted
time: 3ms
memory: 30488kb

input:

6 4
1 1 4 4 1 1

output:

1
1 1 0 4 1 1

result:

ok 1

Test #4:

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

input:

6 4
4 4 4 2 2 2

output:

2
4 0 4 2 100000 2

result:

ok 2

Test #5:

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

input:

6 4
4 4 4 3 4 4

output:

1
4 0 4 3 4 4

result:

ok 1

Test #6:

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

input:

8 4
2 1 1 3 3 1 1 2

output:

2
2 1 1 100000 3 1 100000 2

result:

ok 2

Test #7:

score: 0
Accepted
time: 7ms
memory: 30476kb

input:

10 4
1 1 1 2 2 1 1 2 2 1

output:

2
1 1 100000 2 2 100000 1 2 2 1

result:

ok 2

Test #8:

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

input:

7 5
5 4 4 3 4 4 4

output:

0
5 4 4 3 4 4 4

result:

ok 0

Test #9:

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

input:

10 10
1 1 1 1 1 1 1 1 1 1

output:

1
1 1 1 1 1 1 1 1 100000 1

result:

ok 1

Test #10:

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

input:

3 3
1 2 1

output:

0
1 2 1

result:

ok 0

Test #11:

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

input:

3 3
2 1 1

output:

1
2 100000 1

result:

ok 1

Test #12:

score: 0
Accepted
time: 6ms
memory: 28300kb

input:

3 3
1 1 2

output:

1
1 100000 2

result:

ok 1

Test #13:

score: 0
Accepted
time: 5ms
memory: 30392kb

input:

3 3
1 1 1

output:

1
1 100000 1

result:

ok 1

Test #14:

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

input:

5 3
1 1 1 1 1

output:

2
1 100000 1 100000 1

result:

ok 2

Test #15:

score: 0
Accepted
time: 4ms
memory: 30680kb

input:

6 4
5 5 5 5 5 5

output:

2
5 5 100000 5 100000 5

result:

ok 2

Test #16:

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

input:

6 4
4 4 4 2 2 4

output:

1
4 0 4 2 2 4

result:

ok 1

Test #17:

score: 0
Accepted
time: 3ms
memory: 28348kb

input:

6 4
5 5 5 5 4 2

output:

1
5 5 0 5 4 2

result:

ok 1

Test #18:

score: 0
Accepted
time: 6ms
memory: 30476kb

input:

6 4
3 3 3 2 2 3

output:

1
3 0 3 2 2 3

result:

ok 1

Test #19:

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

input:

8 4
4 2 2 4 4 1 2 4

output:

1
4 2 2 100000 4 1 2 4

result:

ok 1

Test #20:

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

input:

8 4
4 5 5 4 3 5 5 4

output:

1
4 5 0 4 3 5 5 4

result:

ok 1

Test #21:

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

input:

6 4
1 3 4 4 4 4

output:

1
1 3 4 0 4 4

result:

ok 1

Test #22:

score: 0
Accepted
time: 7ms
memory: 28432kb

input:

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

output:

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

result:

ok 4

Test #23:

score: 0
Accepted
time: 7ms
memory: 30396kb

input:

9 4
5 5 5 3 3 3 2 2 2

output:

3
5 5 0 3 0 3 2 100000 2

result:

ok 3

Test #24:

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

input:

13 3
2 3 1 3 1 3 3 1 3 1 3 1 2

output:

3
2 0 1 0 1 0 3 1 3 1 3 1 2

result:

ok 3

Test #25:

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

input:

10 3
2 1 1 2 2 1 2 2 1 2

output:

3
2 100000 1 2 0 1 0 2 1 2

result:

ok 3

Test #26:

score: 0
Accepted
time: 3ms
memory: 30416kb

input:

10 3
2 3 3 2 1 1 3 1 3 1

output:

2
2 0 3 2 100000 1 3 1 3 1

result:

ok 2

Test #27:

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

input:

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

output:

2
1 5 1 3 1 3 0 1 0 5

result:

ok 2

Test #28:

score: 0
Accepted
time: 5ms
memory: 28344kb

input:

10 3
45193 6340 72389 96197 51013 36684 59421 49197 79404 86162

output:

2
45193 6340 72389 0 51013 36684 59421 49197 79404 0

result:

ok 2

Test #29:

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

input:

10 4
1 2 1 2 2 2 1 1 1 2

output:

2
1 2 1 2 0 2 1 1 100000 2

result:

ok 2

Test #30:

score: 0
Accepted
time: 3ms
memory: 28424kb

input:

10 4
2 3 3 1 1 2 1 2 3 3

output:

2
2 3 3 0 1 2 1 2 3 0

result:

ok 2

Test #31:

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

input:

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

output:

0
1 1 4 3 4 5 3 4 2 5

result:

ok 0

Test #32:

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

input:

10 4
45758 16873 75040 42225 77839 62718 13983 70028 26023 91322

output:

0
45758 16873 75040 42225 77839 62718 13983 70028 26023 91322

result:

ok 0

Test #33:

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

input:

10 5
1 2 2 1 1 2 1 2 2 1

output:

0
1 2 2 1 1 2 1 2 2 1

result:

ok 0

Test #34:

score: 0
Accepted
time: 4ms
memory: 30348kb

input:

10 5
1 1 2 2 3 2 2 1 1 1

output:

2
1 1 2 2 0 2 2 1 100000 1

result:

ok 2

Test #35:

score: 0
Accepted
time: 4ms
memory: 28372kb

input:

10 5
4 1 3 1 3 3 4 4 4 5

output:

1
4 1 3 1 3 3 4 0 4 5

result:

ok 1

Test #36:

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

input:

10 5
55540 7942 77691 78007 13884 79534 67516 89829 81858 96483

output:

0
55540 7942 77691 78007 13884 79534 67516 89829 81858 96483

result:

ok 0

Test #37:

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

input:

10 6
2 2 2 1 2 1 2 2 2 1

output:

0
2 2 2 1 2 1 2 2 2 1

result:

ok 0

Test #38:

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

input:

10 6
1 2 3 1 3 1 3 3 1 2

output:

0
1 2 3 1 3 1 3 3 1 2

result:

ok 0

Test #39:

score: 0
Accepted
time: 4ms
memory: 28628kb

input:

10 6
3 3 3 2 1 1 5 3 5 5

output:

1
3 3 3 2 100000 1 5 3 5 5

result:

ok 1

Test #40:

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

input:

10 6
56105 97981 59850 34282 30465 96350 22078 9631 28477 1644

output:

0
56105 97981 59850 34282 30465 96350 22078 9631 28477 1644

result:

ok 0

Test #41:

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

input:

10 7
1 2 2 2 1 2 1 1 1 1

output:

0
1 2 2 2 1 2 1 1 1 1

result:

ok 0

Test #42:

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

input:

10 7
1 3 2 2 1 2 3 2 1 1

output:

0
1 3 2 2 1 2 3 2 1 1

result:

ok 0

Test #43:

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

input:

10 7
3 4 4 5 4 3 4 3 3 5

output:

0
3 4 4 5 4 3 4 3 3 5

result:

ok 0

Test #44:

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

input:

10 7
56671 99297 62500 89526 57292 22385 76640 20216 84312 6804

output:

0
56671 99297 62500 89526 57292 22385 76640 20216 84312 6804

result:

ok 0

Test #45:

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

input:

10 8
2 1 2 2 2 2 1 2 2 2

output:

0
2 1 2 2 2 2 1 2 2 2

result:

ok 0

Test #46:

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

input:

10 8
1 3 3 3 3 1 2 3 2 1

output:

0
1 3 3 3 3 1 2 3 2 1

result:

ok 0

Test #47:

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

input:

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

output:

0
4 5 2 2 2 4 5 1 4 3

result:

ok 0

Test #48:

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

input:

10 8
36744 99583 65151 35555 93335 39201 31202 50263 30931 21182

output:

0
36744 99583 65151 35555 93335 39201 31202 50263 30931 21182

result:

ok 0

Test #49:

score: 0
Accepted
time: 7ms
memory: 30648kb

input:

10 9
2 1 1 2 2 1 2 2 2 2

output:

0
2 1 1 2 2 1 2 2 2 2

result:

ok 0

Test #50:

score: 0
Accepted
time: 3ms
memory: 28432kb

input:

10 9
3 3 3 1 2 2 2 3 2 2

output:

0
3 3 3 1 2 2 2 3 2 2

result:

ok 0

Test #51:

score: 0
Accepted
time: 3ms
memory: 30680kb

input:

10 9
2 5 2 5 5 1 3 2 5 5

output:

0
2 5 2 5 5 1 3 2 5 5

result:

ok 0

Test #52:

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

input:

10 9
46526 90653 57556 81583 9917 65235 75517 70064 77549 26342

output:

0
46526 90653 57556 81583 9917 65235 75517 70064 77549 26342

result:

ok 0

Test #53:

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

input:

10 10
1 2 2 2 2 1 1 2 1 1

output:

0
1 2 2 2 2 1 1 2 1 1

result:

ok 0

Test #54:

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

input:

10 10
3 1 2 1 2 3 1 3 1 1

output:

0
3 1 2 1 2 3 1 3 1 1

result:

ok 0

Test #55:

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

input:

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

output:

0
1 4 4 5 4 2 3 2 2 2

result:

ok 0

Test #56:

score: 0
Accepted
time: 6ms
memory: 30396kb

input:

10 10
7713 90031 59708 15268 29396 79470 40228 76226 57485 12718

output:

0
7713 90031 59708 15268 29396 79470 40228 76226 57485 12718

result:

ok 0

Test #57:

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

input:

30 3
1 1 2 2 1 1 1 2 2 2 2 1 2 1 2 1 1 2 1 2 2 2 2 2 1 2 1 2 1 1

output:

11
0 1 0 2 1 100000 1 2 0 2 0 1 0 1 0 1 0 2 1 2 0 2 0 2 1 2 1 2 0 1

result:

ok 11

Test #58:

score: 0
Accepted
time: 5ms
memory: 28376kb

input:

30 3
1 3 2 3 1 2 1 1 1 2 3 2 3 3 1 1 2 2 2 1 3 3 1 3 3 2 1 1 1 3

output:

9
1 3 2 3 1 2 1 100000 1 2 0 2 0 3 0 1 0 2 0 1 0 3 1 3 0 2 1 100000 1 3

result:

ok 9

Test #59:

score: 0
Accepted
time: 4ms
memory: 30408kb

input:

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

output:

5
1 2 1 5 1 3 0 2 0 4 1 2 0 4 3 5 2 100000 3 4 2 5 2 3 1 3 2 5 0 1

result:

ok 5

Test #60:

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

input:

30 3
46794 11642 64446 48822 93862 35562 9271 42435 89725 22019 95837 29908 59376 24224 24200 55981 88803 56777 85133 10604 67092 52105 17027 3049 98119 19228 1570 2996 16069 44400

output:

5
46794 11642 64446 48822 93862 35562 100000 42435 89725 22019 95837 29908 59376 24224 100000 55981 88803 56777 85133 10604 67092 0 17027 3049 98119 19228 100000 2996 16069 0

result:

ok 5

Test #61:

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

input:

30 4
2 1 2 2 2 1 1 2 1 1 1 1 1 2 1 1 1 1 2 2 1 1 2 1 2 2 1 1 2 2

output:

5
2 1 2 0 2 1 1 2 1 1 100000 1 1 2 1 1 100000 1 2 2 0 1 2 1 2 2 1 100000 2 2

result:

ok 5

Test #62:

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

input:

30 4
1 1 3 2 1 3 2 1 3 2 2 2 2 3 3 3 2 1 2 1 1 3 2 1 2 1 1 2 2 1

output:

3
1 1 3 2 1 3 2 1 3 2 2 100000 2 3 3 0 2 1 2 1 1 3 2 1 2 1 1 2 0 1

result:

ok 3

Test #63:

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

input:

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

output:

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

result:

ok 3

Test #64:

score: 0
Accepted
time: 4ms
memory: 28608kb

input:

30 4
47360 1682 67096 94850 20690 61595 63832 72482 45561 27180 8643 78413 70252 55432 95417 52362 44995 51511 99980 49672 20621 48503 60046 82179 13917 82990 50203 87463 50161 50380

output:

2
47360 1682 67096 94850 20690 61595 63832 0 45561 27180 8643 78413 70252 55432 95417 52362 44995 51511 99980 49672 20621 48503 0 82179 13917 82990 50203 87463 50161 50380

result:

ok 2

Test #65:

score: 0
Accepted
time: 4ms
memory: 28352kb

input:

30 5
1 1 2 2 1 2 2 1 1 1 2 2 2 1 1 2 1 1 2 2 1 1 2 1 2 2 2 1 2 2

output:

2
1 1 2 2 1 2 2 1 1 100000 2 2 2 100000 1 2 1 1 2 2 1 1 2 1 2 2 2 1 2 2

result:

ok 2

Test #66:

score: 0
Accepted
time: 4ms
memory: 28380kb

input:

30 5
2 3 1 3 2 3 2 2 3 3 3 2 1 2 2 1 1 3 1 3 1 2 1 2 1 1 1 1 2 1

output:

2
2 3 1 3 2 3 2 2 3 3 0 2 1 2 2 1 1 3 1 3 1 2 1 2 1 1 100000 1 2 1

result:

ok 2

Test #67:

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

input:

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

output:

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

result:

ok 2

Test #68:

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

input:

30 5
47925 92750 59501 40878 47517 78412 18394 92283 92179 41557 40911 17701 51420 96886 57419 29281 10404 47275 26104 98986 63903 43871 93847 70527 20496 47781 9084 82178 74006 36897

output:

1
47925 92750 59501 40878 47517 78412 18394 92283 92179 41557 40911 100000 51420 96886 57419 29281 10404 47275 26104 98986 63903 43871 93847 70527 20496 47781 9084 82178 74006 36897

result:

ok 1

Test #69:

score: 0
Accepted
time: 438ms
memory: 300664kb

input:

1000000 3
1 2 1 2 2 1 1 1 1 1 1 1 1 2 1 1 1 1 1 2 1 1 1 2 2 1 2 1 2 1 1 2 2 1 2 1 1 1 1 1 2 1 1 1 1 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 2 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 2 2 2 1 1 2 1 2 1 1 2 1 2 2 1 2 1 2 1 2 1 2 2 2 2 1 1 2 2 2 2 1 2 2 1 2 2 2 2 1 2 1 2 2 2 1 2 1 2 1 1 1 2 2 2 1 2 1 2 ...

output:

399795
1 0 1 0 2 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 2 1 2 1 2 0 1 0 2 1 2 1 100000 1 100000 1 2 1 100000 1 100000 2 100000 2 100000 1 2 0 1 0 2 1 2 0 2 1 100000 2 100000 1 2 0 2 0 1 0 2 0 1 0 1 0 2 1 100000 1 2 0 1 0 1 0 2 0 2 1 100000 2 100000 2 100000 1 2 1 2 0 1 0 1 0 1 0 1 0 2 0 2 0 1 0 2 0 2...

result:

ok 399795

Test #70:

score: 0
Accepted
time: 452ms
memory: 300640kb

input:

1000000 3
2 3 1 2 1 2 1 2 3 2 3 1 2 2 1 1 2 3 1 2 1 2 1 2 3 3 3 1 3 3 3 2 2 1 1 2 3 2 3 2 2 3 2 2 3 3 3 2 2 2 1 3 3 1 1 2 2 3 1 1 1 1 3 2 2 3 2 3 1 2 3 2 2 1 2 2 2 2 1 1 1 3 2 1 2 3 1 3 1 2 1 1 3 1 1 3 3 2 2 3 2 1 3 2 1 1 3 1 2 1 1 2 3 2 1 1 1 1 2 3 2 1 1 3 3 2 3 2 3 1 1 3 3 1 2 1 3 3 3 3 3 1 1 2 2 ...

output:

365780
2 0 1 0 1 0 1 0 3 2 3 1 2 0 1 0 2 0 1 0 1 0 1 0 3 0 3 1 3 0 3 0 2 1 100000 2 3 2 3 2 100000 3 100000 2 3 0 3 0 2 0 1 0 3 1 100000 2 100000 3 100000 1 100000 1 3 2 100000 3 100000 3 100000 2 3 0 2 1 2 0 2 0 1 0 1 0 2 1 2 0 1 0 1 0 1 0 3 0 1 0 3 0 2 0 2 1 3 2 100000 1 3 1 2 1 100000 2 3 2 10000...

result:

ok 365780

Test #71:

score: 0
Accepted
time: 410ms
memory: 300940kb

input:

1000000 3
2 4 1 2 4 5 3 2 1 2 4 2 1 2 4 2 3 3 5 4 5 2 5 2 4 3 5 4 5 3 4 1 4 2 4 1 3 2 4 3 3 4 1 3 4 1 4 1 5 5 3 1 2 5 5 5 5 1 5 4 1 5 4 1 2 5 1 1 2 2 3 3 2 5 3 3 3 2 5 5 3 5 3 3 1 1 4 2 1 5 1 2 2 4 1 4 4 2 5 4 3 5 5 3 1 3 2 5 3 5 4 2 1 2 1 4 2 1 5 2 4 4 3 4 1 1 3 3 2 2 5 4 4 5 3 3 2 1 3 1 1 5 5 1 3 ...

output:

337446
2 0 1 0 4 0 3 2 100000 2 4 2 100000 2 4 2 3 0 5 4 5 2 5 2 4 3 5 4 5 3 4 1 4 2 4 1 3 2 4 3 100000 4 100000 3 4 1 4 1 5 0 3 1 2 0 5 0 5 1 5 0 1 0 4 1 2 0 1 0 2 0 3 0 2 0 3 0 3 2 5 0 3 0 3 0 1 0 4 0 1 0 1 0 2 0 1 0 4 2 5 0 3 0 5 0 1 0 2 0 3 0 4 0 1 0 1 0 2 1 5 2 4 0 3 0 1 0 3 0 2 0 5 0 4 0 3 0 2...

result:

ok 337446

Test #72:

score: 0
Accepted
time: 449ms
memory: 300940kb

input:

1000000 3
73337 33587 27294 91377 34594 4430 75940 51624 70546 99878 3107 58368 77005 96496 58761 90424 86461 29807 43804 57247 5344 50578 10252 1413 30258 2895 25982 70523 32809 11612 71933 76460 33750 9022 102 21374 39194 92031 83586 50390 23925 56023 73780 96623 1267 98914 61392 96743 36604 49320...

output:

293139
0 33587 27294 91377 34594 100000 75940 100000 70546 99878 3107 58368 0 96496 58761 90424 86461 100000 43804 57247 5344 50578 10252 100000 30258 100000 25982 70523 32809 100000 71933 76460 0 9022 102 21374 0 92031 0 50390 23925 56023 0 96623 1267 98914 61392 96743 36604 49320 0 43304 0 77166 0...

result:

ok 293139

Test #73:

score: 0
Accepted
time: 462ms
memory: 300648kb

input:

1000000 4
1 2 1 1 2 2 2 2 1 1 2 1 2 1 1 2 1 2 1 2 2 2 1 2 1 1 1 1 1 2 1 1 1 2 2 1 1 1 2 2 1 2 2 2 2 1 1 1 2 1 1 1 2 1 1 1 1 2 1 2 2 2 2 2 2 1 1 1 1 1 1 2 1 2 2 1 2 1 2 1 1 2 2 2 2 2 1 1 1 1 2 1 2 2 1 1 2 1 2 2 2 2 1 1 2 2 2 2 2 1 2 2 2 1 1 1 1 2 1 1 1 1 2 1 1 2 1 1 1 2 1 1 2 1 1 1 2 2 2 1 1 1 1 2 1 ...

output:

181732
1 2 1 1 2 0 2 2 0 1 2 1 2 1 1 2 1 2 1 2 0 2 1 2 1 1 100000 1 1 2 1 100000 1 2 2 1 100000 1 2 2 1 2 2 0 2 1 100000 1 2 1 100000 1 2 1 1 100000 1 2 1 2 2 0 2 2 0 1 1 0 1 1 0 2 1 2 2 1 2 1 2 1 1 2 0 2 0 2 1 1 100000 1 2 1 2 2 0 1 2 1 2 2 0 2 1 1 2 0 2 0 2 1 2 0 2 1 1 100000 1 2 1 1 100000 1 2 1 ...

result:

ok 181732

Test #74:

score: 0
Accepted
time: 482ms
memory: 300664kb

input:

1000000 4
1 1 2 3 2 1 1 3 3 2 1 1 1 2 2 1 1 1 3 1 2 1 2 2 2 2 1 3 3 3 2 3 1 2 2 3 3 3 3 2 1 3 1 3 2 1 3 1 3 1 1 1 1 3 2 3 1 1 2 3 2 2 2 3 3 1 2 1 3 2 2 1 1 3 1 2 2 3 3 3 1 1 3 3 1 1 3 1 1 3 1 2 1 2 3 1 3 3 3 3 3 2 1 2 3 3 3 3 3 3 1 1 3 3 3 2 1 3 3 2 2 3 3 2 1 2 1 1 2 1 2 3 3 1 1 3 2 1 3 1 3 3 1 1 1 ...

output:

141411
1 1 2 0 2 1 1 3 0 2 1 100000 1 2 2 1 100000 1 3 1 2 1 2 2 0 2 1 3 0 3 2 3 1 2 2 0 3 3 0 2 1 3 1 3 2 1 3 1 3 1 1 100000 1 3 2 3 1 1 2 0 2 2 0 3 3 1 2 1 3 2 2 100000 1 3 1 2 2 0 3 3 1 100000 3 3 100000 1 3 1 1 3 1 2 1 2 3 1 3 3 0 3 3 2 100000 2 3 3 0 3 0 3 1 1 3 0 3 2 1 3 3 0 2 3 0 2 1 2 1 1 2 ...

result:

ok 141411

Test #75:

score: 0
Accepted
time: 442ms
memory: 300648kb

input:

1000000 4
2 5 4 1 3 2 4 2 1 5 1 3 4 4 3 1 5 5 1 3 1 2 1 1 1 4 2 1 2 1 3 3 2 1 1 1 4 4 4 5 4 2 3 1 5 2 3 2 5 4 5 4 5 4 4 4 4 3 2 1 3 5 2 1 3 3 4 2 4 4 4 2 1 3 3 4 3 1 4 5 3 2 1 2 2 3 5 2 2 5 4 2 4 2 1 5 2 3 2 5 4 5 4 4 5 1 5 2 5 5 4 1 1 5 5 3 5 3 5 1 2 3 3 2 2 3 1 4 4 2 1 2 2 3 1 4 5 2 2 5 1 4 5 5 5 ...

output:

110831
2 5 4 1 3 2 4 2 1 5 1 3 4 0 3 1 5 5 1 3 1 2 1 100000 1 4 2 1 2 1 3 3 2 100000 1 1 100000 4 4 5 4 2 3 1 5 2 3 2 5 4 5 4 5 4 4 100000 4 3 100000 1 3 5 2 1 3 0 4 2 4 4 0 2 1 3 3 0 3 1 4 5 0 2 1 2 2 0 5 2 2 5 4 2 4 2 1 5 2 3 2 5 4 5 4 4 5 1 5 2 5 5 4 100000 1 5 5 3 5 3 5 1 2 0 3 2 2 3 1 4 4 2 100...

result:

ok 110831

Test #76:

score: 0
Accepted
time: 444ms
memory: 300672kb

input:

1000000 4
73902 24657 29945 47651 70638 30463 30502 71425 16136 94793 25129 7902 77636 37951 20762 76560 52899 15325 49434 96315 58872 36729 44053 80542 36837 67685 74615 54992 56654 8374 49144 44892 77812 93378 15842 23603 74334 84938 14085 32716 4711 113 14607 74254 82438 46778 6895 75373 51906 64...

output:

62506
73902 24657 29945 0 70638 30463 30502 71425 16136 94793 25129 7902 77636 37951 20762 76560 52899 15325 49434 96315 58872 36729 44053 80542 36837 67685 74615 54992 56654 8374 49144 44892 77812 93378 15842 23603 0 84938 14085 32716 4711 113 14607 74254 0 46778 6895 75373 51906 64987 20456 81626 ...

result:

ok 62506

Test #77:

score: 0
Accepted
time: 453ms
memory: 300664kb

input:

1000000 5
2 2 2 1 1 1 1 2 2 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 2 2 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 2 2 1 1 1 2 2 1 1 1 2 2 2 2 2 2 2 1 1 1 2 2 1 2 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 1 1 1 2 2 2 1 2 2 1 2 1 1 1 2 2 2 1 1 1 2 1 1 2 2 2 2 1 2 1 2 1 2 1 2 2 2 2 2 1 2 1 1 1 2 1 2 1 ...

output:

103273
2 2 2 1 100000 1 1 2 2 1 1 2 0 2 1 2 1 2 2 2 0 2 1 2 1 1 2 2 1 2 2 1 2 1 1 2 1 2 2 0 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 100000 1 1 2 2 1 100000 1 2 2 1 100000 1 2 2 2 0 2 2 2 1 100000 1 2 2 1 2 1 2 1 1 1 100000 1 2 1 2 1 1 2 1 1 1 100000 1 2 2 2 1 2 2 1 2 1 1 1 2 0 2 1 1 1 2 1 1 2 2 0 2 1 2 1 2 1 ...

result:

ok 103273

Test #78:

score: 0
Accepted
time: 425ms
memory: 300636kb

input:

1000000 5
1 2 3 1 1 2 2 3 1 1 2 1 3 1 2 3 2 2 2 3 2 3 2 3 1 2 3 3 3 2 1 3 3 1 2 3 3 1 3 2 1 2 2 3 2 2 2 1 2 3 1 2 2 1 2 2 2 3 2 2 3 2 3 3 3 3 2 3 2 3 1 1 1 1 3 1 2 1 3 3 1 3 3 3 3 3 2 1 1 2 3 3 2 3 2 1 1 2 2 3 3 1 3 1 2 2 2 1 1 2 3 1 2 1 3 2 1 2 2 1 3 3 2 3 2 2 1 2 3 2 2 1 1 2 1 1 2 3 2 1 3 2 2 2 2 ...

output:

69115
1 2 3 1 1 2 0 3 1 1 2 1 3 1 2 3 2 2 2 3 2 3 2 3 1 2 3 3 0 2 1 3 3 1 2 3 3 1 3 2 1 2 2 3 2 2 2 100000 2 3 1 2 2 1 2 2 0 3 2 2 3 2 3 3 0 3 2 3 2 3 1 1 100000 1 3 1 2 1 3 3 1 3 3 3 0 3 2 1 1 2 0 3 2 3 2 1 1 2 2 0 3 1 3 1 2 2 2 1 100000 2 3 1 2 1 3 2 1 2 2 1 3 3 2 3 2 2 1 2 3 2 2 100000 1 2 1 1 2 ...

result:

ok 69115

Test #79:

score: 0
Accepted
time: 432ms
memory: 300640kb

input:

1000000 5
2 5 1 1 2 5 3 1 2 2 4 4 3 4 4 2 3 5 3 4 3 1 2 2 1 4 1 3 1 3 2 1 4 1 2 2 1 1 5 4 5 5 1 5 2 2 2 5 4 5 2 2 4 5 2 1 5 3 1 3 1 2 4 4 1 2 4 4 5 1 1 2 2 2 3 4 5 2 3 1 5 5 4 1 2 3 3 3 1 5 2 1 4 2 4 4 1 1 5 5 2 5 4 4 3 5 3 2 2 1 2 3 4 1 4 5 4 5 1 5 3 2 1 5 4 4 3 5 5 2 3 4 4 5 4 1 5 1 3 5 1 5 1 3 2 ...

output:

43993
2 5 1 1 2 5 3 1 2 2 0 4 3 4 4 2 3 5 3 4 3 1 2 2 1 4 1 3 1 3 2 1 4 1 2 2 1 1 5 4 5 5 1 5 2 2 2 5 4 5 2 2 4 5 2 1 5 3 1 3 1 2 4 4 1 2 4 0 5 1 1 2 2 0 3 4 5 2 3 1 5 5 4 1 2 3 0 3 1 5 2 1 4 2 4 4 1 1 5 5 2 5 4 4 3 5 3 2 2 100000 2 3 4 1 4 5 4 5 1 5 3 2 1 5 4 4 3 5 5 2 3 4 4 0 4 1 5 1 3 5 1 5 1 3 2...

result:

ok 43993

Test #80:

score: 0
Accepted
time: 484ms
memory: 300892kb

input:

1000000 5
73438 35189 32596 83433 87219 47279 84035 91227 62755 99953 48180 57435 69050 58912 72516 53478 9092 843 64282 45630 11372 42344 67609 59673 62880 41694 14033 49706 90746 14354 16109 13323 2411 68519 30553 25832 9476 89119 74293 15043 15206 44202 55433 41639 83074 4888 62643 73466 77455 79...

output:

13428
73438 35189 32596 83433 87219 47279 84035 91227 62755 99953 48180 57435 69050 58912 72516 53478 9092 843 64282 45630 11372 42344 67609 59673 62880 41694 14033 49706 90746 14354 16109 13323 2411 68519 30553 25832 9476 89119 74293 15043 15206 44202 55433 41639 83074 4888 62643 73466 77455 0 4114...

result:

ok 13428

Test #81:

score: 0
Accepted
time: 448ms
memory: 300660kb

input:

1000000 6
1 2 2 1 2 1 1 1 1 2 2 2 1 2 2 1 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 2 1 1 2 1 2 1 1 1 1 1 1 2 2 1 2 2 2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 1 1 2 1 1 1 2 1 2 2 2 2 2 2 1 1 2 1 1 2 1 1 1 1 1 1 1 2 2 2 1 1 1 2 1 1 2 2 2 1 2 1 2 2 2 2 2 1 2 2 1 2 1 2 1 1 2 1 2 1 1 2 2 1 2 1 2 ...

output:

61147
1 2 2 1 2 1 1 1 1 2 0 2 1 2 2 1 1 2 1 2 1 2 1 2 2 1 2 2 2 1 2 2 1 1 2 1 2 1 1 1 1 100000 1 2 2 1 2 2 2 1 2 1 2 2 1 1 2 2 2 1 2 2 2 1 2 2 2 1 2 1 1 2 1 2 1 1 1 1 100000 1 2 1 1 1 2 1 2 2 2 2 0 2 1 1 2 1 1 2 1 1 1 1 100000 1 1 2 2 2 1 100000 1 2 1 1 2 2 2 1 2 1 2 2 2 0 2 1 2 2 1 2 1 2 1 1 2 1 2 ...

result:

ok 61147

Test #82:

score: 0
Accepted
time: 443ms
memory: 300640kb

input:

1000000 6
3 1 3 2 2 2 3 1 1 2 3 1 1 3 3 3 3 3 1 2 3 2 3 1 1 1 3 3 1 1 3 2 2 1 2 3 3 1 1 2 3 1 3 1 2 1 1 1 3 3 1 2 2 3 3 1 3 2 1 1 1 3 2 1 1 1 3 1 1 3 1 3 3 3 1 2 3 1 3 3 1 1 1 3 3 1 1 2 3 1 3 3 3 2 2 3 3 2 2 3 3 2 2 3 3 1 1 1 3 2 1 2 1 2 2 1 3 2 3 1 3 1 1 3 3 2 1 1 3 3 3 3 1 3 3 3 2 2 1 2 3 3 2 1 3 ...

output:

33182
3 1 3 2 2 2 3 1 1 2 3 1 1 3 3 3 0 3 1 2 3 2 3 1 1 1 3 3 1 1 3 2 2 1 2 3 3 1 1 2 3 1 3 1 2 1 1 1 3 3 1 2 2 3 3 1 3 2 1 1 1 3 2 1 1 1 3 1 1 3 1 3 3 3 1 2 3 1 3 3 1 1 1 3 3 1 1 2 3 1 3 3 3 2 2 3 3 2 2 3 3 2 2 3 3 1 1 1 3 2 1 2 1 2 2 1 3 2 3 1 3 1 1 3 3 2 1 1 3 3 0 3 1 3 3 3 2 2 100000 2 3 3 2 1 3...

result:

ok 33182

Test #83:

score: 0
Accepted
time: 479ms
memory: 300668kb

input:

1000000 6
5 1 2 5 5 2 4 4 4 2 4 3 1 4 2 1 2 1 3 4 3 1 4 5 3 2 2 2 4 3 1 3 2 3 1 2 1 1 1 2 5 3 4 2 3 3 2 1 3 1 5 1 3 3 2 5 5 1 3 5 3 5 2 5 2 5 5 2 3 4 3 3 2 5 1 1 2 4 3 2 3 4 5 5 2 1 3 1 2 3 5 4 5 5 3 1 5 1 4 2 4 3 3 4 3 2 2 2 5 3 1 4 4 3 2 5 3 1 3 4 4 5 4 3 1 2 3 1 2 1 5 1 1 1 1 4 3 1 1 1 1 1 4 1 1 ...

output:

15986
5 1 2 5 5 2 4 4 4 2 4 3 1 4 2 1 2 1 3 4 3 1 4 5 3 2 2 2 4 3 1 3 2 3 1 2 1 1 1 2 5 3 4 2 3 3 2 1 3 1 5 1 3 3 2 5 5 1 3 5 3 5 2 5 2 5 5 2 3 4 3 3 2 5 1 1 2 4 3 2 3 4 5 5 2 1 3 1 2 3 5 4 5 5 3 1 5 1 4 2 4 3 3 4 3 2 2 2 5 3 1 4 4 3 2 5 3 1 3 4 4 5 4 3 1 2 3 1 2 1 5 1 1 1 1 4 3 1 1 1 100000 1 4 1 1...

result:

ok 15986

Test #84:

score: 0
Accepted
time: 460ms
memory: 300636kb

input:

1000000 6
74003 26259 14755 29462 23263 73313 38597 21275 18591 5114 71232 86476 69680 367 44764 39614 84746 96606 90404 84699 64900 28496 20874 49050 59213 6485 72912 34174 14592 10088 2537 81754 56718 52877 46292 29091 35399 82025 14010 87123 15455 98537 96259 10053 74492 43534 8146 62342 93787 85...

output:

2439
74003 26259 14755 29462 23263 73313 38597 21275 18591 5114 71232 86476 69680 367 44764 39614 84746 96606 90404 84699 64900 28496 100000 49050 59213 6485 72912 34174 14592 10088 2537 81754 56718 52877 46292 29091 35399 82025 14010 87123 15455 98537 96259 10053 74492 43534 8146 62342 93787 85045 ...

result:

ok 2439

Test #85:

score: 0
Accepted
time: 435ms
memory: 300644kb

input:

1000000 7
2 1 2 2 1 2 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 1 1 2 2 2 2 2 1 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 1 1 2 1 1 1 1 1 2 2 1 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 2 1 1 2 1 1 1 2 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 2 1 1 1 1 ...

output:

35592
2 1 2 2 1 2 2 2 1 2 1 2 2 1 2 1 2 1 2 2 1 1 1 1 2 2 1 1 2 1 1 2 2 2 2 1 2 1 1 2 2 2 0 2 1 2 1 1 1 2 1 1 1 2 1 2 2 2 1 1 1 100000 1 2 1 1 1 1 1 100000 2 1 1 2 1 2 1 1 1 2 1 1 2 1 2 1 1 2 2 2 1 1 2 1 1 1 2 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 2 1 2 2 2 1 2 2 1 ...

result:

ok 35592

Test #86:

score: 0
Accepted
time: 434ms
memory: 300936kb

input:

1000000 7
3 3 2 3 2 3 3 3 1 1 2 2 1 3 3 3 2 2 3 1 3 1 1 3 2 3 3 3 3 1 3 1 3 1 3 2 1 3 2 1 2 2 2 1 1 3 3 2 2 1 1 3 2 1 1 2 3 3 3 3 3 1 2 3 2 3 1 3 1 3 3 2 1 1 2 1 2 2 3 1 1 1 2 2 2 3 3 3 2 3 3 1 3 1 1 3 3 3 1 1 1 1 1 1 2 3 1 1 2 1 1 2 2 2 3 3 1 1 3 3 2 2 1 2 1 2 3 2 1 1 3 2 2 2 3 2 3 3 3 3 3 2 2 3 2 ...

output:

15263
3 3 2 3 2 3 3 3 1 1 2 2 1 3 3 3 2 2 3 1 3 1 1 3 2 3 3 3 3 1 3 1 3 1 3 2 1 3 2 1 2 2 2 1 1 3 3 2 2 1 1 3 2 1 1 2 3 3 3 0 3 1 2 3 2 3 1 3 1 3 3 2 1 1 2 1 2 2 3 1 1 1 2 2 2 0 3 3 2 3 3 1 3 1 1 3 3 3 1 1 1 100000 1 1 2 3 1 1 2 1 1 2 2 2 0 3 1 1 3 3 2 2 1 2 1 2 3 2 1 1 3 2 2 2 3 2 3 3 3 3 3 0 2 3 2...

result:

ok 15263

Test #87:

score: 0
Accepted
time: 429ms
memory: 300656kb

input:

1000000 7
5 1 4 5 2 5 5 4 2 3 3 1 3 4 3 1 3 5 4 4 4 4 1 2 5 2 4 5 3 5 1 1 4 2 4 5 4 2 4 5 2 4 5 2 4 2 1 2 3 5 3 4 3 4 4 3 3 5 2 3 5 3 2 1 3 5 4 2 4 1 4 3 2 4 5 1 3 2 2 2 5 5 3 4 3 5 4 1 2 3 2 2 2 3 3 1 2 2 3 2 3 3 4 4 5 1 3 2 3 3 2 4 2 5 5 4 5 2 4 2 2 2 2 4 3 3 4 1 3 1 1 5 5 2 5 5 1 2 5 5 5 2 1 4 2 ...

output:

5462
5 1 4 5 2 5 5 4 2 3 3 1 3 4 3 1 3 5 4 4 4 4 1 2 5 2 4 5 3 5 1 1 4 2 4 5 4 2 4 5 2 4 5 2 4 2 1 2 3 5 3 4 3 4 4 3 3 5 2 3 5 3 2 1 3 5 4 2 4 1 4 3 2 4 5 1 3 2 2 2 5 5 3 4 3 5 4 1 2 3 2 2 2 3 3 1 2 2 3 2 3 3 4 4 5 1 3 2 3 3 2 4 2 5 5 4 5 2 4 2 2 2 2 4 3 3 4 1 3 1 1 5 5 2 5 5 1 2 5 5 5 2 1 4 2 2 2 4...

result:

ok 5462

Test #88:

score: 0
Accepted
time: 461ms
memory: 300664kb

input:

1000000 7
74568 26545 17405 85735 50090 90129 93158 42105 75455 19491 3501 36010 71340 21328 96518 16533 40938 71878 96035 23768 8183 34110 44429 28181 85256 71276 21547 28889 48684 96603 69501 40969 90533 28018 71249 31320 80786 65715 53726 69449 16734 52873 37086 87683 65911 91397 63894 40972 9884...

output:

331
74568 26545 17405 85735 50090 90129 93158 42105 75455 19491 3501 36010 71340 21328 96518 16533 40938 71878 96035 23768 8183 34110 44429 28181 85256 71276 21547 28889 48684 96603 69501 40969 90533 28018 71249 31320 80786 65715 53726 69449 16734 52873 37086 87683 65911 91397 63894 40972 98843 9930...

result:

ok 331

Test #89:

score: 0
Accepted
time: 470ms
memory: 300936kb

input:

1000000 8
1 1 2 2 2 1 1 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 1 2 2 2 2 2 2 1 2 1 1 1 1 1 1 2 2 2 2 1 2 2 1 2 1 1 2 1 2 2 2 1 1 1 1 1 1 2 1 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2 1 2 2 2 1 1 1 1 1 1 2 2 2 1 2 2 1 2 2 2 1 1 2 1 1 1 2 1 1 1 2 1 2 2 ...

output:

20792
1 1 2 2 2 1 1 2 2 2 2 1 1 2 2 1 2 1 1 2 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 2 2 1 1 2 2 1 1 2 2 1 1 2 1 1 2 2 2 2 0 2 1 2 1 1 1 1 1 1 2 0 2 2 1 2 2 1 2 1 1 2 1 2 2 2 1 1 1 1 100000 1 2 1 2 2 2 2 1 2 2 2 1 2 2 2 2 1 2 1 2 2 2 1 1 1 1 100000 1 2 2 2 1 2 2 1 2 2 2 1 1 2 1 1 1 2 1 1 1 2 ...

result:

ok 20792

Test #90:

score: 0
Accepted
time: 423ms
memory: 300664kb

input:

1000000 8
1 2 3 1 1 1 3 2 1 2 1 2 2 2 1 1 3 3 2 3 1 2 3 2 2 1 1 2 1 1 2 2 3 2 2 1 3 2 3 1 1 2 2 3 1 2 2 2 3 3 1 1 2 3 2 1 3 3 3 2 3 3 1 3 2 2 3 3 2 1 1 2 3 2 1 1 2 2 2 1 1 3 1 2 2 1 2 2 2 3 3 1 2 2 1 1 2 1 2 3 1 1 2 2 2 2 2 1 3 3 2 2 2 3 2 2 1 2 3 3 2 2 3 1 2 2 1 1 1 2 1 3 1 1 3 1 1 3 1 2 3 1 2 3 3 ...

output:

6690
1 2 3 1 1 1 3 2 1 2 1 2 2 2 1 1 3 3 2 3 1 2 3 2 2 1 1 2 1 1 2 2 3 2 2 1 3 2 3 1 1 2 2 3 1 2 2 2 3 3 1 1 2 3 2 1 3 3 3 2 3 3 1 3 2 2 3 3 2 1 1 2 3 2 1 1 2 2 2 1 1 3 1 2 2 1 2 2 2 3 3 1 2 2 1 1 2 1 2 3 1 1 2 2 2 2 2 1 3 3 2 2 2 3 2 2 1 2 3 3 2 2 3 1 2 2 1 1 1 2 1 3 1 1 3 1 1 3 1 2 3 1 2 3 3 2 1 1...

result:

ok 6690

Test #91:

score: 0
Accepted
time: 441ms
memory: 300672kb

input:

1000000 8
5 3 2 3 1 3 4 3 2 1 4 1 3 1 1 5 5 2 1 4 3 3 2 5 5 3 2 4 1 2 4 4 5 1 2 2 5 3 3 2 5 2 5 2 5 3 5 1 2 1 5 3 1 4 3 1 1 4 2 5 2 1 5 1 4 5 3 5 2 4 1 2 3 3 1 2 2 4 3 2 2 3 1 3 3 3 4 2 2 2 5 2 3 1 1 1 5 5 2 2 5 4 3 5 1 3 2 2 5 4 4 5 1 4 5 4 5 2 5 1 4 1 5 3 3 2 2 3 5 1 3 2 4 2 4 1 3 1 4 3 4 3 5 1 4 ...

output:

1724
5 3 2 3 1 3 4 3 2 1 4 1 3 1 1 5 5 2 1 4 3 3 2 5 5 3 2 4 1 2 4 4 5 1 2 2 5 3 3 2 5 2 5 2 5 3 5 1 2 1 5 3 1 4 3 1 1 4 2 5 2 1 5 1 4 5 3 5 2 4 1 2 3 3 1 2 2 4 3 2 2 3 1 3 3 3 4 2 2 2 5 2 3 1 1 1 5 5 2 2 5 4 3 5 1 3 2 2 5 4 4 5 1 4 5 4 5 2 5 1 4 1 5 3 3 2 2 3 5 1 3 2 4 2 4 1 3 1 4 3 4 3 5 1 4 4 3 4...

result:

ok 1724

Test #92:

score: 0
Accepted
time: 460ms
memory: 300672kb

input:

1000000 8
64888 17614 29273 21518 75888 6946 47721 61907 11828 24652 16306 65051 62754 62782 67736 2668 6347 57396 1667 53620 51465 30508 78231 7312 1054 45284 60963 23603 81746 2584 46712 9401 44842 12375 86989 44824 5681 79113 13935 41530 16983 7209 77913 65314 66546 39261 19643 28819 24393 15351 ...

output:

46
64888 17614 29273 21518 75888 6946 47721 61907 11828 24652 16306 65051 62754 62782 67736 2668 6347 57396 1667 53620 51465 30508 78231 7312 1054 45284 60963 23603 81746 2584 46712 9401 44842 12375 86989 44824 5681 79113 13935 41530 16983 7209 77913 65314 66546 39261 19643 28819 24393 15351 15525 7...

result:

ok 46

Test #93:

score: 0
Accepted
time: 436ms
memory: 300632kb

input:

1000000 9
1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 1 2 2 2 2 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 ...

output:

12341
1 1 2 1 2 1 2 1 1 1 1 1 2 1 1 2 2 1 2 2 2 1 1 1 1 2 2 2 1 2 2 1 2 2 2 1 1 1 2 1 1 1 1 2 2 2 2 1 1 2 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1 1 2 1 2 2 2 1 1 1 1 1 2 2 2 0 2 2 2 1 2 2 2 1 1 1 2 2 1 2 2 1 1 2 2 2 2 2 1 2 2 2 1 2 2 2 1 1 2 1 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 1 1 1 1 2 1 2 1 1 2 1 1 2 2 1 1 1 ...

result:

ok 12341

Test #94:

score: 0
Accepted
time: 427ms
memory: 300692kb

input:

1000000 9
3 3 1 2 3 1 2 1 2 3 2 3 1 1 3 3 2 2 3 2 2 1 2 1 1 1 2 2 2 3 1 1 1 2 1 3 3 2 1 1 1 1 1 2 2 3 3 1 2 3 1 2 3 2 2 2 2 3 3 1 2 1 3 2 3 3 2 1 3 1 3 2 3 3 3 1 3 3 1 1 3 1 3 2 1 1 1 3 2 1 3 3 1 2 1 2 2 1 3 2 2 1 1 3 1 2 2 2 2 1 3 2 2 2 3 3 3 3 2 2 3 3 2 1 1 1 2 3 3 2 1 1 2 1 3 3 3 2 1 2 2 3 3 2 2 ...

output:

2821
3 3 1 2 3 1 2 1 2 3 2 3 1 1 3 3 2 2 3 2 2 1 2 1 1 1 2 2 2 3 1 1 1 2 1 3 3 2 1 1 1 1 1 2 2 0 3 1 2 3 1 2 3 2 2 2 2 3 3 1 2 1 3 2 3 3 2 1 3 1 3 2 3 3 3 1 3 3 1 1 3 1 3 2 1 1 1 3 2 1 3 3 1 2 1 2 2 1 3 2 2 1 1 3 1 2 2 2 2 1 3 2 2 2 3 3 3 3 2 2 3 3 2 1 1 1 2 3 3 2 1 1 2 1 3 3 3 2 1 2 2 3 3 2 2 2 1 1...

result:

ok 2821

Test #95:

score: 0
Accepted
time: 442ms
memory: 300724kb

input:

1000000 9
4 4 2 5 4 1 5 3 4 1 5 2 1 5 1 1 2 5 3 4 4 2 5 1 2 5 3 1 2 5 1 1 4 5 1 1 2 5 4 2 5 4 2 5 2 5 3 2 2 5 3 3 1 4 5 4 4 2 5 3 5 3 2 1 5 3 4 1 3 1 3 4 3 1 4 2 4 1 3 3 4 3 4 5 4 4 3 1 4 2 2 2 4 1 1 2 2 4 2 4 1 4 3 4 4 2 4 2 3 5 5 1 5 1 2 2 4 5 5 4 1 1 5 5 1 1 2 3 1 5 4 3 2 3 2 3 2 2 3 5 5 4 1 5 1 ...

output:

510
4 4 2 5 4 1 5 3 4 1 5 2 1 5 1 1 2 5 3 4 4 2 5 1 2 5 3 1 2 5 1 1 4 5 1 1 2 5 4 2 5 4 2 5 2 5 3 2 2 5 3 3 1 4 5 4 4 2 5 3 5 3 2 1 5 3 4 1 3 1 3 4 3 1 4 2 4 1 3 3 4 3 4 5 4 4 3 1 4 2 2 2 4 1 1 2 2 4 2 4 1 4 3 4 4 2 4 2 3 5 5 1 5 1 2 2 4 5 5 4 1 1 5 5 1 1 2 3 1 5 4 3 2 3 2 3 2 2 3 5 5 4 1 5 1 1 4 4 ...

result:

ok 510

Test #96:

score: 0
Accepted
time: 443ms
memory: 300928kb

input:

1000000 9
74670 17901 21678 77792 2715 32980 92036 81708 67663 29812 39357 23802 73630 4237 19491 79586 72784 53160 26760 2935 4993 25877 21250 86441 7633 99829 19844 8072 15839 8563 33140 77832 78657 87515 11946 47053 40821 62802 44434 23856 27478 51297 28986 53191 47719 77906 75391 17696 40725 402...

output:

4
74670 17901 21678 77792 2715 32980 92036 81708 67663 29812 39357 23802 73630 4237 19491 79586 72784 53160 26760 2935 4993 25877 21250 86441 7633 99829 19844 8072 15839 8563 33140 77832 78657 87515 11946 47053 40821 62802 44434 23856 27478 51297 28986 53191 47719 77906 75391 17696 40725 40235 56708...

result:

ok 4

Test #97:

score: 0
Accepted
time: 412ms
memory: 300892kb

input:

1000000 10
2 2 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 2 1 2 1...

output:

7121
2 2 1 2 1 2 1 2 2 2 2 1 2 1 1 2 2 1 1 1 2 2 1 1 2 2 2 2 2 2 1 2 2 2 1 1 2 2 2 1 1 1 2 1 1 2 1 2 1 2 2 2 1 1 2 2 2 1 2 1 1 1 1 1 2 2 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 1 2 1 2 1 2 1 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 1 2 1 1 2 2 1 1 1 2 1 2 2 1 2 1 1 2 2 2 1 2 1 1 2 1...

result:

ok 7121

Test #98:

score: 0
Accepted
time: 440ms
memory: 300596kb

input:

1000000 10
1 2 3 1 2 2 3 1 1 1 3 1 2 3 3 3 2 1 1 3 2 2 2 1 3 3 2 3 3 1 1 2 2 3 3 1 2 1 2 1 1 2 1 2 3 3 2 2 1 1 3 3 3 2 3 1 3 3 1 1 3 3 2 1 1 3 3 3 1 3 1 2 3 1 3 1 2 3 2 1 2 2 2 3 1 2 1 2 1 1 3 2 3 3 2 2 2 3 3 3 2 2 2 2 2 2 3 3 2 2 3 1 2 1 1 2 3 1 3 3 1 3 2 3 1 2 2 1 3 2 3 2 1 2 1 3 1 3 1 2 2 2 2 2 2...

output:

1196
1 2 3 1 2 2 3 1 1 1 3 1 2 3 3 3 2 1 1 3 2 2 2 1 3 3 2 3 3 1 1 2 2 3 3 1 2 1 2 1 1 2 1 2 3 3 2 2 1 1 3 3 3 2 3 1 3 3 1 1 3 3 2 1 1 3 3 3 1 3 1 2 3 1 3 1 2 3 2 1 2 2 2 3 1 2 1 2 1 1 3 2 3 3 2 2 2 3 3 3 2 2 2 2 2 2 3 3 2 2 3 1 2 1 1 2 3 1 3 3 1 3 2 3 1 2 2 1 3 2 3 2 1 2 1 3 1 3 1 2 2 2 2 2 2 1 1 1...

result:

ok 1196

Test #99:

score: 0
Accepted
time: 427ms
memory: 300664kb

input:

1000000 10
5 2 3 2 3 3 5 2 2 3 4 3 4 4 1 4 5 1 2 4 1 2 3 2 1 5 2 4 5 4 1 2 1 4 2 4 4 2 3 5 2 1 4 1 4 5 3 4 1 5 2 2 2 2 5 3 3 1 5 1 4 1 1 2 5 1 5 4 2 2 2 5 3 5 1 5 2 3 5 5 4 2 5 2 4 2 5 5 4 1 2 5 1 3 5 2 4 1 4 1 5 2 5 1 5 1 1 1 1 2 2 2 5 5 2 3 4 2 5 3 1 2 1 2 1 1 4 5 5 3 4 3 1 4 1 2 3 4 2 2 4 4 3 1 4...

output:

159
5 2 3 2 3 3 5 2 2 3 4 3 4 4 1 4 5 1 2 4 1 2 3 2 1 5 2 4 5 4 1 2 1 4 2 4 4 2 3 5 2 1 4 1 4 5 3 4 1 5 2 2 2 2 5 3 3 1 5 1 4 1 1 2 5 1 5 4 2 2 2 5 3 5 1 5 2 3 5 5 4 2 5 2 4 2 5 5 4 1 2 5 1 3 5 2 4 1 4 1 5 2 5 1 5 1 1 1 1 2 2 2 5 5 2 3 4 2 5 3 1 2 1 2 1 1 4 5 5 3 4 3 1 4 1 2 3 4 2 2 4 4 3 1 4 5 5 4 ...

result:

ok 159

Test #100:

score: 0
Accepted
time: 481ms
memory: 300720kb

input:

1000000 10
29720 95762 51897 34197 88261 66849 3842 20393 67763 77068 26485 70371 71113 22875 56985 65806 86620 81668 65946 28761 91870 16202 56178 74102 60597 32538 92117 63862 94724 18813 60575 46354 66747 99448 46604 43867 63295 62731 96896 91539 39755 34480 80384 36673 10091 41419 89759 19258 39...

output:

0
29720 95762 51897 34197 88261 66849 3842 20393 67763 77068 26485 70371 71113 22875 56985 65806 86620 81668 65946 28761 91870 16202 56178 74102 60597 32538 92117 63862 94724 18813 60575 46354 66747 99448 46604 43867 63295 62731 96896 91539 39755 34480 80384 36673 10091 41419 89759 19258 39509 60881...

result:

ok 0

Test #101:

score: 0
Accepted
time: 427ms
memory: 300624kb

input:

1000000 1000
1 2 2 2 3 1 2 2 1 3 1 2 2 3 1 1 1 3 1 1 3 1 2 3 1 1 2 2 3 1 2 3 3 2 3 2 1 1 2 3 2 1 1 2 1 2 2 1 3 1 1 1 2 1 1 1 2 2 2 3 3 3 2 1 2 2 2 3 3 1 2 3 1 1 2 1 2 2 3 1 2 3 3 3 1 1 1 1 2 2 2 1 2 3 2 2 3 1 3 1 2 1 1 3 2 3 3 2 3 2 3 1 3 2 1 1 3 1 2 3 1 2 1 3 3 1 3 3 3 1 2 1 3 1 3 1 1 2 3 1 1 3 1 3...

output:

0
1 2 2 2 3 1 2 2 1 3 1 2 2 3 1 1 1 3 1 1 3 1 2 3 1 1 2 2 3 1 2 3 3 2 3 2 1 1 2 3 2 1 1 2 1 2 2 1 3 1 1 1 2 1 1 1 2 2 2 3 3 3 2 1 2 2 2 3 3 1 2 3 1 1 2 1 2 2 3 1 2 3 3 3 1 1 1 1 2 2 2 1 2 3 2 2 3 1 3 1 2 1 1 3 2 3 3 2 3 2 3 1 3 2 1 1 3 1 2 3 1 2 1 3 3 1 3 3 3 1 2 1 3 1 3 1 1 2 3 1 1 3 1 3 3 1 2 1 3 ...

result:

ok 0

Test #102:

score: 0
Accepted
time: 421ms
memory: 300892kb

input:

1000000 1000000
3 3 1 1 2 2 1 2 3 3 1 2 3 3 1 2 1 1 2 2 3 1 2 2 1 2 3 3 1 1 3 3 2 1 1 2 1 2 3 3 3 2 3 3 2 3 3 2 3 3 2 1 2 3 1 3 1 2 3 1 3 3 2 1 2 3 1 2 1 2 1 2 2 3 3 3 3 2 1 3 2 1 2 2 3 3 1 2 2 2 3 1 2 3 3 1 2 1 2 1 2 1 3 1 3 2 2 3 1 3 3 3 2 1 1 1 2 2 1 2 2 1 3 1 3 3 2 2 1 3 3 3 2 1 1 2 3 1 2 3 2 3 ...

output:

0
3 3 1 1 2 2 1 2 3 3 1 2 3 3 1 2 1 1 2 2 3 1 2 2 1 2 3 3 1 1 3 3 2 1 1 2 1 2 3 3 3 2 3 3 2 3 3 2 3 3 2 1 2 3 1 3 1 2 3 1 3 3 2 1 2 3 1 2 1 2 1 2 2 3 3 3 3 2 1 3 2 1 2 2 3 3 1 2 2 2 3 1 2 3 3 1 2 1 2 1 2 1 3 1 3 2 2 3 1 3 3 3 2 1 1 1 2 2 1 2 2 1 3 1 3 3 2 2 1 3 3 3 2 1 1 2 3 1 2 3 2 3 1 3 2 2 3 2 1 ...

result:

ok 0

Test #103:

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

input:

100 3
44050 44050 44050 84115 10917 10917 36945 36945 33064 33064 33541 26934 26934 26934 41932 27043 27043 62590 61829 61829 61829 67417 26046 26046 26046 84640 63919 90649 90649 90649 21857 90003 90003 50162 50162 97151 94354 96280 96280 96280 13715 69365 69365 45708 71490 26828 26828 92733 92733 ...

output:

34
44050 100000 44050 84115 0 10917 0 36945 33064 100000 33541 100000 26934 100000 41932 100000 27043 62590 61829 100000 61829 67417 26046 100000 26046 84640 63919 90649 0 90649 21857 90003 0 50162 0 97151 94354 96280 0 96280 13715 69365 0 45708 0 26828 0 92733 0 41594 0 44184 0 22917 0 39582 0 1069...

result:

ok 34

Test #104:

score: 0
Accepted
time: 5ms
memory: 28328kb

input:

100 4
75479 75479 57768 57768 57768 82480 82480 61474 61474 62606 841 841 52703 52703 52703 26964 26964 62664 37045 37045 37045 54691 32834 32834 85334 85334 85334 84211 84211 86129 86129 627 79180 79180 79180 6383 93722 93722 93722 93722 26623 43077 43077 40631 40631 40631 93190 93190 26381 26381 4...

output:

20
75479 75479 57768 100000 57768 82480 82480 0 61474 62606 841 841 52703 0 52703 26964 26964 62664 37045 100000 37045 54691 32834 32834 85334 0 85334 84211 84211 100000 86129 627 79180 0 79180 6383 93722 93722 0 93722 26623 43077 43077 40631 100000 40631 93190 93190 0 26381 48629 0 48629 38655 9320...

result:

ok 20

Test #105:

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

input:

100 5
91458 91458 91458 19817 19817 96942 96942 96942 36513 36513 36804 36804 36804 36804 1444 1444 78133 78133 78133 78133 62866 90631 90631 90631 60222 60222 70799 70799 3965 3965 3965 3965 13733 4165 4165 4165 4165 61944 56651 56651 56651 57588 20131 20131 20131 20131 22325 22325 4324 4324 4324 4...

output:

17
91458 91458 91458 19817 100000 96942 96942 96942 100000 36513 36804 36804 0 36804 1444 1444 78133 78133 0 78133 62866 90631 90631 90631 0 60222 70799 70799 3965 3965 100000 3965 13733 4165 4165 100000 4165 61944 56651 56651 56651 57588 20131 20131 100000 20131 22325 22325 4324 100000 4324 40166 2...

result:

ok 17

Test #106:

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

input:

100 6
58143 45190 45190 45190 45190 91580 91580 26217 26217 26217 88612 88612 88612 88612 33944 33944 33944 48410 48410 48410 7416 7416 7416 7416 88395 88395 19222 19222 19222 19222 88526 56485 56485 56485 56485 56485 92404 92404 46257 46257 46257 46257 46257 63052 41533 41533 41533 41533 41533 5763...

output:

14
58143 45190 45190 45190 45190 100000 91580 26217 26217 26217 88612 88612 0 88612 33944 33944 33944 48410 48410 0 7416 7416 7416 7416 0 88395 19222 19222 19222 19222 88526 56485 56485 56485 100000 56485 92404 92404 46257 46257 46257 100000 46257 63052 41533 41533 41533 100000 41533 57639 18879 188...

result:

ok 14

Test #107:

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

input:

100 7
73756 73756 73756 73756 79039 79039 79039 79039 59396 59396 67191 67191 67191 67191 67191 3847 3847 3847 5978 5978 5978 5978 5978 4136 37181 37181 37181 37181 37181 25589 25589 25589 66647 66647 66647 66647 66647 42222 42222 42222 99178 99178 99178 14582 14582 14582 14582 14582 61035 61035 146...

output:

11
73756 73756 73756 73756 79039 79039 0 79039 59396 59396 67191 67191 67191 0 67191 3847 3847 3847 5978 5978 5978 0 5978 4136 37181 37181 37181 37181 37181 25589 100000 25589 66647 66647 66647 66647 66647 42222 100000 42222 99178 99178 99178 14582 14582 14582 100000 14582 61035 61035 14694 14694 14...

result:

ok 11

Test #108:

score: 0
Accepted
time: 5ms
memory: 28464kb

input:

100 8
2179 2179 2179 70321 70321 70321 70321 70321 70321 60420 60420 84028 84028 84028 84028 84028 84028 82713 97309 97309 97309 97309 97309 97309 97309 97309 53732 78308 78308 78308 78308 78308 78308 78308 78308 22885 59214 59214 59214 59214 59214 59214 59214 59214 38569 59516 59516 59516 59516 595...

output:

11
2179 2179 2179 70321 70321 70321 70321 0 70321 60420 60420 84028 84028 84028 84028 0 84028 82713 97309 97309 97309 97309 97309 97309 0 97309 53732 78308 78308 78308 78308 78308 78308 0 78308 22885 59214 59214 59214 59214 59214 59214 0 59214 38569 59516 59516 59516 59516 59516 59516 0 22453 69867 ...

result:

ok 11

Test #109:

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

input:

100 9
80610 80610 80610 80610 61010 61010 61010 61010 61010 61010 94331 94331 75791 75791 75791 75791 75791 75791 96581 96581 96581 14769 14769 14769 14769 14769 14769 14769 87232 87232 66421 66421 66421 66421 66421 66421 99452 99452 99452 99452 94957 94957 94957 94957 94957 94957 97413 97413 75224 ...

output:

9
80610 80610 80610 80610 61010 61010 61010 61010 100000 61010 94331 94331 75791 75791 75791 75791 75791 75791 96581 96581 0 14769 14769 14769 14769 14769 14769 14769 0 87232 66421 66421 66421 66421 66421 66421 99452 99452 0 99452 94957 94957 94957 94957 94957 94957 97413 97413 75224 75224 75224 752...

result:

ok 9

Test #110:

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

input:

100 10
95150 95150 95150 95150 95150 76320 76320 76320 76320 76320 78962 78962 78962 78962 78962 78962 73978 73978 73978 73978 79890 79890 79890 79890 79890 79890 79890 8557 8557 79719 79719 79719 79719 79719 79719 79719 79719 64544 64544 64544 78917 78917 78917 78917 78917 78917 78917 15369 15369 1...

output:

8
95150 95150 95150 95150 95150 76320 76320 76320 100000 76320 78962 78962 78962 78962 78962 78962 73978 73978 100000 73978 79890 79890 79890 79890 79890 79890 79890 8557 8557 79719 79719 79719 79719 79719 79719 0 79719 64544 64544 64544 78917 78917 78917 78917 78917 0 78917 15369 15369 15369 15369 ...

result:

ok 8

Test #111:

score: 0
Accepted
time: 467ms
memory: 300940kb

input:

1000000 3
65305 65305 65305 5886 24136 24136 22777 26122 21328 93996 93996 23418 75301 61412 61412 73277 73277 17473 94729 94729 94729 4655 59070 59070 3157 34183 28888 85350 85350 85350 62032 90685 90685 42909 42909 53629 35535 35535 35535 43246 12688 12688 65114 4307 44693 33769 64625 64625 64625 ...

output:

369852
0 65305 0 5886 0 24136 22777 26122 21328 93996 0 23418 0 61412 0 73277 0 17473 0 94729 0 4655 0 59070 3157 34183 28888 85350 0 85350 62032 90685 0 42909 0 53629 35535 100000 35535 43246 0 12688 0 4307 0 33769 0 64625 0 54809 0 85056 0 29065 0 14764 0 11880 0 60031 24492 31049 17667 65075 0 65...

result:

ok 369852

Test #112:

score: 0
Accepted
time: 449ms
memory: 300944kb

input:

1000000 4
38820 55080 55080 55080 1659 1659 30334 30334 1240 56318 56318 56318 2305 9619 9619 4465 98235 98235 98235 98235 61364 86296 86296 86296 86296 75954 88684 88684 88684 88684 18937 49146 49146 49146 49146 6451 54118 54118 54118 35809 83744 83744 83744 67853 70057 70057 18950 18950 18950 5190...

output:

200786
38820 55080 55080 0 1659 1659 0 30334 1240 56318 0 56318 2305 9619 9619 4465 98235 98235 0 98235 61364 86296 86296 0 86296 75954 88684 88684 0 88684 18937 49146 49146 0 49146 6451 54118 0 54118 35809 83744 0 83744 67853 70057 70057 18950 100000 18950 51904 51904 0 47300 47931 0 47931 23909 69...

result:

ok 200786

Test #113:

score: 0
Accepted
time: 445ms
memory: 300640kb

input:

1000000 5
17928 17928 17928 45606 45606 45606 43325 43325 43325 83760 83760 83760 35296 35296 69066 69066 42719 42719 42719 42719 97285 71564 71564 71564 71564 98079 98079 92305 92305 98844 98844 98844 92204 98959 98959 98959 98959 98959 11986 75162 75162 75162 75162 2065 52331 52331 52331 52331 304...

output:

160948
17928 17928 17928 45606 0 45606 43325 43325 43325 83760 0 83760 35296 35296 69066 69066 42719 42719 100000 42719 97285 71564 71564 100000 71564 98079 98079 92305 92305 98844 0 98844 92204 98959 98959 98959 0 98959 11986 75162 75162 0 75162 2065 52331 52331 0 52331 30490 57947 57947 0 57947 17...

result:

ok 160948

Test #114:

score: 0
Accepted
time: 464ms
memory: 300724kb

input:

1000000 6
4100 4100 93128 93128 93128 93128 93128 39233 39233 62189 62189 62189 62189 62189 28220 28220 76491 76491 76491 76491 48156 90219 90219 90219 90219 28499 28499 51452 51452 51452 51452 32523 32523 59073 59073 59073 59073 40021 87191 87191 87191 87191 28526 28526 69005 69005 69005 11417 1141...

output:

134414
4100 4100 93128 93128 93128 0 93128 39233 39233 62189 62189 62189 0 62189 28220 28220 76491 76491 0 76491 48156 90219 90219 90219 90219 28499 100000 51452 51452 51452 51452 100000 32523 59073 59073 59073 59073 40021 87191 87191 87191 87191 0 28526 69005 69005 69005 11417 11417 100000 11417 54...

result:

ok 134414

Test #115:

score: 0
Accepted
time: 461ms
memory: 300664kb

input:

1000000 7
53309 53309 53309 53309 47029 47029 47029 47029 47826 47826 47826 27176 27176 27176 27176 95424 95424 84539 84539 84539 84539 84539 84539 90002 23944 23944 23944 23944 23944 23944 88642 88642 72335 72335 72335 72335 72335 87168 87168 87168 37185 37185 37185 39588 39588 39588 39588 7840 784...

output:

115509
53309 53309 53309 53309 47029 47029 100000 47029 47826 47826 47826 27176 27176 100000 27176 95424 95424 84539 84539 84539 84539 100000 84539 90002 23944 23944 23944 23944 100000 23944 88642 88642 72335 72335 72335 100000 72335 87168 87168 87168 37185 37185 37185 39588 39588 0 39588 7840 7840 ...

result:

ok 115509

Test #116:

score: 0
Accepted
time: 442ms
memory: 300644kb

input:

1000000 8
65189 65189 65189 5862 5862 5862 5862 5862 91293 91293 91293 91293 30468 30468 30468 83963 83963 83963 83963 83963 83963 58821 58821 86999 86999 86999 86999 86999 47179 47179 47179 47179 49881 49881 49881 49881 49881 28297 28297 81578 81578 81578 81578 81578 81578 45725 70585 70585 70585 7...

output:

100958
65189 65189 65189 5862 5862 5862 100000 5862 91293 91293 91293 91293 30468 30468 30468 83963 83963 83963 83963 0 83963 58821 58821 86999 86999 86999 86999 86999 47179 47179 100000 47179 49881 49881 49881 49881 49881 28297 28297 81578 81578 81578 81578 0 81578 45725 70585 70585 70585 70585 705...

result:

ok 100958

Test #117:

score: 0
Accepted
time: 453ms
memory: 300644kb

input:

1000000 9
75670 75670 75670 75670 96772 96772 96772 96772 96772 43495 43495 43495 92982 92982 92982 92982 92982 92982 86750 86750 86750 86750 96162 96162 96162 96162 14239 14239 14239 14239 14239 89246 89246 89246 89246 73012 73012 73012 73012 97023 97023 97023 97023 97023 74594 74594 74594 76197 76...

output:

89752
75670 75670 75670 75670 96772 96772 96772 0 96772 43495 43495 43495 92982 92982 92982 92982 0 92982 86750 86750 86750 86750 96162 96162 96162 96162 14239 14239 14239 100000 14239 89246 89246 89246 89246 73012 73012 73012 73012 97023 97023 97023 0 97023 74594 74594 74594 76197 76197 76197 76197...

result:

ok 89752

Test #118:

score: 0
Accepted
time: 445ms
memory: 300656kb

input:

1000000 10
10384 10384 10384 10384 10384 10384 55625 55625 55625 55625 55625 49001 49001 49001 49001 80908 80908 80908 80908 80908 80908 80908 75246 75246 88508 88508 88508 88508 88508 88508 88508 30478 30478 98675 98675 98675 98675 98675 98675 98675 98675 3726 3726 7176 7176 7176 7176 7176 7176 717...

output:

80632
10384 10384 10384 10384 10384 10384 55625 55625 55625 0 55625 49001 49001 49001 49001 80908 80908 80908 80908 80908 0 80908 75246 75246 88508 88508 88508 88508 88508 88508 88508 30478 30478 98675 98675 98675 98675 98675 98675 0 98675 3726 3726 7176 7176 7176 7176 7176 7176 7176 481 481 100000 ...

result:

ok 80632

Test #119:

score: 0
Accepted
time: 434ms
memory: 300592kb

input:

1000000 100
67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 ...

output:

8012
67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 67178 6...

result:

ok 8012

Test #120:

score: 0
Accepted
time: 445ms
memory: 300632kb

input:

1000000 1000
7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 77...

output:

809
7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7790 7...

result:

ok 809

Test #121:

score: 0
Accepted
time: 446ms
memory: 300664kb

input:

1000000 10000
1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1...

output:

78
1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 1416 14...

result:

ok 78

Test #122:

score: 0
Accepted
time: 395ms
memory: 300644kb

input:

1000000 999998
20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 200...

output:

1
20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 20069 2006...

result:

ok 1

Test #123:

score: 0
Accepted
time: 430ms
memory: 300644kb

input:

1000000 999999
71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 715...

output:

1
71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 71561 7156...

result:

ok 1

Test #124:

score: 0
Accepted
time: 421ms
memory: 300896kb

input:

1000000 1000000
25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25...

output:

0
25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 25798 2579...

result:

ok 0