QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#241355#6442. Secret of Tianqiu ValleylhhxxxxxAC ✓295ms9768kbC++235.3kb2023-11-06 03:19:282023-11-06 03:19:29

Judging History

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

  • [2023-11-06 03:19:29]
  • 评测
  • 测评结果:AC
  • 用时:295ms
  • 内存:9768kb
  • [2023-11-06 03:19:28]
  • 提交

answer

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ull = unsigned long long;

#define IOS ios::sync_with_stdio(0);cin.tie(0);
#define endl "\n"
#define rep(i, a, b) for(int i = (a); i < (b); ++i)


void solve() {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> vis(n);
    vector<int> ans(n);
    auto is0 = [&](int i) {
        return !((s[i] - '0') ^ (vis[i] % 2));
    };
    rep(i, 0, n - 2) {
        if (is0(i)) {
            vis[i]++;
            vis[i + 1]++;
            vis[i + 2]++;
            ans[i + 1]++;
        }
    }
    int k = n / 3;
    int last2 = (1 - is0(n - 2)) * 2 + (1 - is0(n - 1));
    switch (n % 3) {
        case 0: {
            switch (last2) {
                case 0b00:
                case 0b01:
                case 0b10: {
                    cout << "0\n";
                    return;
                }
                case 0b11: {
                    rep(i, 0, n) {
                        ans[i]++;
                    }
                    break;
                }
            }
            break;
        }
        case 1: {
            switch (last2) {
                case 0b00: {
                    rep(i, 0, k) {
                        ans[3 * i + 2]++;
                    }
                    ans[n - 1]++;
                    break;
                }
                case 0b01: {
                    rep(i, 0, k) {
                        ans[3 * i]++;
                    }
                    break;
                }
                case 0b10: {
                    rep(i, 0, k) {
                        ans[3 * i + 1]++;
                    }
                    break;
                }
                case 0b11: {
                    rep(i, 0, n) {
                        ans[i]++;
                    }
                    break;
                }
            }
            break;
        }
        case 2: {
            switch (last2) {
                case 0b00: {
                    rep(i, 0, k) {
                        ans[3 * i + 1]++;
                    }
                    break;
                }
                case 0b01: {
                    rep(i, 0, k) {
                        ans[3 * i + 2]++;
                    }
                    ans[n - 1]++;
                    break;
                }
                case 0b10: {
                    rep(i, 0, k) {
                        ans[3 * i + 3]++;
                    }
                    ans[0]++;
                    break;
                }
                case 0b11: {
                    rep(i, 0, n) {
                        ans[i]++;
                    }
                    break;
                }
            }
            break;
        }
    }
    set<int> ans0, ans1, nans0;
    rep(i, 0, n) {
        if (!(ans[i] % 2)) {
            if (s[i] == '0') {
                ans0.emplace(i);
            } else {
                ans1.emplace(i);
            }
        } else {
            if (s[i] == '0') {
                nans0.emplace(i);
            }
        }
    }
    vector<int> ans_v;
    while (!ans0.empty() || !nans0.empty()) {
        if (ans0.empty()) {
            auto t = *nans0.begin();
            nans0.erase(nans0.begin());
            ans_v.emplace_back(t);
            ans1.emplace(t);
            if (auto i = ans1.find((t + n - 1) % n);i != ans1.end()) {
                ans0.emplace(*i);
                ans1.erase(i);
            } else if (i = nans0.find((t + n - 1) % n);i != nans0.end()) {
                nans0.erase(i);
            } else {
                nans0.emplace((t + n - 1) % n);
            }
            if (auto i = ans1.find((t + 1) % n);i != ans1.end()) {
                ans0.emplace(*i);
                ans1.erase(i);
            } else if (i = nans0.find((t + 1) % n);i != nans0.end()) {
                nans0.erase(i);
            } else {
                nans0.emplace((t + 1) % n);
            }
        } else {
            auto t = *ans0.begin();
            ans0.erase(ans0.begin());
            ans_v.emplace_back(t);
            if (auto i = ans0.find((t + n - 1) % n);i != ans0.end()) {
                ans1.emplace(*i);
                ans0.erase(i);
            } else if (i = ans1.find((t + n - 1) % n);i != ans1.end()) {
                ans0.emplace(*i);
                ans1.erase(i);
            } else if (i = nans0.find((t + n - 1) % n);i != nans0.end()) {
                nans0.erase(i);
            } else {
                nans0.emplace((t + n - 1) % n);
            }
            if (auto i = ans0.find((t + 1) % n);i != ans0.end()) {
                ans1.emplace(*i);
                ans0.erase(i);
            } else if (i = ans1.find((t + 1) % n);i != ans1.end()) {
                ans0.emplace(*i);
                ans1.erase(i);
            } else if (i = nans0.find((t + 1) % n);i != nans0.end()) {
                nans0.erase(i);
            } else {
                nans0.emplace((t + 1) % n);
            }
        }
    }
    n = (int) ans_v.size();
    cout << n << endl;
    rep(i, 0, n) {
        cout << ans_v[i] + 1 << " \n"[i == n - 1];
    }
}

