QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#308010#8018. 染色Lazy_Labs100 ✓401ms13772kbC++143.8kb2024-01-19 13:14:412024-01-19 13:14:41

Judging History

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

  • [2024-01-19 13:14:41]
  • 评测
  • 测评结果:100
  • 用时:401ms
  • 内存:13772kb
  • [2024-01-19 13:14:41]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
inline int read() {
    int x(0);
    char c = getchar();
    while (c < '0' || c > '9') c = getchar();
    while (c <= '9' && c >= '0') x = (x << 3) + (x << 1) + c - 48, c = getchar();
    return x;
}
inline void write(int x) {
    static int sta[35];
    int top = 0;
    do {
        sta[top++] = x % 10, x /= 10;
    } while (x);
    while (top) putchar(sta[--top] + 48);  // 48 是 '0'
    putchar(' ');
}
const int N = 2100;
int n, nn;
bitset<N << 1> mp[N], mpp[N], vis[N];
const int dx[5] = { 0, 0, 0, 1, -1 };
const int dy[5] = { 0, 1, -1, 0, 0 };
inline void qwq(int x, int y, bool q) {
    if (q)
        vis[x][y].flip();
    for (int i = 0; i < 5; i++) mp[(x + dx[i] + nn) % nn][(y + dy[i] + nn) % nn].flip();
}
inline void print() {
    for (int i = 0; i < nn; i++) {
        for (int j = 0; j < nn; j++) cerr << mp[i][j];
        cerr << endl;
    }
    cerr << "-------------" << endl;
}
inline void awa(int q) {
    for (int i = 1; i < nn; i++) {
        for (int j = 0; j < nn; j++)
            if (mp[i - 1][j])
                qwq(i, j, q);
        // print();
    }
}
bitset<N << 1> base[N << 1], tmp, ans[N << 1], p[N << 1];
inline void insert(bitset<N << 1>& x, int id) {
    bitset<N << 1> qwq;
    for (int i = (nn << 1) - 1; ~i; i--) {
        if (!x[i])
            continue;
        if (p[i] == 0) {
            p[i] = x;
            ans[i] = qwq.flip(id);
            break;
        }
        x ^= p[i];
        qwq = qwq ^ ans[i];
    }
}
int main() {
    srand(time(0));
    n = read();
    nn = 1 << n;
    qwq(0, 0, 0);
    awa(0);
    for (int i = 0; i < nn; i++) {
        base[i] = (mp[0] << nn) | mp[nn - 1];
        mp[0] <<= 1;
        mp[0][0] = mp[0][nn];
        mp[0][nn] = 0;
        mp[nn - 1] <<= 1;
        mp[nn - 1][0] = mp[nn - 1][nn];
        mp[nn - 1][nn] = 0;
    }
    for (int i = 0; i < nn; i++) mp[i].reset();
    qwq(nn - 1, 0, 0);
    awa(0);
    for (int i = nn; i < nn << 1; i++) {
        base[i] = (mp[0] << nn) | mp[nn - 1];
        mp[0] <<= 1;
        mp[0][0] = mp[0][nn];
        mp[0][nn] = 0;
        mp[nn - 1] <<= 1;
        mp[nn - 1][0] = mp[nn - 1][nn];
        mp[nn - 1][nn] = 0;
    }

    // for(int i=0;i<nn<<1;i++)
    // {
    //     for(int j=0;j<nn<<1;j++)
    //     cerr<<base[i][j];cerr<<endl;
    // }

    for (int i = 0; i < nn << 1; i++) insert(base[i], i);

    // for(int i=0;i<nn<<1;i++)
    // {
    //     for(int j=0;j<nn<<1;j++)
    //     cerr<<ans[i][j];cerr<<":";
    //     for(int j=0;j<nn<<1;j++)
    //     cerr<<p[i][j];cerr<<endl;
    // }

    for (int i = 0; i < nn; i++)
        for (int j = 0; j < nn; j++) mpp[i][j] = mp[i][j] = read();
    awa(0);
    tmp = (mp[0] << nn) | mp[nn - 1];
    bitset<N << 1> qans;
    // for(int i=(nn<<1)-1;~i;i--)cerr<<tmp[i];cerr<<endl;
    for (int i = (nn << 1) - 1; ~i; i--) {
        if (!tmp[i])
            continue;
        tmp ^= p[i];
        qans ^= ans[i];
    }
    // for(int i=(nn<<1)-1;~i;i--)cerr<<qans[i];

    for (int i = 0; i < nn; i++)
        for (int j = 0; j < nn; j++) mp[i][j] = mpp[i][j];
    for (int i = 0; i < nn; i++) vis[i].reset();
    for (int i = 0; i < nn << 1; i++)
        if (qans[i]) {
            if (i < nn)
                qwq(0, i, 1);
            else
                qwq(nn - 1, i - nn, 1);
        }
    awa(1);
    // for(int i=0;i<nn;i++)
    // {
    //     for(int j=0;j<nn;j++)cerr<<mp[i][j];
    //     cerr<<endl;
    // }
    // cerr<<"-------------"<<endl;
    int tot = 0;
    for (int i = 0; i < nn; i++) tot += vis[i].count();
    printf("%d\n", tot);
    for (int i = 0; i < nn; i++)
        for (int j = vis[i]._Find_first(); j < nn; j = vis[i]._Find_next(j)) write(i), write(j), puts("");
    return 0;
}

