QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#129725#2425. The Collection Gamebashkort100 ✓6ms3784kbC++201.0kb2023-07-22 22:42:262023-07-22 22:42:28

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-22 22:42:28]
  • 评测
  • 测评结果:100
  • 用时:6ms
  • 内存:3784kb
  • [2023-07-22 22:42:26]
  • 提交

answer

#include "swaps.h"
#include <bits/stdc++.h>

using namespace std;

void solve(int n, int V) {
    vector<int> ord(n);
    iota(ord.begin(), ord.end(), 1);

    vector<pair<int, int>> pairs;

    auto add = [&](int i, int j) {
        schedule(ord[i], ord[j]);
        pairs.emplace_back(i, j);
    };
    auto sort = [&]() {
        vector<int> v = visit();
        for (int k = 0; k < size(v); ++k) {
            if (!v[k]) {
                swap(ord[pairs[k].first], ord[pairs[k].second]);
            }
        }
        pairs.clear();
    };

    int N = 1 << __lg(n - 1) + 1;
    for (int s = 1; s < N; s <<= 1) {
        for (int k = s; k > 0; k >>= 1) {
            for (int j = k % s; j + k < n; j += 2 * k) {
                for (int i = 0; i < k && j + k + i < n; ++i) {
                    if ((j + i) / (2 * s) == (j + i + k) / (2 * s)) {
                        add(j + i, j + i + k);
                    }
                }
            }
            sort();
        }
    }

    answer(ord);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

4 50
2 0 0
2 1 0
1 0

output:

946149565 1 2
946149565 3 4
547293220
946149565 2 4
946149565 1 3
547293220
946149565 3 4
547293220
345685428 2 4 3 1

result:

points 1.0 points  1.0 Correct

Subtask #2:

score: 5
Accepted

Test #2:

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

input:

10 5000
5 0 0 0 0 0
4 0 0 1 1
2 0 0
4 0 1 1 0
2 0 0
3 0 0 0
2 1 1
2 0 0
4 1 1 0 0
4 1 0 1 1

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
547293220
946149565 2 4
946149565 1 3
946149565 6 8
946149565 5 7
547293220
946149565 3 2
946149565 5 8
547293220
946149565 4 6
946149565 2 8
946149565 3 5
946149565 1 7
547293220
946149565 3 4
946149565 7 8
547293220
946149565 2...

result:

points 1.0 points  1.0 Correct

Test #3:

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

input:

100 5000
50 0 1 0 1 1 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 1 1 1 1 1 0
50 0 0 0 1 1 1 0 0 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1
25 0 0 1 1 0 1 0 1 0 0 0 1 0 0 0 1 0 0 0 1 0 1 1 1 0
48 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #4:

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

input:

250 5000
125 0 0 0 1 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 0 0 0 1 0 0 1 1 1 1 0 0
124 1 0 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #5:

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

input:

500 5000
250 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 1 1 1 0 0 1 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #6:

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

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #7:

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

input:

500 5000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #8:

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

input:

500 5000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #9:

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

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #3:

score: 10
Accepted

Test #10:

score: 10
Accepted
time: 4ms
memory: 3716kb

input:

500 1000
250 0 0 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 1 0 1 1 1 0 0 1 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #11:

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

input:

500 1000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #12:

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

input:

500 1000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #13:

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

input:

500 1000
250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #14:

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

input:

500 1000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #4:

score: 3
Accepted

Test #15:

score: 3
Accepted
time: 1ms
memory: 3688kb

input:

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

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
547293220
946149565 1 3
946149565 2 4
946149565 5 7
946149565 6 8
547293220
946149565 2 3
946149565 6 7
547293220
946149565 1 5
946149565 2 6
946149565 3 7
946149565 4 8
547293220
946149565 3 5
946149565 4 6
547293220
946149565 2...

result:

points 1.0 points  1.0 Correct

Test #16:

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

input:

100 5000
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
25 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
48 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #5:

score: 2
Accepted

Dependency #4:

100%
Accepted

Test #17:

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

input:

10 5000
5 1 0 1 0 0
4 0 1 1 0
2 1 0
4 0 1 1 1
2 0 0
3 1 1 0
2 0 1
2 0 0
4 0 0 1 0
4 1 0 1 1

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
547293220
946149565 1 4
946149565 2 3
946149565 5 8
946149565 6 7
547293220
946149565 2 1
946149565 7 8
547293220
946149565 4 5
946149565 2 8
946149565 1 7
946149565 3 6
547293220
946149565 1 4
946149565 3 8
547293220
946149565 2...

result:

points 1.0 points  1.0 Correct

Test #18:

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

input:

100 5000
50 0 0 0 0 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1
50 0 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 0
25 1 0 1 0 1 0 1 0 0 1 0 0 1 0 0 0 1 1 1 0 0 0 1 1 1
48 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #6:

score: 9
Accepted

Dependency #4:

100%
Accepted

Test #19:

score: 9
Accepted
time: 0ms
memory: 3704kb

input:

250 5000
125 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
124 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #20:

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

input:

500 5000
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #7:

score: 6
Accepted

Dependency #2:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #21:

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

input:

250 5000
125 0 0 0 1 1 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1
124 0 1 1 0 1 0 1 0 1 0 0 0 1 0 0 1 0...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Test #22:

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

input:

500 5000
250 0 0 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 0 1 0 1 0 0 0 1 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 1 0 0 1 1 0 1 0 1 1 0 0 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #8:

score: 9
Accepted

Dependency #4:

100%
Accepted

Dependency #6:

100%
Accepted

Test #23:

score: 9
Accepted
time: 2ms
memory: 3716kb

input:

500 500
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #9:

score: 6
Accepted

Dependency #3:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #24:

score: 6
Accepted
time: 4ms
memory: 3720kb

input:

500 500
250 0 0 0 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 1 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 1 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 0 1 0 0 0 ...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #10:

score: 21
Accepted

Dependency #8:

100%
Accepted

Test #25:

score: 21
Accepted
time: 4ms
memory: 3720kb

input:

500 100
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #11:

score: 14
Accepted

Dependency #9:

100%
Accepted

Dependency #10:

100%
Accepted

Test #26:

score: 14
Accepted
time: 2ms
memory: 3720kb

input:

500 100
250 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 0 1 1 ...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #12:

score: 9
Accepted

Dependency #10:

100%
Accepted

Test #27:

score: 9
Accepted
time: 5ms
memory: 3776kb

input:

500 50
250 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct

Subtask #13:

score: 6
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Dependency #10:

100%
Accepted

Dependency #11:

100%
Accepted

Dependency #12:

100%
Accepted

Test #28:

score: 6
Accepted
time: 1ms
memory: 3664kb

input:

500 50
250 1 1 1 0 1 1 0 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 0 1 1 1 0 1...

output:

946149565 1 2
946149565 3 4
946149565 5 6
946149565 7 8
946149565 9 10
946149565 11 12
946149565 13 14
946149565 15 16
946149565 17 18
946149565 19 20
946149565 21 22
946149565 23 24
946149565 25 26
946149565 27 28
946149565 29 30
946149565 31 32
946149565 33 34
946149565 35 36
946149565 37 38
94614...

result:

points 1.0 points  1.0 Correct