int main() {
    IOS
    int t;
    cin >> t;
    while (t--)solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
5
00000
3
001

output:

7
1 3 2 1 5 1 4
0

result:

ok all puzzle solved (2 test cases)

Test #2:

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

input:

7
3
000
3
100
3
010
3
110
3
001
3
101
3
011

output:

1
2
0
0
0
0
0
0

result:

ok all puzzle solved (7 test cases)

Test #3:

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

input:

15
4
0000
4
1000
4
0100
4
1100
4
0010
4
1010
4
0110
4
1110
4
0001
4
1001
4
0101
4
1101
4
0011
4
1011
4
0111

output:

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

result:

ok all puzzle solved (15 test cases)

Test #4:

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

input:

31
5
00000
5
10000
5
01000
5
11000
5
00100
5
10100
5
01100
5
11100
5
00010
5
10010
5
01010
5
11010
5
00110
5
10110
5
01110
5
11110
5
00001
5
10001
5
01001
5
11001
5
00101
5
10101
5
01101
5
11101
5
00011
5
10011
5
01011
5
11011
5
00111
5
10111
5
01111

output:

7
1 3 2 1 5 1 4
2
2 5
2
1 3
1
4
2
2 4
3
2 1 3
1
5
6
4 3 2 1 2 5
2
3 5
3
5 1 4
3
3 2 4
4
3 2 1 3
1
1
4
2 3 2 4
6
1 2 1 5 1 4
5
5 1 2 1 3
2
1 4
1
3
3
1 2 5
6
3 2 1 5 1 4
3
4 3 5
4
2 1 2 5
4
1 2 1 3
5
4 3 2 1 3
1
2
6
2 1 2 3 2 4
4
1 5 1 4
5
3 2 1 2 5
6
1 5 1 2 1 3
5
2 1 5 1 4
5
1 2 3 2 4

result:

ok all puzzle solved (31 test cases)

Test #5:

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

input:

63
6
000000
6
100000
6
010000
6
110000
6
001000
6
101000
6
011000
6
111000
6
000100
6
100100
6
010100
6
110100
6
001100
6
101100
6
011100
6
111100
6
000010
6
100010
6
010010
6
110010
6
001010
6
101010
6
011010
6
111010
6
000110
6
100110
6
010110
6
110110
6
001110
6
101110
6
011110
6
111110
6
000001
...

output:

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

result:

ok all puzzle solved (63 test cases)

Test #6:

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

input:

127
7
0000000
7
1000000
7
0100000
7
1100000
7
0010000
7
1010000
7
0110000
7
1110000
7
0001000
7
1001000
7
0101000
7
1101000
7
0011000
7
1011000
7
0111000
7
1111000
7
0000100
7
1000100
7
0100100
7
1100100
7
0010100
7
1010100
7
0110100
7
1110100
7
0001100
7
1001100
7
0101100
7
1101100
7
0011100
7
1011...

output:

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

result:

ok all puzzle solved (127 test cases)

Test #7:

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

input:

255
8
00000000
8
10000000
8
01000000
8
11000000
8
00100000
8
10100000
8
01100000
8
11100000
8
00010000
8
10010000
8
01010000
8
11010000
8
00110000
8
10110000
8
01110000
8
11110000
8
00001000
8
10001000
8
01001000
8
11001000
8
00101000
8
10101000
8
01101000
8
11101000
8
00011000
8
10011000
8
01011000...

output:

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

result:

ok all puzzle solved (255 test cases)

Test #8:

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

input:

511
9
000000000
9
100000000
9
010000000
9
110000000
9
001000000
9
101000000
9
011000000
9
111000000
9
000100000
9
100100000
9
010100000
9
110100000
9
001100000
9
101100000
9
011100000
9
111100000
9
000010000
9
100010000
9
010010000
9
110010000
9
001010000
9
101010000
9
011010000
9
111010000
9
000110...

output:

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

result:

ok all puzzle solved (511 test cases)

Test #9:

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

input:

1023
10
0000000000
10
1000000000
10
0100000000
10
1100000000
10
0010000000
10
1010000000
10
0110000000
10
1110000000
10
0001000000
10
1001000000
10
0101000000
10
1101000000
10
0011000000
10
1011000000
10
0111000000
10
1111000000
10
0000100000
10
1000100000
10
0100100000
10
1100100000
10
0010100000
1...

output:

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

result:

ok all puzzle solved (1023 test cases)

Test #10:

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

input:

2047
11
00000000000
11
10000000000
11
01000000000
11
11000000000
11
00100000000
11
10100000000
11
01100000000
11
11100000000
11
00010000000
11
10010000000
11
01010000000
11
11010000000
11
00110000000
11
10110000000
11
01110000000
11
11110000000
11
00001000000
11
10001000000
11
01001000000
11
1100100...

output:

13
1 3 2 5 4 7 6 9 8 1 11 1 10
4
2 5 8 11
4
1 3 6 9
3
4 7 10
4
2 4 7 10
5
2 1 3 6 9
3
5 8 11
12
4 3 6 5 8 7 10 9 2 1 2 11
4
3 5 8 11
9
5 4 7 6 9 8 11 1 10
5
3 2 4 7 10
6
6 9 3 2 1 3
3
1 6 9
6
7 10 2 3 2 4
12
1 2 5 4 7 6 9 8 1 11 1 10
7
5 8 11 1 2 1 3
4
1 4 6 9
3
3 7 10
9
1 2 6 5 8 7 10 9 11
8
3 2 8 ...

result:

ok all puzzle solved (2047 test cases)

Test #11:

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

input:

4095
12
000000000000
12
100000000000
12
010000000000
12
110000000000
12
001000000000
12
101000000000
12
011000000000
12
111000000000
12
000100000000
12
100100000000
12
010100000000
12
110100000000
12
001100000000
12
101100000000
12
011100000000
12
111100000000
12
000010000000
12
100010000000
12
0100...

output:

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

result:

ok all puzzle solved (4095 test cases)

Test #12:

score: 0
Accepted
time: 16ms
memory: 3440kb

input:

8191
13
0000000000000
13
1000000000000
13
0100000000000
13
1100000000000
13
0010000000000
13
1010000000000
13
0110000000000
13
1110000000000
13
0001000000000
13
1001000000000
13
0101000000000
13
1101000000000
13
0011000000000
13
1011000000000
13
0111000000000
13
1111000000000
13
0000100000000
13
100...

output:

15
1 3 2 5 4 7 6 9 8 11 10 1 13 1 12
4
3 6 9 12
4
4 7 10 13
7
5 8 11 3 2 1 3
4
1 5 8 11
5
2 4 7 10 13
7
6 9 12 1 2 1 3
14
4 3 6 5 8 7 10 9 12 11 2 1 2 13
4
2 6 9 12
11
5 4 7 6 9 8 11 10 13 1 12
5
1 3 5 8 11
6
3 2 4 7 10 13
7
7 10 13 2 3 2 4
6
2 1 3 5 8 11
14
1 2 5 4 7 6 9 8 11 10 1 13 1 12
3
6 9 12
...

result:

ok all puzzle solved (8191 test cases)

Test #13:

score: 0
Accepted
time: 27ms
memory: 3416kb

input:

13683
14
00000000000000
14
10000000000000
14
01000000000000
14
11000000000000
14
00100000000000
14
10100000000000
14
01100000000000
14
11100000000000
14
00010000000000
14
10010000000000
14
01010000000000
14
11010000000000
14
00110000000000
14
10110000000000
14
01110000000000
14
11110000000000
14
000...

output:

14
1 3 2 5 4 7 6 9 8 11 10 13 12 14
5
2 5 8 11 14
5
1 3 6 9 12
4
4 7 10 13
5
2 4 7 10 13
6
2 1 3 6 9 12
4
5 8 11 14
13
4 3 6 5 8 7 10 9 12 11 14 1 13
5
3 5 8 11 14
14
5 4 7 6 9 8 11 10 13 12 2 1 2 14
6
3 2 4 7 10 13
7
6 9 12 3 2 1 3
4
1 6 9 12
7
7 10 13 2 3 2 4
13
1 2 5 4 7 6 9 8 11 10 13 12 14
8
5 ...

result:

ok all puzzle solved (13683 test cases)

Test #14:

score: 0
Accepted
time: 20ms
memory: 3444kb

input:

32767
15
000000000000000
15
100000000000000
15
010000000000000
15
110000000000000
15
001000000000000
15
101000000000000
15
011000000000000
15
111000000000000
15
000100000000000
15
100100000000000
15
010100000000000
15
110100000000000
15
001100000000000
15
101100000000000
15
011100000000000
15
111100...

output:

5
2 5 8 11 14
0
0
0
0
0
0
4
5 8 11 14
0
5
3 5 8 11 14
0
0
0
0
8
5 8 11 14 1 2 1 3
0
0
0
9
3 2 8 11 14 3 4 3 5
0
0
6
4 3 5 8 11 14
0
0
0
0
0
7
8 11 14 3 4 3 5
8
2 8 11 14 3 4 3 5
0
0
0
0
0
0
4
4 8 11 14
5
2 4 8 11 14
0
0
0
0
0
6
3 2 4 8 11 14
0
0
7
8 11 14 2 3 2 4
0
0
0
4
3 8 11 14
0
0
0
0
7
8 11 14 ...

result:

ok all puzzle solved (32767 test cases)

Test #15:

score: 0
Accepted
time: 107ms
memory: 3440kb

input:

50000
16
0000000000000000
16
1000000000000000
16
0100000000000000
16
1100000000000000
16
0010000000000000
16
1010000000000000
16
0110000000000000
16
1110000000000000
16
0001000000000000
16
1001000000000000
16
0101000000000000
16
1101000000000000
16
0011000000000000
16
1011000000000000
16
01110000000...

output:

16
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 16
5
3 6 9 12 15
5
4 7 10 13 16
8
5 8 11 14 3 2 1 3
5
1 5 8 11 14
6
2 4 7 10 13 16
8
6 9 12 15 1 2 1 3
15
4 3 6 5 8 7 10 9 12 11 14 13 16 1 15
5
2 6 9 12 15
16
5 4 7 6 9 8 11 10 13 12 15 14 2 1 2 16
6
1 3 5 8 11 14
7
3 2 4 7 10 13 16
8
7 10 13 16 2 3 2 4
7
2 1 ...

result:

ok all puzzle solved (50000 test cases)

Test #16:

score: 0
Accepted
time: 35ms
memory: 3432kb

input:

15535
16
0000101011000011
16
1000101011000011
16
0100101011000011
16
1100101011000011
16
0010101011000011
16
1010101011000011
16
0110101011000011
16
1110101011000011
16
0001101011000011
16
1001101011000011
16
0101101011000011
16
1101101011000011
16
0011101011000011
16
1011101011000011
16
01111010110...

output:

12
1 4 6 8 11 10 13 12 13 14 13 15
9
2 6 5 7 12 1 16 1 15
11
3 2 13 3 4 3 5 8 9 8 10
10
3 8 7 9 11 14 2 1 2 16
11
1 8 7 9 11 14 16 1 2 1 3
8
4 3 5 13 8 9 8 10
8
6 5 7 12 1 16 1 15
15
4 6 8 11 10 13 12 3 2 1 3 13 14 13 15
9
3 6 5 7 12 1 16 1 15
16
2 1 6 8 11 10 13 12 2 3 2 4 13 14 13 15
8
1 2 8 7 9 1...

result:

ok all puzzle solved (15535 test cases)

Test #17:

score: 0
Accepted
time: 113ms
memory: 3472kb

input:

50000
17
00000000000000000
17
10000000000000000
17
01000000000000000
17
11000000000000000
17
00100000000000000
17
10100000000000000
17
01100000000000000
17
11100000000000000
17
00010000000000000
17
10010000000000000
17
01010000000000000
17
11010000000000000
17
00110000000000000
17
10110000000000000
...

output:

19
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 1 17 1 16
6
2 5 8 11 14 17
6
1 3 6 9 12 15
5
4 7 10 13 16
6
2 4 7 10 13 16
7
2 1 3 6 9 12 15
5
5 8 11 14 17
18
4 3 6 5 8 7 10 9 12 11 14 13 16 15 2 1 2 17
6
3 5 8 11 14 17
15
5 4 7 6 9 8 11 10 13 12 15 14 17 1 16
7
3 2 4 7 10 13 16
8
6 9 12 15 3 2 1 3
5
1 6 9 1...

result:

ok all puzzle solved (50000 test cases)

Test #18:

score: 0
Accepted
time: 115ms
memory: 3468kb

input:

50000
17
00001010110000110
17
10001010110000110
17
01001010110000110
17
11001010110000110
17
00101010110000110
17
10101010110000110
17
01101010110000110
17
11101010110000110
17
00011010110000110
17
10011010110000110
17
01011010110000110
17
11011010110000110
17
00111010110000110
17
10111010110000110
...

output:

9
2 6 5 7 12 14 15 14 16
10
2 1 4 3 5 13 8 9 8 10
12
4 6 8 11 10 13 12 17 13 14 13 15
9
3 8 7 9 11 14 17 1 16
14
1 8 7 9 11 14 4 3 2 4 1 17 1 16
13
2 4 6 8 11 10 13 12 17 13 14 13 15
9
1 4 3 5 13 8 9 8 10
8
6 5 7 12 14 15 14 16
10
1 13 3 4 3 5 8 9 8 10
9
3 6 5 7 12 14 15 14 16
11
1 2 8 7 9 11 14 1 1...

result:

ok all puzzle solved (50000 test cases)

Test #19:

score: 0
Accepted
time: 74ms
memory: 3484kb

input:

31071
17
00000101011000011
17
10000101011000011
17
01000101011000011
17
11000101011000011
17
00100101011000011
17
10100101011000011
17
01100101011000011
17
11100101011000011
17
00010101011000011
17
10010101011000011
17
01010101011000011
17
11010101011000011
17
00110101011000011
17
10110101011000011
...

output:

9
3 7 6 8 13 1 17 1 16
10
4 9 8 10 12 15 2 1 2 17
10
3 2 5 4 6 14 9 10 9 11
15
5 7 9 12 11 14 13 3 2 1 3 14 15 14 16
12
1 5 7 9 12 11 14 13 14 15 14 16
11
4 3 14 4 5 4 6 9 10 9 11
9
1 2 4 9 8 10 12 15 17
12
7 6 8 13 4 3 2 4 1 17 1 16
10
1 3 2 4 9 8 10 12 15 17
9
2 7 6 8 13 1 17 1 16
13
1 3 5 7 9 12 ...

result:

ok all puzzle solved (31071 test cases)

Test #20:

score: 0
Accepted
time: 75ms
memory: 3568kb

input:

998
3
000
4
0000
5
00000
6
000000
7
0000000
8
00000000
9
000000000
10
0000000000
11
00000000000
12
000000000000
13
0000000000000
14
00000000000000
15
000000000000000
16
0000000000000000
17
00000000000000000
18
000000000000000000
19
0000000000000000000
20
00000000000000000000
21
000000000000000000000...

output:

1
2
4
1 3 2 4
7
1 3 2 1 5 1 4
2
2 5
9
1 3 2 5 4 1 7 1 6
8
1 3 2 5 4 7 6 8
3
2 5 8
10
1 3 2 5 4 7 6 9 8 10
13
1 3 2 5 4 7 6 9 8 1 11 1 10
4
2 5 8 11
15
1 3 2 5 4 7 6 9 8 11 10 1 13 1 12
14
1 3 2 5 4 7 6 9 8 11 10 13 12 14
5
2 5 8 11 14
16
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 16
19
1 3 2 5 4 7 6 9 8 11...

result:

ok all puzzle solved (998 test cases)

Test #21:

score: 0
Accepted
time: 97ms
memory: 3528kb

input:

500
1001
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

1003
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 100...

result:

ok all puzzle solved (500 test cases)

Test #22:

score: 0
Accepted
time: 135ms
memory: 3560kb

input:

500
1501
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

1503
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 100...

result:

ok all puzzle solved (500 test cases)

Test #23:

score: 0
Accepted
time: 240ms
memory: 9172kb

input:

10
99991
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

99993
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 10...

result:

ok all puzzle solved (10 test cases)

Test #24:

score: 0
Accepted
time: 66ms
memory: 3528kb

input:

998
3
101
4
0111
5
10111
6
111101
7
1111110
8
11111101
9
101111111
10
1111111011
11
01111111111
12
110111111111
13
1110111111111
14
11111111101111
15
111111101111111
16
1111111111111011
17
11111111111111110
18
101111111111111111
19
1011111111111111111
20
11111101111111111111
21
111111111111110111111...

output:

0
3
1 2 4
5
2 1 5 1 4
0
7
7 1 6 2 3 2 4
9
7 6 5 4 6 3 2 1 3
0
11
8 7 9 6 5 4 6 3 2 1 3
13
1 2 3 2 4 5 6 5 7 8 9 8 10
0
15
4 3 5 2 1 2 13 6 7 6 8 9 10 9 11
17
10 9 8 7 9 6 5 4 6 3 2 1 3 11 12 11 13
0
19
14 13 15 12 11 10 12 9 8 7 9 6 5 4 6 3 2 1 3
21
17 1 2 1 3 4 5 4 6 7 8 7 9 10 11 10 12 13 14 13 15...

result:

ok all puzzle solved (998 test cases)

Test #25:

score: 0
Accepted
time: 74ms
memory: 3620kb

input:

500
1001
111111111111111111111111111111111111111111111111111111111111111101111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1333
65 64 63 62 64 61 60 59 61 58 57 56 58 55 54 53 55 52 51 50 52 49 48 47 49 46 45 44 46 43 42 41 43 40 39 38 40 37 36 35 37 34 33 32 34 31 30 29 31 28 27 26 28 25 24 23 25 22 21 20 22 19 18 17 19 16 15 14 16 13 12 11 13 10 9 8 10 7 6 5 7 4 3 2 4 1 1001 1 1000 66 67 66 68 69 70 69 71 72 73 72 74 ...

result:

ok all puzzle solved (500 test cases)

Test #26:

score: 0
Accepted
time: 114ms
memory: 3524kb

input:

500
1501
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1999
1015 1014 1016 1013 1012 1011 1013 1010 1009 1008 1010 1007 1006 1005 1007 1004 1003 1002 1004 1001 1000 999 1001 998 997 996 998 995 994 993 995 992 991 990 992 989 988 987 989 986 985 984 986 983 982 981 983 980 979 978 980 977 976 975 977 974 973 972 974 971 970 969 971 968 967 966 968 965 9...

result:

ok all puzzle solved (500 test cases)

Test #27:

score: 0
Accepted
time: 170ms
memory: 8080kb

input:

10
99991
111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

133319
96561 96560 96562 96559 96558 96557 96559 96556 96555 96554 96556 96553 96552 96551 96553 96550 96549 96548 96550 96547 96546 96545 96547 96544 96543 96542 96544 96541 96540 96539 96541 96538 96537 96536 96538 96535 96534 96533 96535 96532 96531 96530 96532 96529 96528 96527 96529 96526 96525...

result:

ok all puzzle solved (10 test cases)

Test #28:

score: 0
Accepted
time: 33ms
memory: 3536kb

input:

37037
27
000000000000000000000000000
27
010000000100000100000000000
27
000000000000000000000000100
27
000000000000001000000010000
27
000101000000000000000000000
27
000001000000010000000000000
27
100000100100000000000000000
27
000000000000000001000000000
27
000000100000000000000000000
27
000000000000...

output:

9
2 5 8 11 14 17 20 23 26
0
0
0
0
0
0
0
0
0
0
0
0
0
9
2 5 8 10 13 16 20 23 26
0
0
0
9
2 5 7 10 13 16 19 22 26
0
0
0
13
2 5 8 11 14 17 21 20 23 22 25 24 26
0
0
0
0
9
3 6 9 12 15 18 21 24 26
0
0
0
0
0
0
14
3 6 9 13 12 15 14 20 23 26 15 16 15 17
0
0
8
2 7 10 13 17 20 23 26
9
2 6 9 12 15 17 20 23 26
0
0...

result:

ok all puzzle solved (37037 test cases)

Test #29:

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

input:

37037
27
101000000000000000000000000
27
000000100001000000000010000
27
000000000000000000000000000
27
000000000000000100000000000
27
010000010010000000000000000
27
000000000001000000000000000
27
001000000001001000000100100
27
000011101000000000010100000
27
001000000000001000000000000
27
000010000000...

output:

0
18
2 5 9 13 12 15 14 17 16 19 18 21 20 26 21 22 21 23
9
2 5 8 11 14 17 20 23 26
0
0
0
0
13
2 8 10 13 16 19 21 23 26 4 5 4 6
9
2 4 7 10 13 17 20 23 26
0
0
8
2 5 8 11 14 19 22 25
0
0
0
0
0
0
0
0
0
0
0
0
0
10
2 5 8 10 13 15 18 20 23 26
0
0
0
0
0
0
0
0
0
0
0
20
3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 ...

result:

ok all puzzle solved (37037 test cases)

Test #30:

score: 0
Accepted
time: 38ms
memory: 3520kb

input:

37037
27
111110011010001100000010011
27
110111011101000100010100110
27
010100010110110110110101111
27
010110110011011001010001110
27
010110000001001100110011100
27
110000111000111010100100010
27
101010111010000110111101011
27
011011101001111000010111000
27
101000001001010100001010001
27
100001111100...

output:

0
0
0
0
0
0
0
0
0
0
0
16
2 5 8 10 13 16 19 18 21 20 23 22 23 24 23 25
0
0
0
16
2 6 5 8 7 9 11 13 16 15 17 22 24 25 24 26
0
0
0
0
0
0
0
0
0
18
8 10 13 16 19 21 1 2 1 3 4 5 4 6 24 25 24 26
0
11
3 9 8 10 16 15 17 19 22 21 23
0
27
3 2 10 3 4 3 5 6 7 6 8 14 15 14 16 17 18 17 19 20 21 20 22 23 24 23 25
12...

result:

ok all puzzle solved (37037 test cases)

Test #31:

score: 0
Accepted
time: 42ms
memory: 3432kb

input:

37037
27
101111111111111101111111011
27
110111111111111111101111111
27
101101111111111111111111111
27
011111110111111111111111110
27
111111100111011111111111111
27
111111111111101111111111111
27
101001111111101110111111111
27
111111110111011111110101111
27
111110111111101111111011011
27
111011111111...

output:

0
0
4
2 3 2 4
0
5
9 10 11 10 12
0
19
4 3 14 4 5 4 6 7 8 7 9 10 11 10 12 15 16 15 17
0
0
0
0
0
14
10 18 3 4 3 5 11 12 11 13 14 15 14 16
0
0
9
11 12 13 12 14 15 16 15 17
0
0
0
0
0
0
0
0
0
27
9 8 10 1 2 1 3 4 5 4 6 11 12 11 13 14 15 14 16 17 18 17 19 20 21 20 22
0
0
0
13
17 10 11 10 12 13 14 13 15 18 1...

result:

ok all puzzle solved (37037 test cases)

Test #32:

score: 0
Accepted
time: 135ms
memory: 3476kb

input:

34482
29
00000110000000000000000000000
29
00000000000000000000000000001
29
00000000000000000000001010000
29
00000000000000000000000000000
29
00000000000001000000000000000
29
00000001000000000000000000100
29
00000000000000000010000000000
29
00000000000000000000000000100
29
000000000001000001001000000...

output:

9
1 4 9 12 15 18 21 24 27
10
1 4 7 10 13 16 19 22 25 28
11
2 5 8 11 14 17 20 24 23 25 28
31
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 1 29 1 28
10
1 4 7 10 13 15 18 21 24 27
9
3 6 10 13 16 19 22 25 29
10
3 6 9 12 15 18 20 23 26 29
10
2 5 8 11 14 17 20 23 26 28
10
2 5 8 ...

result:

ok all puzzle solved (34482 test cases)

Test #33:

score: 0
Accepted
time: 127ms
memory: 3436kb

input:

34482
29
00000000000000000000001000001
29
00000000000000000000000000000
29
10001000010000000001000000110
29
00001000000000001000000100010
29
00000000010000000101000000000
29
01000001000000000000000000000
29
00000000000001000000000001011
29
00000010000100000000000010000
29
100000000000000000000100010...

output:

27
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 26 29 21 22 21 23
31
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 1 29 1 28
11
2 1 4 3 5 8 12 15 18 22 25
9
1 4 6 9 12 15 19 22 26
24
1 3 2 5 4 7 6 9 8 10 13 16 21 20 23 22 25 24 27 26 1 29 1 28
27
1 2 5 9 8 11 10 13...

result:

ok all puzzle solved (34482 test cases)

Test #34:

score: 0
Accepted
time: 154ms
memory: 3416kb

input:

34482
29
11101101100101100100111101100
29
11000101110110001100100010101
29
01001100000110101000111000000
29
10010110101011010011010100100
29
10110000010010001100011111101
29
01010001001101110110000111001
29
11010101110111110000111101100
29
10001100110100011100011111000
29
111110000111110011111100100...

output:

20
11 13 16 15 25 24 26 28 4 5 4 6 16 17 16 18 20 21 20 22
21
3 7 6 8 11 10 12 14 22 21 24 23 25 2 1 2 29 16 17 16 18
23
1 2 9 18 17 20 19 21 24 23 26 25 28 27 29 4 5 4 6 11 12 11 13
15
3 5 8 7 9 18 21 20 22 26 28 12 13 12 14
9
6 9 11 15 20 2 1 2 29
17
1 2 6 10 13 12 14 17 16 18 20 23 29 24 25 24 26...

result:

ok all puzzle solved (34482 test cases)

Test #35:

score: 0
Accepted
time: 147ms
memory: 3468kb

input:

34482
29
11111111111010011111111111111
29
01110111111111000111111111111
29
11111101111111111111111111011
29
11101111111111111101111110101
29
11111011101111011111111111111
29
11111111111011111001111111111
29
11111111010111011111011111110
29
11111111111111111110110110111
29
110111111111101111111111111...

output:

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

result:

ok all puzzle solved (34482 test cases)

Test #36:

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

input:

33333
30
000000000000000100010000000000
30
000000001000000000000000000000
30
000000000000000000000000010100
30
000000000000000000000000000000
30
000000000010000000001000000001
30
000000010000000000000000000000
30
000000100000000001000000000000
30
000000001010100000000000001000
30
0000000000001000000...

output:

0
0
0
10
2 5 8 11 14 17 20 23 26 29
0
0
0
0
10
2 5 8 11 15 18 21 23 26 29
10
2 5 9 12 15 18 21 23 26 29
0
0
0
0
0
0
0
0
0
0
0
0
22
2 6 5 8 7 10 9 12 11 14 13 16 15 18 17 23 26 29 18 19 18 20
0
0
0
10
2 5 8 11 14 17 19 22 25 29
0
0
0
0
0
0
10
2 5 8 11 14 17 20 24 27 29
0
0
0
0
0
10
2 5 9 12 14 17 20 ...

result:

ok all puzzle solved (33333 test cases)

Test #37:

score: 0
Accepted
time: 33ms
memory: 3432kb

input:

33333
30
000100000000000000000100000000
30
000000000000000000000000000000
30
100000100000100010101000000000
30
000000001000100011000000000000
30
000000000000100000000000000000
30
100000010000001000000010000010
30
000000000100010000000010001000
30
000000101000000000000000000000
30
0000010000000000000...

output:

10
2 6 9 12 15 18 21 23 26 29
10
2 5 8 11 14 17 20 23 26 29
0
0
0
13
3 6 10 13 17 20 24 23 26 25 28 27 29
0
0
0
0
0
0
0
0
10
2 5 7 10 13 16 19 23 26 29
0
0
0
14
2 5 8 11 15 14 20 23 26 29 15 16 15 17
0
0
0
0
0
0
0
0
0
22
2 5 8 11 15 14 17 16 19 18 21 20 23 22 25 24 27 26 27 28 27 29
0
16
3 8 7 10 9 ...

result:

ok all puzzle solved (33333 test cases)

Test #38:

score: 0
Accepted
time: 43ms
memory: 3472kb

input:

33333
30
000001101000110100110011001001
30
100110011011001110101101000000
30
100111011000000111011111101000
30
110000110011110011111011010111
30
100100101000000111100111111100
30
110100111010010101011001101001
30
101011101001101001001011011101
30
010010011001001010000000101111
30
0001111000011010010...

output:

0
0
0
23
4 15 14 22 25 24 26 6 7 6 8 10 11 10 12 15 16 15 17 18 19 18 20
0
0
0
0
0
0
23
3 2 5 4 6 8 17 16 22 21 23 9 10 9 11 12 13 12 14 17 18 17 19
0
0
0
0
19
2 8 7 10 9 12 11 13 19 22 26 25 28 27 29 14 15 14 16
0
24
23 25 27 29 1 2 1 3 5 6 5 7 8 9 8 10 13 14 13 15 19 20 19 21
0
0
0
0
0
0
0
21
6 5 ...

result:

ok all puzzle solved (33333 test cases)

Test #39:

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

input:

33333
30
111011111111111111010111111111
30
111111101111111101001111011111
30
100111110111111011111111011111
30
111011111111111111111001010111
30
110111011111111111110101111111
30
111111011111110110111111111111
30
111110111111111111111111011111
30
111111111111011111111111111110
30
1111101111111111111...

output:

0
0
0
27
25 24 26 4 5 4 6 7 8 7 9 10 11 10 12 13 14 13 15 16 17 16 18 19 20 19 21
0
0
0
0
20
6 7 6 8 9 10 9 11 12 13 12 14 15 16 15 17 18 19 18 20
0
0
0
0
0
0
0
0
0
0
0
17
22 25 24 26 28 12 13 12 14 15 16 15 17 18 19 18 20
12
21 22 21 23 24 25 24 26 27 28 27 29
0
0
19
2 9 8 3 4 3 5 9 10 9 11 12 13 1...

result:

ok all puzzle solved (33333 test cases)

Test #40:

score: 0
Accepted
time: 28ms
memory: 3536kb

input:

20833
48
000000000000000000000000000000000000010000000000
48
000000000000000000000000000000000000000000000000
48
000000000000000000000000000000000100000000000000
48
000000000000000000000000000000000000000000010000
48
000010000000000000000000000000000000000000000000
48
0000001000000001000000100000000...

output:

0
16
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47
0
0
0
0
0
0
0
0
0
0
0
20
2 5 8 11 15 14 20 23 26 29 32 35 38 41 44 47 15 16 15 17
0
0
0
0
0
0
0
0
0
19
2 4 7 10 13 16 23 26 29 32 35 38 41 44 47 18 19 18 20
16
2 5 8 11 14 18 21 24 27 30 33 36 39 42 44 47
0
32
2 5 8 11 14 17 21 20 23 22 25 24 27 26 2...

result:

ok all puzzle solved (20833 test cases)

Test #41:

score: 0
Accepted
time: 27ms
memory: 3488kb

input:

20833
48
000000001000000000001000000000000001000000000000
48
000100100000000001000000000000010000000000000110
48
100000000000000000000000000000000001100000000010
48
000000000100000100000000010010000000000000000001
48
000000000000000000000001000010000010000000010001
48
0000000000100000000000000000000...

output:

0
0
0
0
0
32
2 5 8 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 33 36 39 42 41 43 47
0
26
2 5 8 11 13 16 19 22 26 25 28 27 30 29 32 31 34 33 39 42 44 47 34 35 34 36
0
0
0
0
0
15
2 5 8 12 15 18 21 24 29 32 35 38 41 44 47
0
0
0
0
0
25
3 6 9 13 12 15 14 17 16 21 24 27 30 34 33 36 3...

result:

ok all puzzle solved (20833 test cases)

Test #42:

score: 0
Accepted
time: 39ms
memory: 3524kb

input:

20833
48
111011110111100001100101101101000010101111000011
48
110011111101001000110101011010100011000011001101
48
010010001011101101111111011011101100110110000011
48
000000001000001110101100011100101100111011010110
48
111101000000011110101010010011000110111000110000
48
1010110100011101100110101100011...

output:

0
0
34
3 2 8 10 25 24 26 28 36 39 38 40 42 45 3 4 3 5 11 12 11 13 17 18 17 19 20 21 20 22 29 30 29 31
0
0
0
0
0
0
0
36
4 6 10 9 11 14 13 16 15 17 19 21 23 26 25 33 38 44 43 45 26 27 26 28 29 30 29 31 34 35 34 36 39 40 39 41
35
2 4 12 17 19 28 33 32 35 34 37 36 38 44 46 5 6 5 7 8 9 8 10 21 22 21 23 2...

result:

ok all puzzle solved (20833 test cases)

Test #43:

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

input:

20833
48
111110111101111110101111111111101111111011111110
48
111111011111110011111011111111111011111111111111
48
111111111111111111100111101111111111111111111111
48
111111111111111111011111111111101111111111111111
48
111011111111111111111111111111111111111111111011
48
1111011111111111111111111111011...

output:

33
11 10 12 18 17 19 40 39 41 6 7 6 8 13 14 13 15 32 33 32 34 35 36 35 37 42 43 42 44 45 46 45 47
0
0
0
56
4 5 4 6 7 8 7 9 10 11 10 12 13 14 13 15 16 17 16 18 19 20 19 21 22 23 22 24 25 26 25 27 28 29 28 30 31 32 31 33 34 35 34 36 37 38 37 39 40 41 40 42 43 44 43 45
0
0
12
11 12 11 13 14 15 14 16 17...

result:

ok all puzzle solved (20833 test cases)

Test #44:

score: 0
Accepted
time: 109ms
memory: 3476kb

input:

20408
49
0000100000000000000000000010000000000000100000001
49
0000000000000000000000000000000000000000000000000
49
0000000000000000000000000000001000000100001000010
49
0010000000000000000000000000000000000000000001000
49
0000000000000000000000000000010000000000000000000
49
00000000100010000000000000...

output:

21
3 7 10 13 16 19 22 25 29 32 35 38 42 41 44 43 46 45 48 47 49
51
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 1 49 1 48
21
2 5 8 11 14 17 20 23 26 29 33 36 40 44 43 46 45 46 47 46 48
47
4 3 6 5 8 7 10 9 12 11 14...

result:

ok all puzzle solved (20408 test cases)

Test #45:

score: 0
Accepted
time: 137ms
memory: 3360kb

input:

20408
49
1000000000000000000100000000000000000000000000000
49
0000000000000000001110000000000000000000000000000
49
0010000001000000000000000010011000001000000010000
49
0000100000010000001000000000000110000000000000000
49
0001000000110000000010000000001000001010100000000
49
00000000000000000000100000...

output:

31
2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 23 26 29 32 35 38 41 44 47 18 19 18 20
50
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 49 17 18 17 19
38
2 4 7 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 34 38 37 40 ...

result:

ok all puzzle solved (20408 test cases)

Test #46:

score: 0
Accepted
time: 155ms
memory: 3436kb

input:

20408
49
1011001010000101100010010110001101000111101110101
49
1000000100101010101000001000100101001001010001100
49
1101100010101111111011001110100101111101111101100
49
0100100110101001101100010101010010110111010001011
49
1100111100000011111100111110010110010011010110111
49
11101101000001010110101000...

output:

31
2 5 4 11 15 14 16 18 22 21 29 35 34 37 36 38 48 47 49 5 6 5 7 22 23 22 24 39 40 39 41
31
4 7 9 14 13 15 20 19 22 21 24 23 25 28 30 35 34 41 40 42 45 48 47 2 1 2 49 35 36 35 37
41
8 10 12 20 23 22 28 27 29 33 32 34 39 45 44 46 48 3 4 3 5 13 14 13 15 16 17 16 18 23 24 23 25 35 36 35 37 40 41 40 42
...

result:

ok all puzzle solved (20408 test cases)

Test #47:

score: 0
Accepted
time: 151ms
memory: 3416kb

input:

20408
49
1111111101111111111111111111111110111011111111111
49
1111111111111101111111111111111110111011111111111
49
0111101111111111111111111111110101111111111111111
49
1111111111111110101111111111111101111111111110111
49
1111101111111111111111110111111101111101011111111
49
11111011111111111011111111...

output:

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

result:

ok all puzzle solved (20408 test cases)

Test #48:

score: 0
Accepted
time: 114ms
memory: 3476kb

input:

20000
50
00000000000000000000000000000000000000000000000000
50
00000000100000000000000100000000000000000000000000
50
00000000100000000000000100000000000000000000000010
50
00010000000000000000000000000000000000000000000000
50
00000000000000000000000000000000000010000000000000
50
000001000000000000000...

output:

50
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 50
42
1 3 2 5 4 7 6 12 15 18 21 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 50 7 8 7 9
29
3 6 10 9 12 11 14 13 16 15 18 17 20...

result:

ok all puzzle solved (20000 test cases)

Test #49:

score: 0
Accepted
time: 125ms
memory: 3440kb

input:

20000
50
10000000000000000000000001000000100001000001000000
50
00000010000000000100000000000000100000000000000000
50
00000000000100000000000000000000000000000000110000
50
00010000001000000000100000000000000000101000000000
50
00000000001000001000000000000000000000000000001000
50
000000000000000000010...

output:

29
4 7 10 13 16 19 22 25 27 30 34 33 36 35 41 45 44 47 46 49 48 2 1 2 50 36 37 36 38
17
3 6 8 11 14 17 19 22 25 28 31 35 38 41 44 47 50
41
3 6 9 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 47 50 43 44 43 45
25
3 5 8 12 11 14 13 16 15 18 17 20 19 21...

result:

ok all puzzle solved (20000 test cases)

Test #50:

score: 0
Accepted
time: 146ms
memory: 3428kb

input:

20000
50
01000110111111011011101100100001101110000011110000
50
11001101110000101110111011011100110101010000100000
50
01001001001110111010001011110100001011000100111000
50
10000100000010001000101101111001111001000000110111
50
11011111110000000101001011011111000100010010000000
50
010001101101110001000...

output:

30
4 15 18 17 19 22 21 23 25 29 39 42 47 50 8 9 8 10 11 12 11 13 31 32 31 33 43 44 43 45
33
4 7 6 8 11 10 13 12 24 27 26 28 31 30 35 37 39 41 44 46 49 13 14 13 15 20 21 20 22 31 32 31 33
27
4 6 10 20 19 22 21 23 31 30 33 32 40 44 50 11 12 11 13 33 34 33 35 45 46 45 47
29
3 7 6 9 8 11 10 16 18 22 21 ...

result:

ok all puzzle solved (20000 test cases)

Test #51:

score: 0
Accepted
time: 151ms
memory: 3536kb

input:

20000
50
11111111111111111111101111111111111110111111111111
50
11111111111111011101101111111111111111111111101111
50
11011101111111101111111111111111111111111111111011
50
11111111111111111111011111111111110011111111111111
50
10111101011111001111111111110110111111111111111111
50
111110111011111111111...

output:

62
22 21 23 38 37 39 20 19 18 20 17 16 15 17 14 13 12 14 11 10 9 11 8 7 6 8 5 4 3 5 2 1 2 50 24 25 24 26 27 28 27 29 30 31 30 32 33 34 33 35 40 41 40 42 43 44 43 45 46 47 46 48
58
15 14 16 19 18 20 22 46 45 47 13 12 11 13 10 9 8 10 7 6 5 7 4 3 2 4 1 50 1 49 23 24 23 25 26 27 26 28 29 30 29 31 32 33 ...

result:

ok all puzzle solved (20000 test cases)

Test #52:

score: 0
Accepted
time: 110ms
memory: 3488kb

input:

10204
98
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
98
00000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000001
98
100000000000000000000000000000000000000000000000000000000000000010000000000000000000000...

output:

98
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 98
32
2 5 8 11 ...

result:

ok all puzzle solved (10204 test cases)

Test #53:

score: 0
Accepted
time: 132ms
memory: 3452kb

input:

10204
98
01001000000010000000000000000000000001000000100000000001010010101001100000000000000100000000000000
98
01001010011000000000000000000000010000000000000000010000001010000100000000000000000000000000011000
98
000000000000000000000000010000100001100000000000000000000000000000000100000010000010000...

output:

47
4 6 9 12 14 17 20 23 26 29 32 35 39 38 41 40 43 42 48 51 54 59 58 66 65 70 73 76 79 82 86 89 92 95 98 43 44 43 45 59 60 59 61 66 67 66 68
48
4 6 8 13 16 19 22 25 28 31 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 52 55 58 60 62 65 67 70 73 76 79 82 85 88 91 98 93 94 93 95
71
1 3 2 5 4 7 ...

result:

ok all puzzle solved (10204 test cases)

Test #54:

score: 0
Accepted
time: 160ms
memory: 3476kb

input:

10204
98
01101000101101110010010011111111110100111100101000100100110101110011110010100001000100001001111111
98
11001101000110011001000010011001111000011001110001110001001001101000101010001011010011101011000101
98
111011110001011101110100011110000001101100010011100110111000101001100100111000101100101...

output:

82
1 4 3 5 8 10 13 12 14 17 16 23 22 38 43 48 47 50 49 51 55 54 59 61 71 70 77 81 80 83 82 84 87 91 17 18 17 19 23 24 23 25 26 27 26 28 29 30 29 31 32 33 32 34 39 40 39 41 55 56 55 57 62 63 62 64 66 67 66 68 71 72 71 73 92 93 92 94 95 96 95 97
65
4 7 6 8 11 14 13 18 22 26 25 30 37 47 53 57 56 67 72 ...

result:

ok all puzzle solved (10204 test cases)

Test #55:

score: 0
Accepted
time: 152ms
memory: 3428kb

input:

10204
98
11111111110101111111110110111111111111111111111111111111111111111111101111111011111111111110111111
98
11011010111111111111110111111111111111110111011111111011111101111011011111111111110111111111111111
98
111110011111111111111111111111111111111111011110111111111110111111011111111111111111111...

output:

111
23 26 25 27 92 91 93 11 10 9 11 8 7 6 8 5 4 3 5 2 1 2 98 13 14 13 15 16 17 16 18 19 20 19 21 28 29 28 30 31 32 31 33 34 35 34 36 37 38 37 39 40 41 40 42 43 44 43 45 46 47 46 48 49 50 49 51 52 53 52 54 55 56 55 57 58 59 58 60 61 62 61 63 64 65 64 66 67 68 67 69 78 79 78 80 81 82 81 83 84 85 84 86...

result:

ok all puzzle solved (10204 test cases)

Test #56:

score: 0
Accepted
time: 27ms
memory: 3532kb

input:

10101
99
000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000
99
000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000
99
0000000000000000000000000000000000000000000000000000000000000000000100000000000000000...

output:

0
0
0
0
0
0
0
0
33
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98
0
0
0
0
0
0
0
0
57
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 92 95 98 87 88 87 8...

result:

ok all puzzle solved (10101 test cases)

Test #57:

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

input:

10101
99
000000001100000000000000000000000100000000000000001000001000010000010000000000011000001000000000001
99
001000000000000001000001000000010000100010000100010000000000000000000110000000000000000000000000000
99
0001010000000000000001000000000000000100000011000000000000000000000001100001000000001...

output:

0
0
49
2 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 22 25 28 31 34 37 39 42 49 52 55 58 61 64 67 74 78 81 84 86 89 92 95 98 44 45 44 46 69 70 69 71
0
0
0
44
3 6 9 12 16 21 20 23 22 25 24 27 26 29 28 31 30 33 32 38 41 44 47 49 52 56 59 62 65 68 71 73 77 80 83 86 89 92 95 98 33 34 33 35
0
0
45
2 7 6 ...

result:

ok all puzzle solved (10101 test cases)

Test #58:

score: 0
Accepted
time: 40ms
memory: 3528kb

input:

10101
99
001000010000101100000001011010110000111100110110100010110011101001011000001001000111000000001100100
99
011101100010010001110110000111111101110101111000010100111100001111010001111000000111111010101001110
99
0010110101001100000000111110011101111010000110001000111101011011110000000000011001111...

output:

0
0
59
2 4 7 6 8 12 15 14 17 16 19 18 21 20 28 38 37 39 42 47 51 59 58 60 62 67 70 73 76 81 90 89 91 93 95 21 22 21 23 24 25 24 26 33 34 33 35 63 64 63 65 82 83 82 84 85 86 85 87
80
3 2 9 13 24 23 28 31 30 33 32 34 36 39 38 40 48 47 49 54 57 56 59 58 61 60 63 62 64 68 67 70 69 71 75 74 76 83 82 87 9...

result:

ok all puzzle solved (10101 test cases)

Test #59:

score: 0
Accepted
time: 30ms
memory: 3440kb

input:

10101
99
111111111111111111111111111110111101111111111111111111111011111111011001111111101011111110111101111
99
111111100111111111110111010011111111111111001011110111101111101111111110010111111111111111111011011
99
1111111111111111111111111111111111101111111101111111111111111111111111111111111111101...

output:

66
35 34 36 90 89 91 30 31 30 32 37 38 37 39 40 41 40 42 43 44 43 45 46 47 46 48 49 50 49 51 52 53 52 54 55 56 55 57 67 68 67 69 71 72 71 73 74 75 74 76 77 78 77 79 82 83 82 84 85 86 85 87 92 93 92 94
0
0
0
0
0
0
0
0
45
13 12 14 19 27 29 32 31 33 39 38 40 61 15 16 15 17 34 35 34 36 41 42 41 43 44 45...

result:

ok all puzzle solved (10101 test cases)

Test #60:

score: 0
Accepted
time: 114ms
memory: 3440kb

input:

10000
100
0000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000
100
0000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000100000000
100
00000000000000000000000000000000000000000000000000000000000000000100000000000000...

output:

33
3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 70 73 76 79 82 85 88 91 94 97 100
88
1 4 7 10 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76...

result:

ok all puzzle solved (10000 test cases)

Test #61:

score: 0
Accepted
time: 124ms
memory: 3492kb

input:

10000
100
1010000000000000000001000010000000000000000000000000000001001000100000000000000000000010101010001010
100
0000000000000000010000000000000100000000000000010000000000000000000001000000000100001010000000000010
100
00000001000100000000000001000000001100100000000100010001000010100100000001000000...

output:

43
2 1 3 6 9 12 15 18 21 23 26 28 31 34 37 40 43 46 49 52 55 59 58 64 66 69 72 75 78 81 84 88 87 89 94 93 96 95 97 59 60 59 61
48
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 18 21 24 27 30 34 37 40 43 46 50 53 56 59 62 65 68 72 75 78 82 86 85 87 90 93 96 1 100 1 99
60
1 4 7 9 13 12 15 14 17 16 19 18 2...

result:

ok all puzzle solved (10000 test cases)

Test #62:

score: 0
Accepted
time: 157ms
memory: 3492kb

input:

10000
100
1010001001011011111110111001111101010010100010000001010110111001011111011000111101010000101001110000
100
0001100111110110110101000101101001001001101010001001001100101010010011101001110001001110001010001011
100
10110100011010111110011011111010100001000101111101001101111011011111111111110011...

output:

78
4 3 6 5 7 11 10 12 14 22 37 36 43 47 50 55 54 56 58 65 64 66 71 74 73 76 75 77 85 84 87 86 93 99 15 16 15 17 18 19 18 20 23 24 23 25 27 28 27 29 30 31 30 32 37 38 37 39 59 60 59 61 67 68 67 69 78 79 78 80 87 88 87 89 94 95 94 96
49
2 7 13 12 14 16 19 18 20 24 33 35 39 42 41 43 47 51 53 58 60 62 6...

result:

ok all puzzle solved (10000 test cases)

Test #63:

score: 0
Accepted
time: 159ms
memory: 3416kb

input:

10000
100
1111111111111111111111111111111011001111111111111111110101011101101111111111111111111111011111111101
100
1111110111111111111111101101111111110111111011111111111011111111011111111111111111111110111111111111
100
11111111111110111111111111111111111111111011111101111111111111111111111111111111...

output:

64
32 31 33 35 57 56 58 99 30 29 28 30 27 26 25 27 24 23 22 24 21 20 19 21 18 17 16 18 15 14 13 15 12 11 10 12 9 8 7 9 6 5 4 6 3 2 1 3 63 64 63 65 89 90 89 91 92 93 92 94 95 96 95 97
90
44 56 55 57 65 88 7 6 5 7 4 3 2 4 1 100 1 99 24 25 24 26 37 38 37 39 40 41 40 42 45 46 45 47 48 49 48 50 51 52 51 ...

result:

ok all puzzle solved (10000 test cases)

Test #64:

score: 0
Accepted
time: 238ms
memory: 3536kb

input:

1002
998
100001101100001111110000010000010101010000000001010000011000011011000111100100001111110001100110111011000110110100110000011111001000010101110110000100101000110011111100100101110001110000001100101111000100100011100110000111111111110001000101001001000000100011011110001000110111111011011101111...

output:

866
2 1 4 3 8 11 10 13 12 21 20 23 22 25 24 26 29 33 32 34 39 38 41 40 43 42 45 44 47 46 48 52 55 58 57 60 59 64 67 66 69 68 70 77 76 79 78 87 86 89 88 90 92 100 103 102 105 104 106 108 111 110 112 119 130 129 132 131 141 144 143 146 145 152 151 153 156 159 158 167 166 173 172 174 177 176 179 178 18...

result:

ok all puzzle solved (1002 test cases)

Test #65:

score: 0
Accepted
time: 242ms
memory: 3512kb

input:

1002
998
000000000011100000000000011100011100000000000000000000011100000000111000000000011100000000000000000000000000001110000000000000000001001000000000111000110110000000000000000000000001101100000000011100000000000001110000000000000000000000001110000000111000000000000001110010010000000111000011100...

output:

986
1 3 2 5 4 7 6 9 8 14 13 16 15 18 17 20 19 22 21 24 23 29 28 31 30 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 56 59 58 61 60 63 62 65 64 70 69 72 71 74 73 76 75 78 77 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 100 103 102 105 104 107 106 109 108 114 113 11...

result:

ok all puzzle solved (1002 test cases)

Test #66:

score: 0
Accepted
time: 193ms
memory: 3508kb

input:

1002
998
000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

998
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 101 104 1...

result:

ok all puzzle solved (1002 test cases)

Test #67:

score: 0
Accepted
time: 182ms
memory: 3500kb

input:

1001
999
100011100111001011011111111111111010100011100011101111100010001100100000100001000111111010101100000011101001011100000111000011010110011100011111100101000001011000000000000111111110110011010110000011100000001010100011010110000001110010101010010100100010110111011110111101111111010110000110111...

output:

588
3 9 16 15 17 19 34 33 35 39 45 58 60 68 67 70 69 72 71 73 76 80 90 89 91 96 99 106 105 114 117 123 129 128 130 132 138 147 149 151 154 162 165 168 171 180 179 181 183 189 188 190 192 195 201 204 208 207 209 213 219 218 220 222 225 231 236 235 237 241 243 245 249 264 263 265 279 278 280 282 285 2...

result:

ok all puzzle solved (1001 test cases)

Test #68:

score: 0
Accepted
time: 150ms
memory: 3540kb

input:

1001
999
100111000000000000000000011111100000000000000000001110001110000000001110000000000001101100000011100000000000001110000000000000111000000000011100000000000000000000000000000000000000111000000000000000001110001110000011101110000000001110001101111100000001110010001100111001110000111000000000000...

output:

444
3 9 12 15 18 21 24 33 36 39 42 45 48 54 60 63 66 72 75 78 81 90 93 99 102 105 108 114 117 120 123 126 132 135 138 144 147 150 153 156 159 162 165 168 171 174 177 180 186 189 192 195 198 204 210 213 222 225 228 234 246 249 255 259 264 273 276 282 285 288 291 294 297 300 299 301 304 306 312 315 31...

result:

ok all puzzle solved (1001 test cases)

Test #69:

score: 0
Accepted
time: 115ms
memory: 3532kb

input:

1001
999
000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000...

output:

347
2 5 8 11 14 17 20 23 26 29 32 35 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 185 188 191 194 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 248 254 257...

result:

ok all puzzle solved (1001 test cases)

Test #70:

score: 0
Accepted
time: 246ms
memory: 3524kb

input:

1000
1000
11110000011100000010010001100010111011100011111100010110011000001101011111001000001010101011011011011111011111000000110001100011110010000111111000000111000000011100000000000001100011101100000111000011100000011100010001100100101111000010100110000000001001101110001101101001001100000000000001...

output:

863
5 4 7 6 9 8 10 13 12 15 14 17 16 23 22 25 24 26 28 32 31 33 36 35 37 40 39 42 41 43 49 48 51 50 52 57 60 59 62 61 64 63 65 67 69 75 74 80 84 83 85 90 89 91 93 96 95 97 99 105 104 106 111 114 121 124 123 126 125 127 134 133 136 135 144 143 146 145 148 147 153 152 155 154 157 156 159 158 160 163 1...

result:

ok all puzzle solved (1000 test cases)

Test #71:

score: 0
Accepted
time: 231ms
memory: 3504kb

input:

1000
1000
10000000111000000000000000000111011100000000000011100000000000000100011000000000000001110000000010101100100000000000000000000000000000111000000000111000000001111110000000000000000000000000000000111000000000001110001110000000000001110000000000111100100111000011100111000000111111000000000000...

output:

989
2 1 4 3 6 5 8 7 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 33 32 34 37 36 39 38 41 40 43 42 45 44 47 46 52 51 54 53 56 55 58 57 60 59 62 61 64 63 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 89 88 91 90 93 92 95 94 106 105 108 107 110 109 112 111 114 113 116 115 118 117 120 119 122 ...

result:

ok all puzzle solved (1000 test cases)

Test #72:

score: 0
Accepted
time: 191ms
memory: 3500kb

input:

1000
1000
00000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000011100111000000000000000000000000000000000000000000000000000...

output:

1002
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 101 104 ...

result:

ok all puzzle solved (1000 test cases)

Test #73:

score: 0
Accepted
time: 252ms
memory: 4024kb

input:

100
9998
000000010000011100100011010010010100110110001010010001010101110001111010011001111110010001010000000111101100000011011010001100101010011100000111110010111010110111100011001001000111011101110001111000010101000010000101101101100101000001110011010110000011100000111010000011110011100011010111010...

output:

8687
2 5 9 8 11 10 13 12 14 17 16 22 25 24 26 30 29 36 39 38 40 42 46 45 47 51 50 53 52 54 59 58 60 63 62 65 64 66 73 76 75 84 83 89 91 93 96 99 104 107 106 109 108 111 110 115 118 117 119 122 125 124 132 131 137 136 139 138 141 140 142 147 154 156 159 158 160 166 169 168 175 174 177 176 178 181 180...

result:

ok all puzzle solved (100 test cases)

Test #74:

score: 0
Accepted
time: 255ms
memory: 4060kb

input:

100
9998
001110000000000000000000000000000000000000000000000000111000000000001110000001111110000000000000000001110000000000111000000100011001110000000000000111000000000111110110000000000001110011100000000110110000000000000000000000000000000000000111000000001110000000000000000000000000000001110000000...

output:

9891
1 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 26 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 55 58 57 60 59 62 61 64 63 66 65 68 67 69 72 71 74 73 76 75 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 105 104 107 106 109 108 111 110 1...

result:

ok all puzzle solved (100 test cases)

Test #75:

score: 0
Accepted
time: 218ms
memory: 4172kb

input:

100
9998
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000001110000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

9992
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 100...

result:

ok all puzzle solved (100 test cases)

Test #76:

score: 0
Accepted
time: 190ms
memory: 4112kb

input:

100
9999
000000100101010100001000110110110110001011011011101110001100010101101110110000001110000001111110011101110011100110001100011000110111111111000001000000110110111010011110000000010101111001110001001000100001010011100000111111000110010001101010010000000010100111000011010011100000000000011101111...

output:

5843
2 5 9 11 13 15 17 20 22 37 50 56 59 58 61 60 62 77 80 86 89 101 110 115 120 125 139 142 146 149 162 161 170 173 177 176 178 185 191 193 197 201 205 204 206 212 215 224 229 231 240 239 245 248 252 251 253 259 262 265 264 266 272 275 278 281 287 293 292 295 294 299 302 301 304 303 305 316 320 332...

result:

ok all puzzle solved (100 test cases)

Test #77:

score: 0
Accepted
time: 74ms
memory: 4028kb

input:

100
9999
111011011111110010011111110001111111000111111111100011111111111111111111111111000100011111111111111110001111111111111111111000100011111111111111111111111111111111111110001111111100000011111111111110001100011111111111111110001111111111100011111111111111111111111000111000111111111110001111111...

output:

1032
16 18 28 38 51 80 84 103 125 129 169 180 183 199 204 223 237 263 269 283 318 320 333 335 338 346 352 356 362 375 379 411 416 423 429 433 464 481 487 555 586 624 637 651 661 665 669 671 692 701 709 755 761 765 771 775 795 817 820 828 862 865 873 886 907 914 925 931 940 942 948 972 986 995 999 10...

result:

ok all puzzle solved (100 test cases)

Test #78:

score: 0
Accepted
time: 129ms
memory: 4000kb

input:

100
9999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3533
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 188 191 194 197 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 248 251...

result:

ok all puzzle solved (100 test cases)

Test #79:

score: 0
Accepted
time: 259ms
memory: 3980kb

input:

100
10000
10010101110100001100111010010011100000000110011000001110010000110001111111001001111001101111100111001010011100100000000110010011100001010010010000110110100010110111010000111001100010110100000001111001000111000011100000100010110011111011001110000110110111110110000011000010001001110001110100...

output:

8809
2 1 11 13 16 19 18 24 23 25 29 28 34 33 36 35 38 37 40 39 44 49 52 59 58 61 60 65 75 74 84 83 88 94 93 99 98 105 112 111 114 113 116 115 118 117 122 126 132 137 136 143 142 145 144 149 152 151 153 156 158 161 160 162 165 164 166 169 175 178 177 180 179 181 187 186 189 188 191 190 193 192 194 20...

result:

ok all puzzle solved (100 test cases)

Test #80:

score: 0
Accepted
time: 247ms
memory: 4084kb

input:

100
10000
00000000011011000000000111000000011100000000000111111011101001000000000000000000000000000011100000000000000000000001110111000000000000011100000011100001110000000000000000000011100000000111000000001110000011100000000000000000000000000000011101110000000001110111000111000000010010000100100001...

output:

9862
1 3 2 5 4 7 6 9 8 10 12 15 14 17 16 19 18 21 20 23 22 24 27 26 29 28 31 30 33 32 34 37 36 39 38 41 40 43 42 45 44 47 46 48 54 53 55 58 57 59 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 94 93 96 95 98 97 100 99 102 101 104 103 106 105 108 107 110 109 112 1...

result:

ok all puzzle solved (100 test cases)

Test #81:

score: 0
Accepted
time: 224ms
memory: 4156kb

input:

100
10000
00000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000...

output:

10005
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 101 104...

result:

ok all puzzle solved (100 test cases)

Test #82:

score: 0
Accepted
time: 275ms
memory: 8840kb

input:

10
99998
000001000100100110111000110110110101100011011000110001111000000100000100001101011000000000011101001011101000000000010001001100011101110001111110011010011010010011010011000111111111000110101100000010010000000000011100000111011010110000110100001100000100100101101100000100111000111100011111000...

output:

87167
1 3 2 5 4 6 9 11 15 18 17 19 22 21 24 23 25 27 30 29 31 33 35 38 37 40 39 41 43 46 45 48 47 49 51 58 57 60 59 62 61 67 71 70 73 72 77 79 82 81 84 83 86 85 88 87 90 89 95 94 96 100 99 101 104 103 105 108 111 114 118 122 125 124 127 126 128 131 130 132 135 134 137 136 138 144 143 148 150 156 155...

result:

ok all puzzle solved (10 test cases)

Test #83:

score: 0
Accepted
time: 288ms
memory: 9388kb

input:

10
99998
111000000000111000000000000100100000000011111101110011011000000000000000001110010010000000011100111000000011100010001100001110000000000000000000000000111000000000000000000000001110011101110000010010011100000000011100011100011111100000000000000000000000111000000000000111001110000000111000011...

output:

98412
4 3 6 5 8 7 10 9 12 11 13 16 15 18 17 20 19 22 21 24 23 26 25 32 31 34 33 36 35 38 37 40 39 41 47 46 48 51 50 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 75 78 77 84 83 86 85 88 87 90 89 95 94 100 99 102 101 104 103 106 105 107 110 109 112 111 113 116 119 118 121 120 126 125 128 1...

result:

ok all puzzle solved (10 test cases)

Test #84:

score: 0
Accepted
time: 255ms
memory: 9768kb

input:

10
99998
000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

100025
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 101 10...

result:

ok all puzzle solved (10 test cases)

Test #85:

score: 0
Accepted
time: 217ms
memory: 8872kb

input:

10
99999
110110111001000110001010001010110011111011000001110000011100011101101101111000100001110011101100110000110100001010000000000011100001010110010011100000111010011000000110111011011111000000000011111101111111010011100111111000010101100000011111001000010000110110000011111100000000011100001110000...

output:

60107
11 13 20 22 24 28 27 29 34 40 39 41 43 46 52 55 61 77 81 87 101 107 106 109 108 115 118 121 124 130 135 134 136 138 142 148 154 156 161 164 172 175 174 176 181 184 187 190 207 206 212 211 220 219 222 221 232 235 241 240 246 250 259 262 271 274 277 283 289 292 298 304 307 314 316 319 323 325 32...

result:

ok all puzzle solved (10 test cases)

Test #86:

score: 0
Accepted
time: 181ms
memory: 8688kb

input:

10
99999
000000000000000000000001110000000000011100000000011100000011100000100100111001101100000000011111100000000000111000000000000000000000111000001101100000000000000000000000000000000011000100000000000000000000001110000000111000000000000111000000000111000000000011111100000000000000011100001110000...

output:

47241
2 5 8 11 14 17 20 23 29 32 35 41 44 47 53 56 62 65 69 71 77 80 79 81 83 86 89 98 101 104 107 113 116 119 122 125 128 131 137 140 143 142 144 146 149 152 155 158 161 164 167 170 173 176 183 185 188 191 194 197 200 203 206 212 215 221 224 227 230 236 239 242 248 251 254 263 266 269 272 275 281 2...

result:

ok all puzzle solved (10 test cases)

Test #87:

score: 0
Accepted
time: 157ms
memory: 9380kb

input:

10
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

34970
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 185 188 191 194 197 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 248 25...

result:

ok all puzzle solved (10 test cases)

Test #88:

score: 0
Accepted
time: 280ms
memory: 8840kb

input:

10
100000
11100000011100000000100110010111011011011100100100000111100011111011010101100111110111111111000000101100111110100010101101111110111110000111000011101101100000010010011000101110001111001100101000001001001110110001100001100011100011010101101101110011111110100100001110000001111111011011001001...

output:

87403
4 3 6 5 8 7 13 12 15 14 17 16 19 18 29 28 30 33 32 34 36 39 38 40 43 42 49 48 51 50 53 52 54 60 66 65 67 69 71 73 76 75 83 95 98 100 103 102 110 112 116 115 117 128 134 133 136 135 141 140 143 142 148 147 149 151 154 153 156 155 158 157 164 163 168 172 171 173 176 175 178 177 179 190 189 191 1...

result:

ok all puzzle solved (10 test cases)

Test #89:

score: 0
Accepted
time: 295ms
memory: 9436kb

input:

10
100000
10000000111000000000000011100000000000000000000000111000011011000000000000001110000000000001001000100100000000000001110000000000001110000000000001000110000000000011100000000001110000000011100000000111000011100000000000000000000000111000000000000000111000000000000000100100101011110000000000...

output:

98846
2 1 4 3 6 5 8 7 9 12 11 14 13 16 15 18 17 20 19 22 21 24 23 25 28 27 30 29 32 31 34 33 36 35 38 37 40 39 42 41 44 43 46 45 48 47 50 49 51 54 53 56 55 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 80 79 82 81 84 83 86 85 88 87 90 89 96 95 98 97 99 103 102 105 104 107 106 109 108 111 110 113 112 ...

result:

ok all puzzle solved (10 test cases)

Test #90:

score: 0
Accepted
time: 260ms
memory: 9688kb

input:

10
100000
00000000000000000000000000000000000011100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

99934
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 40 39 42 41 44 43 46 45 48 47 50 49 52 51 54 53 56 55 58 57 60 59 62 61 64 63 66 65 68 67 70 69 72 71 74 73 76 75 78 77 80 79 82 81 84 83 86 85 88 87 90 89 92 91 94 93 96 95 98 97 100 99 102 101 104...

result:

ok all puzzle solved (10 test cases)

Test #91:

score: 0
Accepted
time: 143ms
memory: 6484kb

input:

18
49998
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

16666
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 185 188 191 194 197 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 24...

result:

ok all puzzle solved (18 test cases)

Test #92:

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

input:

17
49998
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok all puzzle solved (17 test cases)

Test #93:

score: 0
Accepted
time: 169ms
memory: 6380kb

input:

18
49999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

50001
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 10...

result:

ok all puzzle solved (18 test cases)

Test #94:

score: 0
Accepted
time: 175ms
memory: 6440kb

input:

18
50000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

50000
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 10...

result:

ok all puzzle solved (18 test cases)

Test #95:

score: 0
Accepted
time: 196ms
memory: 8952kb

input:

10
99998
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

99998
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 10...

result:

ok all puzzle solved (10 test cases)

Test #96:

score: 0
Accepted
time: 159ms
memory: 7912kb

input:

8
99998
0101110010111110111111110111011111110111111011000100110110100011001100001110100111110110101110111110100111001011111010111010110011111110011000001100101100100010110111001111010011000110101001111011101101000101011101101001110111000011110110010011011010111110111110000100011001110111110000110001...

output:

71524
3 2 4 7 6 37 36 38 44 43 45 47 51 50 55 58 57 59 62 65 64 69 72 79 85 84 86 88 90 102 101 107 106 118 117 119 122 121 123 128 136 141 144 147 146 154 156 160 159 161 163 173 172 174 181 184 183 185 189 194 203 202 205 204 206 213 216 215 217 223 229 241 240 245 248 247 249 264 268 273 284 291 ...

result:

ok all puzzle solved (8 test cases)

Test #97:

score: 0
Accepted
time: 185ms
memory: 9276kb

input:

10
99999
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

33333
2 5 8 11 14 17 20 23 26 29 32 35 38 41 44 47 50 53 56 59 62 65 68 71 74 77 80 83 86 89 92 95 98 101 104 107 110 113 116 119 122 125 128 131 134 137 140 143 146 149 152 155 158 161 164 167 170 173 176 179 182 185 188 191 194 197 200 203 206 209 212 215 218 221 224 227 230 233 236 239 242 245 24...

result:

ok all puzzle solved (10 test cases)

Test #98:

score: 0
Accepted
time: 146ms
memory: 7660kb

input:

8
99999
0101101101110011111001101111001101101110011101011101000001110101110000111110101001110101111011001001101111011101011001111010010010010110001101110111111100011111110010011111011110111111101111010010001010011011100011101101000111111100110110001011110100100011110000100100101111100101010100001101...

output:

71300
3 2 4 6 9 8 10 13 12 20 29 28 33 36 35 37 40 39 45 44 46 53 52 55 54 57 56 58 61 60 62 68 80 79 85 84 86 98 97 102 107 122 121 123 127 126 133 132 134 136 153 152 155 154 156 166 165 173 178 186 191 193 197 202 201 206 212 221 220 223 222 224 239 247 246 248 252 251 254 253 255 261 265 267 279...

result:

ok all puzzle solved (8 test cases)

Test #99:

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

input:

9
99999
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

0
0
0
0
0
0
0
0
0

result:

ok all puzzle solved (9 test cases)

Test #100:

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

input:

8
99999
1100010010110101101110001110000100111000101001110111111111111011100101000010010111110010001101101101010011001011011010110100111101101011101110000011111001010111100101110000000111001111101100011011101101011111000110110110111111000101101011111101101001111111111000111100010110110101010100111011...

output:

0
0
0
0
0
0
0
0

result:

ok all puzzle solved (8 test cases)

Test #101:

score: 0
Accepted
time: 213ms
memory: 9460kb

input:

10
100000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

100000
1 3 2 5 4 7 6 9 8 11 10 13 12 15 14 17 16 19 18 21 20 23 22 25 24 27 26 29 28 31 30 33 32 35 34 37 36 39 38 41 40 43 42 45 44 47 46 49 48 51 50 53 52 55 54 57 56 59 58 61 60 63 62 65 64 67 66 69 68 71 70 73 72 75 74 77 76 79 78 81 80 83 82 85 84 87 86 89 88 91 90 93 92 95 94 97 96 99 98 101 1...

result:

ok all puzzle solved (10 test cases)

Test #102:

score: 0
Accepted
time: 168ms
memory: 7916kb

input:

8
100000
000110101100101001101001010111001011110110010111111011111011110111001111001110010111011010000110011011110011010111111111110001110011011010100000100111110111000110100011010100010010111101111111111011110101000000101111011010110111110110111111100001001111100101000011000101101000001111111111110...

output:

71321
3 6 5 7 12 14 16 22 21 31 39 38 40 42 52 58 57 59 68 73 79 81 90 89 92 91 96 105 104 109 111 123 122 125 124 126 129 128 133 136 135 137 141 144 146 157 165 171 170 172 175 177 185 184 186 203 202 204 207 210 212 217 220 219 221 242 241 244 243 257 256 258 261 266 275 278 313 312 314 320 319 3...

result:

ok all puzzle solved (8 test cases)

Test #103:

score: 0
Accepted
time: 125ms
memory: 9068kb

input:

9
99998
1010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

33334
2 1 3 6 9 12 15 18 21 24 27 30 33 36 39 42 45 48 51 54 57 60 63 66 69 72 75 78 81 84 87 90 93 96 99 102 105 108 111 114 117 120 123 126 129 132 135 138 141 144 147 150 153 156 159 162 165 168 171 174 177 180 183 186 189 192 195 198 201 204 207 210 213 216 219 222 225 228 231 234 237 240 243 24...

result:

ok all puzzle solved (9 test cases)