詳細信息

Test #1:

score: 5
Accepted
time: 2ms
memory: 10196kb

input:

2
0 0 1 1
1 0 1 0
0 0 0 0
1 1 1 0

output:

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

result:

ok n=4

Test #2:

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

input:

2
0 0 0 1
1 0 0 0
1 1 0 1
1 0 1 1

output:

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

result:

ok n=4

Test #3:

score: 5
Accepted
time: 1ms
memory: 8156kb

input:

2
1 1 1 0
0 1 0 0
1 0 1 0
0 1 0 1

output:

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

result:

ok n=4

Test #4:

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

input:

2
1 0 1 1
1 0 1 0
0 1 1 0
1 1 1 0

output:

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

result:

ok n=4

Test #5:

score: 5
Accepted
time: 2ms
memory: 11988kb

input:

4
0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 1
0 1 1 0 1 0 0 1 0 1 1 1 1 0 1 0
1 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0
1 0 0 0 1 1 0 0 0 0 0 1 1 1 1 1
0 1 0 0 0 1 1 1 0 1 1 1 1 0 1 0
0 1 1 1 1 1 0 0 1 1 0 0 1 1 1 0
1 1 1 0 1 0 1 1 0 1 0 1 1 1 0 0
1 1 1 1 0 1 1 1 0 1 1 0 0 0 1 1
0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 1
0 0 1 0 1 ...

output:

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

result:

ok n=16

Test #6:

score: 5
Accepted
time: 1ms
memory: 12256kb

input:

4
1 0 0 0 1 0 1 0 0 1 0 0 1 1 1 1
1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1
1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 0
1 0 1 0 0 1 1 0 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0
1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0
0 0 1 1 0 0 1 1 1 0 1 0 0 0 1 0
1 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1
1 1 1 1 1 0 0 0 0 1 0 1 0 0 1 0
1 0 0 0 0 ...

output:

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

result:

ok n=16

Test #7:

score: 5
Accepted
time: 1ms
memory: 7932kb

input:

4
1 0 1 1 0 1 0 0 1 0 1 1 0 1 0 1
1 0 1 0 1 1 1 0 1 0 1 0 1 1 0 0
1 0 0 0 0 1 0 1 0 1 0 1 1 1 0 1
1 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1
0 1 1 0 1 0 0 1 0 1 1 0 1 1 0 0
0 0 0 1 0 1 1 0 0 0 1 0 1 1 1 1
0 1 0 0 1 0 0 0 1 1 0 0 1 1 1 1
1 1 0 1 1 1 0 1 1 0 1 0 0 1 0 0
1 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0
1 1 1 1 0 ...

output:

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

result:

ok n=16

Test #8:

score: 5
Accepted
time: 3ms
memory: 12120kb

input:

7
1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 0 0 1 1 1 1 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0
1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 0 0 1 ...

output:

8269
0 1 
0 3 
0 4 
0 6 
0 8 
0 9 
0 10 
0 12 
0 14 
0 15 
0 16 
0 17 
0 18 
0 20 
0 21 
0 22 
0 27 
0 28 
0 33 
0 35 
0 37 
0 38 
0 39 
0 41 
0 42 
0 47 
0 48 
0 50 
0 53 
0 56 
0 57 
0 58 
0 71 
0 72 
0 76 
0 78 
0 79 
0 80 
0 81 
0 82 
0 83 
0 86 
0 89 
0 92 
0 93 
0 94 
0 98 
0 99 
0 100 
0 102 ...

result:

ok n=128

Test #9:

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

input:

7
1 1 0 1 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 1 1 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 0 1 1 1
1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 ...

output:

8192
0 0 
0 5 
0 6 
0 7 
0 8 
0 9 
0 11 
0 12 
0 13 
0 15 
0 16 
0 20 
0 24 
0 28 
0 29 
0 30 
0 31 
0 32 
0 35 
0 36 
0 37 
0 39 
0 45 
0 48 
0 51 
0 52 
0 55 
0 56 
0 57 
0 62 
0 64 
0 65 
0 68 
0 70 
0 75 
0 76 
0 77 
0 78 
0 80 
0 81 
0 82 
0 84 
0 85 
0 86 
0 88 
0 89 
0 94 
0 97 
0 103 
0 104 ...

