QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#765634#6336. CouncilKiharaTouma62 438ms34112kbC++232.1kb2024-11-20 14:52:392024-11-20 14:52:41

Judging History

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

  • [2024-11-20 14:52:41]
  • 评测
  • 测评结果:62
  • 用时:438ms
  • 内存:34112kb
  • [2024-11-20 14:52:39]
  • 提交

answer

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

const int N = 3e5 + 10;
int n, m, a[25][N], sum[25], v[N];
pair<int, int> f[N], g[N];

bool upd(int x, pair<int, int> y){
    if((f[x] > y || (f[x] == y && g[x] > y)) && f[x].second != y.second){
        g[x] = f[x];
        f[x] = y;
        return 1;
    } else if(g[x] > y && f[x].second != y.second){
        g[x] = y;
        return 1;
    }
    return 0;
}

int main(){
    for(int i = 0; i < N; ++ i){
        f[i].first = g[i].first = 2e9;
    }
    scanf("%d%d", &n, &m);
    queue<int> q;
    for(int i = 1; i <= n; ++ i){
        for(int j = 1; j <= m; ++ j){
            scanf("%d", &a[j][i]);
            sum[j] += a[j][i];
            v[i] |= (1 - a[j][i]) << j - 1;
        }
        upd(v[i], make_pair(0, i));
        q.push(v[i]);
    }
    while(!q.empty()){
        int x = q.front();
        q.pop();
        for(int i = 0; i < m; ++ i){
            int v = 1 + (1 - ((x >> i) & 1)) * 100;
            if(upd(x^(1<<i), make_pair(f[x].first+v, f[x].second))){
                q.push(x ^ (1 << i));
            } else if(upd(x^(1<<i), make_pair(g[x].first+v, g[x].second))){
                q.push(x ^ (1 << i));
            }
        }
    }
    for(int i = 1; i <= n; ++ i){
        int val = 0, cnt = 0;
        for(int j = 1; j <= m; ++ j){
            if(sum[j] - a[j][i] == n / 2){
                val |= 1 << j - 1;
            } else if(sum[j] - a[j][i] > n / 2){
                ++ cnt;
            }
        }
        int mx = 0;
        if(f[val].second == i){
            // printf("%d ", g[val].second);
            mx = val & v[g[val].second];
        } else {
            // printf("%d ", f[val].second);
            mx = val & v[f[val].second];
        }
        mx = __builtin_popcount(mx);
        if(n <= 3000)
        for(int j = 1; j <= n; ++ j){
            if(j != i){
                mx = max(mx, __builtin_popcount(val & v[j]));
            }
        }
        // printf("%d %d %d\n", cnt, mx, val);
        // printf("%d %d %d\n", val, f[val].second, f[val].first);
        printf("%d\n", mx + cnt);
    }
    return 0;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 275ms
memory: 34112kb

input:

38 20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 ...

output:

1
1
0
0
1
1
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
1
0
0

result:

wrong answer 1st numbers differ - expected: '18', found: '1'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 6
Accepted

Test #53:

score: 6
Accepted
time: 41ms
memory: 13900kb

input:

300000 2
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 300000 numbers

Test #54:

score: 6
Accepted
time: 38ms
memory: 15456kb

input:

300000 2
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0
0 0...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 300000 numbers

Test #55:

score: 6
Accepted
time: 32ms
memory: 13668kb

input:

300000 1
0
1
0
1
0
1
0
1
1
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 300000 numbers

Test #57:

score: 6
Accepted
time: 26ms
memory: 13276kb

input:

300000 1
1
0
1
1
1
0
1
1
1
1
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
1
0
0
0
0
0
1
1
0
1
0
1
1
1
0
0
1
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
1
0
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
1
1
0
1
0
0
1
1
1
0
0
1
1
0
0
1
1
0
1
0
0
0
1
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
1
1
1
1
0
1...

output:

0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
0
1
0
1
0
0
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
0
1
1
0
0
1
1
0
0
1
0
1
1
1
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
0
1
0
1
0
0
1
...

result:

ok 300000 numbers

Test #58:

score: 6
Accepted
time: 51ms
memory: 15736kb

input:

300000 2
0 0
0 0
1 0
0 1
0 0
1 1
1 0
0 1
1 0
1 0
0 1
1 1
0 0
0 1
0 0
1 1
1 1
0 0
0 1
1 1
0 1
0 0
0 0
1 1
1 0
1 0
1 0
0 0
1 1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5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 299999 numbers

Test #60:

score: 19
Accepted
time: 164ms
memory: 23788kb

input:

299997 9
0 1 0 1 1 1 0 0 1
1 1 0 1 0 0 0 1 0
0 0 1 0 1 1 0 1 0
1 0 1 0 1 0 1 0 1
0 0 1 1 0 1 0 1 1
0 1 1 0 1 1 0 0 1
0 0 0 1 1 1 0 1 0
0 0 0 1 1 1 1 0 1
1 0 0 1 1 0 1 0 0
0 1 1 1 0 0 0 1 1
1 0 1 1 0 0 0 1 1
0 1 1 0 1 0 0 1 1
0 1 0 1 0 0 1 1 1
0 1 1 1 0 1 0 0 1
1 0 1 1 0 0 0 1 0
1 1 0 0 1 0 1 0 1
0 1...

output:

4
5
5
4
4
4
5
4
5
4
4
4
4
4
5
4
4
5
5
5
5
5
5
4
5
4
4
5
4
4
5
4
5
5
5
5
5
4
4
4
5
5
5
4
5
4
5
4
5
4
5
4
4
5
4
4
4
5
4
5
5
5
5
5
5
4
5
5
5
5
5
5
4
5
5
4
5
4
4
5
4
4
5
5
4
4
5
5
5
5
4
4
4
5
5
4
5
5
5
5
4
4
4
5
5
4
5
5
5
5
4
5
5
4
4
4
5
5
5
5
5
5
4
5
4
5
4
4
4
4
4
4
5
4
5
5
5
5
5
5
5
4
5
4
5
4
5
4
4
4
...

result:

ok 299997 numbers

Test #61:

score: 19
Accepted
time: 167ms
memory: 24324kb

input:

299997 9
1 1 0 1 0 1 0 0 1
0 0 1 1 0 1 0 1 1
0 0 1 0 1 1 1 0 0
0 1 1 0 0 0 1 1 0
0 1 1 1 1 0 0 0 0
0 1 0 1 1 0 1 0 0
0 0 1 0 1 0 1 1 0
1 0 1 0 0 1 0 1 0
0 0 1 1 1 0 1 0 0
1 1 0 0 1 0 0 1 0
1 0 1 0 0 1 1 0 0
0 1 1 0 0 1 1 0 0
1 0 0 1 1 0 1 0 0
1 0 0 1 0 0 1 1 0
0 1 1 1 1 0 0 0 0
1 0 0 1 1 0 0 1 1
0 0...

output:

5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 299997 numbers

Test #62:

score: 19
Accepted
time: 154ms
memory: 24740kb

input:

300000 10
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 ...

output:

10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
10
...

result:

ok 300000 numbers

Test #63:

score: 19
Accepted
time: 154ms
memory: 25244kb

input:

300000 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
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 300000 numbers

Test #65:

score: 19
Accepted
time: 177ms
memory: 23824kb

input:

300000 10
1 1 1 0 0 0 0 0 1 0
1 0 0 0 0 1 0 1 0 0
1 0 1 1 1 1 0 1 1 1
0 1 0 0 1 1 1 0 1 0
1 0 1 0 1 1 1 1 0 1
0 0 1 0 1 1 1 0 0 1
1 0 1 0 1 1 1 1 1 1
0 0 1 0 0 0 1 0 0 1
1 0 0 1 1 1 1 0 1 1
0 0 0 1 0 0 0 0 0 1
1 0 1 1 0 0 1 1 1 1
1 0 1 1 1 0 0 1 0 1
1 1 0 0 1 1 1 0 1 1
0 0 0 1 0 0 1 0 0 1
0 0 1 0 1 ...

output:

8
9
6
6
7
7
6
9
6
9
8
8
5
9
9
9
8
8
7
7
8
7
7
8
8
7
7
7
7
6
8
9
7
7
7
6
9
9
7
8
7
6
8
9
7
6
6
6
7
9
9
8
8
9
8
6
8
7
7
5
7
6
7
7
6
7
6
8
6
8
7
7
8
7
7
9
8
8
8
8
8
7
6
6
8
9
7
7
8
7
8
9
8
7
8
8
7
6
8
9
10
7
8
8
8
9
8
8
8
8
8
7
7
8
7
6
10
8
7
7
8
10
7
7
8
6
6
5
8
7
5
8
6
10
7
9
8
8
8
8
7
8
10
7
8
7
7
8...

result:

ok 300000 numbers

Subtask #5:

score: 15
Accepted

Dependency #4:

100%
Accepted

Test #66:

score: 15
Accepted
time: 264ms
memory: 29768kb

input:

299999 14
0 0 0 1 1 0 1 0 0 0 1 1 1 1
0 0 1 0 1 0 1 1 1 1 0 1 0 0
0 0 1 1 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
7
6
7
6
6
7
7
6
7
7
6
7
7
7
7
6
6
7
6
6
7
7
6
6
6
7
6
7
7
7
6
6
7
6
6
7
7
6
6
6
6
7
6
7
7
6
7
7
6
7
7
6
6
7
6
6
6
7
7
6
7
6
6
6
7
6
7
6
6
6
6
7
7
7
7
7
6
6
7
...

result:

ok 299997 numbers

Test #68:

score: 15
Accepted
time: 237ms
memory: 28132kb

input:

299997 13
0 1 0 0 1 0 0 0 1 1 1 1 0
1 1 0 1 0 0 1 0 0 1 1 0 0
0 1 1 0 0 1 0 0 1 1 0 1 0
0 0 0 1 1 0 0 1 1 1 0 1 1
1 1 0 0 1 0 0 0 1 0 1 1 0
0 1 1 1 0 1 0 0 1 0 0 1 0
1 0 0 1 1 1 0 0 1 0 0 1 0
1 0 1 1 0 0 0 1 1 0 0 1 0
0 0 1 1 0 0 1 1 1 1 0 0 1
1 0 1 0 1 1 0 0 0 1 1 0 1
0 1 0 0 1 1 0 1 0 0 1 1 0
1 1 ...

output:

7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
7
...

result:

ok 299997 numbers

Test #69:

score: 15
Accepted
time: 219ms
memory: 29016kb

input:

300000 14
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 ...

output:

14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
...

result:

ok 300000 numbers

Test #70:

score: 15
Accepted
time: 214ms
memory: 30208kb

input:

300000 14
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 300000 numbers

Test #71:

score: 15
Accepted
time: 226ms
memory: 28100kb

input:

300000 14
1 1 1 1 0 0 1 1 1 0 1 1 1 0
1 0 0 1 1 0 0 1 0 0 0 1 0 1
1 0 1 1 1 1 0 1 1 1 0 1 1 1
1 0 0 1 0 1 1 0 1 0 0 0 1 0
1 0 0 1 0 0 1 1 1 0 0 1 1 1
1 1 0 1 0 0 1 1 1 1 1 0 0 1
1 0 1 1 1 1 1 0 1 1 0 0 0 0
0 1 0 1 0 0 1 1 0 1 0 1 1 0
0 1 0 1 1 1 1 1 1 0 1 0 1 1
1 1 1 0 1 0 0 0 1 1 0 1 0 1
1 0 1 1 1 ...

output:

5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
...

result:

ok 300000 numbers

Test #72:

score: 15
Accepted
time: 242ms
memory: 29920kb

input:

300000 14
1 1 1 1 0 0 1 0 0 1 0 0 0 1
0 1 1 1 0 1 0 1 0 1 1 0 0 1
1 0 0 1 1 0 0 1 1 0 1 0 1 0
1 1 0 0 1 0 1 0 0 1 1 0 0 1
1 1 0 1 1 0 0 1 1 0 0 0 1 0
1 1 1 1 0 1 0 0 1 1 1 1 1 1
1 0 1 1 0 1 0 1 0 1 1 0 1 0
1 1 1 0 1 0 1 0 0 0 0 1 1 0
1 1 1 0 0 1 0 0 0 1 0 0 0 1
0 1 1 1 1 1 1 1 0 0 0 1 1 1
1 0 0 0 0 ...

output:

12
10
10
14
10
9
9
12
12
9
12
12
11
10
10
12
11
11
12
11
12
12
13
9
12
11
13
11
11
8
12
14
12
10
9
13
11
12
12
11
11
12
10
11
12
10
12
10
10
11
11
10
12
10
11
12
9
10
12
10
11
11
10
10
10
10
9
11
12
11
11
13
11
13
10
11
9
10
11
9
11
12
11
11
11
10
12
9
12
10
11
11
11
11
13
9
13
11
11
12
12
11
11
11
...

result:

ok 300000 numbers

Subtask #6:

score: 22
Accepted

Dependency #5:

100%
Accepted

Test #73:

score: 22
Accepted
time: 327ms
memory: 32376kb

input:

300000 16
0 1 0 1 0 1 1 1 1 1 1 0 0 0 1 0
1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1
1 1 1 0 1 1 0 1 1 0 1 0 0 0 0 1
0 1 0 0 1 0 1 0 0 1 1 1 1 0 1 0
1 1 0 1 1 0 0 0 1 1 0 1 1 0 0 1
1 0 1 1 0 0 1 0 1 0 1 0 1 1 0 1
0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1
0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1
1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1
0 ...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
...

result:

ok 300000 numbers

Test #74:

score: 22
Accepted
time: 197ms
memory: 31112kb

input:

114692 17
0 0 1 1 0 1 0 1 0 0 1 0 1 1 0 0 0
1 1 1 1 0 0 0 1 1 1 1 0 1 1 1 1 0
1 0 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0
1 1 1 1 1 1 0 1 1 0 1 1 0 1 0 0 0
0 0 0 0 0 0 1 1 1 0 0 1 0 1 1 0 0
1 1 0 1 1 1 0 0 0 0 0 0 1 0 1 1 1
1 1 0 0 0 1 1 0 0 1 0 1 0 1 1 0 0
0 0 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0
1 1 1 0 1 0 0 1 1 ...

output:

17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
...

result:

ok 114692 numbers

Test #75:

score: 22
Accepted
time: 206ms
memory: 32144kb

input:

122884 17
1 0 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0
0 1 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0
1 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1
1 0 1 1 0 1 0 1 0 1 1 1 1 1 0 1 0
0 1 0 1 1 1 0 1 0 1 0 0 0 0 0 1 0
0 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0
1 0 1 1 0 1 0 0 1 1 1 1 1 0 0 1 0
0 1 0 0 0 1 0 1 0 0 1 1 1 0 1 0 1
1 0 0 1 1 0 0 1 0 ...

output:

17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
...

result:

ok 122884 numbers

Test #76:

score: 22
Accepted
time: 206ms
memory: 31320kb

input:

126980 17
1 0 0 1 0 0 0 0 1 1 1 0 0 1 1 1 0
0 1 0 1 0 1 1 0 1 0 0 1 1 1 0 0 1
0 1 1 1 1 1 1 1 0 0 0 1 0 1 1 1 0
0 0 1 0 1 1 1 1 0 1 0 0 0 1 0 0 0
0 0 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0
0 0 1 1 1 0 1 0 1 1 0 0 0 1 1 0 0
0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0
0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 1 1
0 0 0 0 0 1 1 1 0 ...

output:

17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
...

result:

ok 126980 numbers

Test #77:

score: 22
Accepted
time: 369ms
memory: 33140kb

input:

299999 16
0 1 0 1 0 0 0 0 0 1 1 1 1 0 1 1
0 0 0 1 1 1 0 0 1 0 1 0 0 1 1 1
0 1 1 1 0 1 0 1 1 1 0 0 0 1 0 0
1 1 0 0 0 1 1 1 0 1 1 1 0 0 0 0
0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0
1 0 0 1 0 0 1 0 0 1 1 1 0 1 0 1
1 0 0 1 1 1 0 1 0 0 0 1 1 1 0 0
1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 0
0 0 0 0 1 0 1 1 1 0 1 1 1 0 1 0
0 ...

output:

8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
...

result:

ok 299999 numbers

Test #78:

score: 22
Accepted
time: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
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
9
...

result:

ok 299997 numbers

Test #80:

score: 22
Accepted
time: 298ms
memory: 32348kb

input:

300000 17
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 ...

output:

17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
17
...

result:

ok 300000 numbers

Test #81:

score: 22
Accepted
time: 297ms
memory: 32984kb

input:

300000 17
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0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8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
...

result:

ok 300000 numbers

Test #83:

score: 22
Accepted
time: 396ms
memory: 32660kb

input:

300000 17
1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 0 1
1 1 0 1 0 0 1 1 0 1 1 0 1 0 1 1 1
0 1 0 0 0 0 0 1 0 0 0 1 0 1 1 1 1
0 1 1 1 0 0 1 0 1 0 1 0 0 0 0 0 1
0 0 0 1 0 0 1 1 1 1 1 1 0 0 0 1 1
1 0 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1
1 0 0 1 1 0 0 0 1 0 1 1 0 1 1 1 0
1 0 1 0 1 1 1 1 0 0 1 1 0 0 0 1 1
0 0 0 0 1 0 0 1 0 ...

output:

12
12
15
14
13
14
14
12
15
14
14
13
14
11
12
13
15
13
15
15
14
14
15
14
13
12
13
14
14
12
12
14
14
15
13
13
14
13
15
13
15
15
15
14
14
13
13
14
14
13
13
16
14
14
14
15
15
16
15
13
15
12
14
14
14
15
15
13
16
14
13
13
15
14
15
14
13
15
13
16
14
13
15
14
14
12
14
15
12
13
14
15
13
13
15
17
12
13
15
12
...

result:

ok 300000 numbers

Subtask #7:

score: 0
Skipped

Dependency #1:

0%