result:

ok n=128

Test #10:

score: 5
Accepted
time: 3ms
memory: 12328kb

input:

7
1 0 1 1 1 0 0 0 1 1 0 0 1 1 0 0 0 1 0 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 1 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1
1 0 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 0 0 0 ...

output:

8280
0 0 
0 1 
0 3 
0 4 
0 6 
0 9 
0 11 
0 14 
0 20 
0 21 
0 23 
0 24 
0 25 
0 26 
0 28 
0 29 
0 31 
0 34 
0 38 
0 40 
0 45 
0 52 
0 53 
0 54 
0 55 
0 56 
0 60 
0 61 
0 64 
0 65 
0 66 
0 69 
0 70 
0 71 
0 72 
0 74 
0 75 
0 78 
0 80 
0 81 
0 89 
0 90 
0 92 
0 94 
0 95 
0 97 
0 98 
0 100 
0 102 
0 106...

result:

ok n=128

Test #11:

score: 5
Accepted
time: 393ms
memory: 13464kb

input:

11
1 1 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 0 1 1 0 0 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 1 0 1 0 0 1 1 1 1 1 0 0 0 0 1 0 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1...

output:

2099200
0 1 
0 3 
0 4 
0 5 
0 6 
0 7 
0 8 
0 11 
0 16 
0 19 
0 21 
0 27 
0 29 
0 30 
0 31 
0 34 
0 35 
0 38 
0 40 
0 41 
0 42 
0 46 
0 47 
0 53 
0 59 
0 61 
0 62 
0 63 
0 64 
0 65 
0 67 
0 68 
0 73 
0 83 
0 84 
0 86 
0 87 
0 89 
0 92 
0 94 
0 95 
0 99 
0 100 
0 101 
0 103 
0 108 
0 109 
0 110 
0 113...

result:

ok n=2048

Test #12:

score: 5
Accepted
time: 389ms
memory: 13772kb

input:

11
1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 0 0 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1...

output:

2114816
0 1 
0 2 
0 4 
0 8 
0 12 
0 13 
0 14 
0 16 
0 18 
0 23 
0 24 
0 27 
0 29 
0 33 
0 37 
0 38 
0 42 
0 43 
0 45 
0 46 
0 47 
0 48 
0 49 
0 50 
0 51 
0 54 
0 56 
0 57 
0 58 
0 63 
0 65 
0 68 
0 69 
0 70 
0 71 
0 73 
0 75 
0 80 
0 81 
0 82 
0 85 
0 92 
0 93 
0 94 
0 97 
0 98 
0 102 
0 104 
0 105 ...

result:

ok n=2048

Test #13:

score: 5
Accepted
time: 382ms
memory: 13420kb

input:

11
1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 1 1 1 1 0 1 0 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 0 1 0 1 0 1 1 0 1 1 1 0 1 1 0 0 1 1 1 1 0 1 1 0 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 1 0...

output:

2094848
0 1 
0 2 
0 3 
0 7 
0 10 
0 11 
0 13 
0 14 
0 17 
0 18 
0 19 
0 20 
0 23 
0 24 
0 26 
0 27 
0 28 
0 31 
0 33 
0 34 
0 35 
0 38 
0 39 
0 41 
0 43 
0 44 
0 45 
0 47 
0 51 
0 53 
0 59 
0 60 
0 61 
0 66 
0 68 
0 69 
0 73 
0 74 
0 75 
0 79 
0 81 
0 84 
0 86 
0 88 
0 90 
0 92 
0 93 
0 94 
0 96 
0 ...

result:

ok n=2048

Test #14:

score: 5
Accepted
time: 376ms
memory: 13444kb

input:

11
1 1 0 1 1 1 0 0 1 0 1 0 1 1 0 0 0 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 0 0 0 0 1...

output:

2131968
0 3 
0 6 
0 8 
0 10 
0 11 
0 12 
0 13 
0 14 
0 18 
0 19 
0 21 
0 22 
0 24 
0 26 
0 28 
0 30 
0 33 
0 34 
0 37 
0 39 
0 40 
0 41 
0 42 
0 43 
0 44 
0 46 
0 47 
0 48 
0 50 
0 56 
0 57 
0 58 
0 59 
0 60 
0 62 
0 64 
0 69 
0 71 
0 73 
0 75 
0 76 
0 77 
0 78 
0 79 
0 81 
0 85 
0 91 
0 92 
0 95 
0...

result:

ok n=2048

Test #15:

score: 5
Accepted
time: 395ms
memory: 13656kb

input:

11
1 1 0 0 0 0 1 0 1 1 1 0 0 1 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 1 0 1 1 0 0 0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 0 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1 0 0 0 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0...

output:

2099200
0 0 
0 1 
0 3 
0 5 
0 6 
0 8 
0 9 
0 11 
0 15 
0 19 
0 20 
0 21 
0 23 
0 24 
0 25 
0 27 
0 28 
0 29 
0 30 
0 31 
0 32 
0 36 
0 38 
0 39 
0 40 
0 42 
0 46 
0 48 
0 49 
0 51 
0 52 
0 55 
0 57 
0 59 
0 61 
0 62 
0 64 
0 65 
0 66 
0 67 
0 68 
0 69 
0 71 
0 73 
0 74 
0 77 
0 78 
0 79 
0 80 
0 85 ...

result:

ok n=2048

Test #16:

score: 5
Accepted
time: 401ms
memory: 13500kb

input:

11
1 0 1 1 1 1 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 1...

output:

2112256
0 0 
0 1 
0 5 
0 6 
0 8 
0 9 
0 12 
0 13 
0 15 
0 20 
0 21 
0 23 
0 25 
0 28 
0 29 
0 30 
0 32 
0 35 
0 36 
0 37 
0 39 
0 40 
0 41 
0 42 
0 43 
0 45 
0 46 
0 48 
0 54 
0 56 
0 57 
0 60 
0 62 
0 63 
0 64 
0 65 
0 66 
0 68 
0 73 
0 74 
0 75 
0 78 
0 79 
0 87 
0 88 
0 90 
0 91 
0 93 
0 96 
0 10...

result:

ok n=2048

Test #17:

score: 5
Accepted
time: 398ms
memory: 13484kb

input:

11
0 1 0 0 0 1 0 0 1 0 0 0 0 1 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 1 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 0...

output:

2092288
0 2 
0 3 
0 8 
0 9 
0 10 
0 12 
0 13 
0 14 
0 16 
0 17 
0 20 
0 21 
0 22 
0 27 
0 29 
0 30 
0 32 
0 34 
0 35 
0 37 
0 39 
0 42 
0 45 
0 46 
0 47 
0 49 
0 51 
0 58 
0 62 
0 63 
0 64 
0 71 
0 73 
0 74 
0 76 
0 79 
0 81 
0 83 
0 84 
0 85 
0 89 
0 90 
0 91 
0 95 
0 96 
0 97 
0 99 
0 100 
0 101 
...

result:

ok n=2048

Test #18:

score: 5
Accepted
time: 378ms
memory: 13520kb

input:

11
0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 1 1 0 0 0 0 1 1 0 0 0 1 0 0 1 1 0 1 1 0 0 1 0 1 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 0 1 0 1 0 0 0 1 0 0 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 1 1 0 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 1...

output:

2081792
0 2 
0 7 
0 8 
0 9 
0 11 
0 14 
0 15 
0 18 
0 19 
0 20 
0 21 
0 22 
0 24 
0 25 
0 27 
0 28 
0 29 
0 30 
0 32 
0 35 
0 36 
0 42 
0 43 
0 44 
0 45 
0 46 
0 48 
0 49 
0 53 
0 54 
0 55 
0 57 
0 59 
0 60 
0 61 
0 64 
0 65 
0 67 
0 68 
0 71 
0 72 
0 73 
0 74 
0 76 
0 77 
0 78 
0 79 
0 81 
0 83 
0 ...

result:

ok n=2048

Test #19:

score: 5
Accepted
time: 394ms
memory: 13384kb

input:

11
1 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 1 1 1 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0...

output:

2088960
0 0 
0 1 
0 2 
0 4 
0 5 
0 7 
0 8 
0 10 
0 12 
0 14 
0 15 
0 16 
0 19 
0 25 
0 26 
0 29 
0 30 
0 32 
0 33 
0 39 
0 40 
0 42 
0 43 
0 44 
0 45 
0 46 
0 47 
0 49 
0 51 
0 53 
0 56 
0 57 
0 58 
0 60 
0 62 
0 63 
0 65 
0 66 
0 67 
0 69 
0 70 
0 72 
0 73 
0 74 
0 75 
0 78 
0 80 
0 82 
0 86 
0 88 ...

result:

ok n=2048

Test #20:

score: 5
Accepted
time: 387ms
memory: 13448kb

input:

11
0 0 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 1 1 0 0 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 0...

output:

2093568
0 0 
0 3 
0 5 
0 6 
0 7 
0 8 
0 9 
0 10 
0 12 
0 16 
0 18 
0 22 
0 24 
0 25 
0 27 
0 31 
0 32 
0 35 
0 37 
0 38 
0 44 
0 47 
0 50 
0 51 
0 52 
0 53 
0 58 
0 59 
0 62 
0 65 
0 67 
0 68 
0 69 
0 71 
0 73 
0 75 
0 79 
0 81 
0 82 
0 83 
0 84 
0 86 
0 91 
0 92 
0 95 
0 97 
0 102 
0 105 
0 106 
0 ...

result:

ok n=2048