QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#787359#9800. Crisis Event: MeteoritequailtyAC ✓214ms112748kbC++233.7kb2024-11-27 11:16:382024-11-27 11:16:48

Judging History

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

  • [2024-11-27 11:16:48]
  • 评测
  • 测评结果:AC
  • 用时:214ms
  • 内存:112748kb
  • [2024-11-27 11:16:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int get(int l,int r,const vector<int>& sum)
{
    return sum[r]-(l ? sum[l-1] : 0);
}
struct Data
{
    int l,r,v;
};
void radix_sort(int n,vector<Data>& seg)
{
    vector<vector<int>> id(n);
    for(size_t i=0;i<seg.size();i++)
        id[seg[i].l].push_back(i);
    vector<int> tid;
    for(int i=0;i<n;i++)
        for(auto j : id[i])
            tid.push_back(j);
    for(int i=0;i<n;i++)
        id[i].clear();
    for(auto i : tid)
        id[seg[i].r].push_back(i);
    tid.clear();
    for(int i=0;i<n;i++)
        for(auto j : id[i])
            tid.push_back(j);
    vector<Data> tseg;
    for(auto i : tid)
        tseg.push_back(seg[i]);
    seg.swap(tseg);
}
const int INF=0x3f3f3f3f;
void trans(int n,vector<Data>& seg,const vector<int>& a,const vector<int>& sum)
{
    vector<int> tl(n,-1),tr(n,n+1),cnt(n);
    for(int i=0;i<n;i++)
    {
        if(i>0)tl[i]=tl[i-1],cnt[i]=cnt[i-1];
        if(a[i]==0)tl[i]=i,cnt[i]++;
    }
    for(int i=n-1;i>=0;i--)
    {
        if(i<n-1)tr[i]=tr[i+1];
        if(a[i]==0)tr[i]=i;
    }
    vector<Data> tseg;
    for(auto& [l,r,v] : seg)
    {
        if(get(l,r,cnt)>0)
        {
            tseg.push_back(Data{l,r,v});
            continue;
        }
        if(tl[l]>=0)tseg.push_back(Data{tl[l],r,v+get(tl[l],l-1,sum)});
        if(tr[r]<=n-1)tseg.push_back(Data{l,tr[r],v+get(r+1,tr[r],sum)});
    }
    radix_sort(n,tseg);
    seg.clear();
    for(size_t i=0,j=0;i<tseg.size();i=j)
    {
        while(j<tseg.size() && tseg[i].l==tseg[j].l && tseg[i].r==tseg[j].r)j++;
        int mi=INF;
        for(size_t k=i;k<j;k++)
            mi=min(mi,tseg[k].v);
        seg.push_back(Data{tseg[i].l,tseg[i].r,mi});
    }
}
int first_round(int n,const vector<Data>& seg,const vector<int>& p,const vector<int>& a)
{
    if(seg.empty())return -1;
    vector<vector<pair<int,int>>> go(n);
    for(auto& [l,r,v] : seg)
        go[l].emplace_back(r+1,v);
    vector<array<int,3>> dp(n+1,{INF,INF,INF});
    dp[0][0]=0;
    deque<pair<int,int>> que;
    for(int i=0;i<=n;i++)
    {
        if(!que.empty())
        {
            for(auto j : {0,2})
                dp[i][j]=min(dp[i][j],que.front().first);
            while(!que.empty() && que.front().second<=i)
                que.pop_front();
        }
        if(i==n)break;
        for(auto& [r,v] : go[i])
        {
            int t=min(dp[i][0],dp[i][1])+v;
            while(!que.empty() && que.back().first>=t)
                que.pop_back();
            que.emplace_back(t,r);
        }
        if(p[i]==0)dp[i+1][0]=min({dp[i+1][0],dp[i][0],dp[i][2]});
        dp[i+1][1]=min(dp[i+1][1],min({dp[i][0],dp[i][1],dp[i][2]})+a[i]);
        dp[i+1][2]=min(dp[i+1][2],dp[i][2]+a[i]);
    }
    return min(dp[n][0],dp[n][2]);
}
int solve()
{
    int n,m;
    scanf("%d%d",&n,&m);
    vector<int> p(n);
    for(int j=0;j<n;j++)
        scanf("%d",&p[j]);
    vector<vector<int>> a(m,vector<int>(n));
    for(int i=0;i<m;i++)
        for(int j=0;j<n;j++)
            scanf("%d",&a[i][j]);
    for(int j=0;j<n;j++)
        if(p[j] && a[0][j])
            return 0*printf("-1\n");
    vector<vector<int>> sum(a);
    for(int i=0;i<m;i++)
        for(int j=1;j<n;j++)
            sum[i][j]+=sum[i][j-1];
    for(int i=1;i<m;i++)
        for(int j=0;j<n;j++)
            sum[i][j]+=sum[i-1][j];
    vector<Data> seg;
    for(int j=0;j<n;j++)
        if(!a[m-1][j])
            seg.push_back(Data{j,j,get(j,j,sum[m-1])});
    for(int i=m-2;i>=0;i--)
        trans(n,seg,a[i],sum[i]);
    return 0*printf("%d\n",first_round(n,seg,p,a[0]));
}
int main()
{
    int T;
    scanf("%d",&T);
    while(T--)solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

4
-1

result:

ok 2 number(s): "4 -1"

Test #2:

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

input:

1
1 1
1
0

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 108ms
memory: 3864kb

input:

10000
3 15
0 0 1
0 0 0
0 0 0
0 0 0
818 0 0
0 404 0
0 684 0
0 0 966
0 69 602
0 835 443
458 0 189
0 0 388
0 0 0
768 128 0
0 959 466
0 324 170
59 1
1 0 1 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 0 0 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1
0 223 0 0 0 260 0 0 0 504 0 583 878 0...

output:

6752
0
10413
9051
269
1929
0
0
2916
11547
5480
0
0
0
5657
0
5698
0
1667
5203
15
0
0
3821
0
0
2787
0
0
0
0
5491
0
0
656
0
14166
0
3580
4368
11430
3464
0
2265
2558
1479
5546
4361
803
0
2782
0
4382
11377
1963
0
0
135
0
0
642
0
0
0
48
0
720
900
6297
0
0
6830
79
8743
7445
20
0
2256
0
0
0
6783
1383
115
99...

result:

ok 10000 numbers

Test #4:

score: 0
Accepted
time: 56ms
memory: 3788kb

input:

10000
8 1
1 1 0 1 0 1 0 0
0 0 0 0 0 0 0 720
6 7
0 0 1 0 1 0
0 403 0 0 0 396
0 231 0 0 0 899
0 240 0 0 0 481
0 0 0 0 0 0
0 0 0 0 0 0
561 746 26 475 0 0
0 645 0 0 642 12
7 3
0 0 0 0 0 0 1
409 416 229 63 74 908 0
972 0 159 0 521 0 405
9 0 0 0 232 616 591
10 5
0 0 0 0 0 0 0 0 0 1
838 638 810 52 612 423 ...

output:

0
475
1045
2195
739
11773
537
0
1060
353
1802
365
1788
3269
1527
5540
0
501
692
285
1922
0
0
0
0
0
173
0
0
0
2186
980
0
0
11941
1515
2320
4223
1582
2721
3872
0
2919
0
1348
3441
5632
2219
0
1710
1750
0
1524
705
6258
0
612
1686
0
0
439
473
2231
162
0
4974
0
1337
4096
736
0
0
0
0
998
1493
2552
0
821
0
...

result:

ok 10000 numbers

Test #5:

score: 0
Accepted
time: 73ms
memory: 4484kb

input:

100
17 277
0 0 0 1 0 0 1 1 1 1 1 0 0 1 0 0 0
610 0 213 0 232 0 0 0 0 0 0 0 382 0 0 570 0
0 0 0 0 0 0 0 0 0 0 885 0 0 832 0 498 0
461 345 737 410 85 365 0 0 459 896 445 0 0 772 0 384 802
239 155 968 390 252 498 0 915 157 562 174 91 664 729 815 341 279
0 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:

902404
0
600634
0
95039
0
229005
396057
0
1955662
676001
95686
144925
322152
59841
-1
0
60303
926998
0
258911
174619
320779
214778
0
660370
1094646
95717
925048
71630
1973713
520775
0
985624
109393
227881
-1
-1
495469
503513
6920
357305
418520
9242
-1
0
171193
-1
17772
83042
83001
0
1194869
813850
-...

result:

ok 100 numbers

Test #6:

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

input:

100
66 74
0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0
0 0 0 762 0 0 0 0 0 0 0 0 0 0 0 0 0 775 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 925 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 515 0 0 0 0 0 0 0
339 578 0 0 245 0 ...

output:

646092
58340
-1
243013
258670
246289
114343
784136
463808
64710
111948
81778
228847
4658
85953
23898
50118
293339
86615
392721
332718
58773
488334
34436
14723
74028
217085
144927
123259
833679
36630
63758
275836
355135
50369
43021
95515
71995
36353
13203
116872
224039
43894
516158
84806
12223
2520
2...

result:

ok 100 numbers

Test #7:

score: 0
Accepted
time: 8ms
memory: 5500kb

input:

1
12500 8
1 1 0 1 1 1 1 0 1 1 0 1 0 0 0 0 0 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 0 1 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 0 1 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 1 0 1 0 0 0 0 1 0 0 0 1 1 1 0 1 0 1 1 0 1 0 0 1 0 0 1 0 0 ...

output:

1906109

result:

ok 1 number(s): "1906109"

Test #8:

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

input:

1
20 5000
1 1 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 1
0 0 0 0 0 185 0 0 0 0 553 0 0 0 312 870 0 62 0 0
584 0 542 93 888 0 0 0 0 655 0 0 740 0 364 164 0 715 508 18
599 0 0 0 406 0 0 0 31 0 0 0 0 0 0 492 0 0 0 0
651 365 0 818 50 650 0 540 670 0 761 113 0 669 774 444 993 747 0 0
0 217 659 511 355 0 507 502...

output:

-1

result:

ok 1 number(s): "-1"

Test #9:

score: 0
Accepted
time: 55ms
memory: 8848kb

input:

1
808 765
1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 0 0 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 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 ...

output:

39883986

result:

ok 1 number(s): "39883986"

Test #10:

score: 0
Accepted
time: 214ms
memory: 112748kb

input:

1
1 1000000
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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

result:

ok 1 number(s): "0"

Test #11:

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

input:

1
1 1000000
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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:

-1

result:

ok 1 number(s): "-1"

Test #12:

score: 0
Accepted
time: 102ms
memory: 40788kb

input:

1
500000 2
1 1 1 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 0 0 0 0 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

154877

result:

ok 1 number(s): "154877"

Test #13:

score: 0
Accepted
time: 123ms
memory: 62992kb

input:

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

output:

44789

result:

ok 1 number(s): "44789"

Test #14:

score: 0
Accepted
time: 93ms
memory: 45492kb

input:

1
500000 2
0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 1 1 1 0 0 0 0...

output:

21212

result:

ok 1 number(s): "21212"

Test #15:

score: 0
Accepted
time: 84ms
memory: 32816kb

input:

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

output:

82936078

result:

ok 1 number(s): "82936078"

Test #16:

score: 0
Accepted
time: 156ms
memory: 92704kb

input:

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

output:

377050

result:

ok 1 number(s): "377050"

Test #17:

score: 0
Accepted
time: 102ms
memory: 44176kb

input:

1
500000 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...

output:

3633552

result:

ok 1 number(s): "3633552"

Test #18:

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

input:

1
500000 2
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 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

2701175

result:

ok 1 number(s): "2701175"

Test #19:

score: 0
Accepted
time: 134ms
memory: 94200kb

input:

1
500000 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...

output:

3831

result:

ok 1 number(s): "3831"

Test #20:

score: 0
Accepted
time: 106ms
memory: 46164kb

input:

1
500000 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

3008941

result:

ok 1 number(s): "3008941"

Test #21:

score: 0
Accepted
time: 89ms
memory: 26252kb

input:

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

output:

3063817

result:

ok 1 number(s): "3063817"

Test #22:

score: 0
Accepted
time: 144ms
memory: 45588kb

input:

1
200000 5
0 1 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0...

output:

9848139

result:

ok 1 number(s): "9848139"

Test #23:

score: 0
Accepted
time: 112ms
memory: 33460kb

input:

1
200000 5
0 1 0 1 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 0 1 1...

output:

11569501

result:

ok 1 number(s): "11569501"

Test #24:

score: 0
Accepted
time: 112ms
memory: 37520kb

input:

1
200000 5
1 0 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 0 0 0 0 0 0 0 1 1 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 1 0 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 1 0 0 1...

output:

630773

result:

ok 1 number(s): "630773"

Test #25:

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

input:

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

output:

11441507

result:

ok 1 number(s): "11441507"

Test #26:

score: 0
Accepted
time: 136ms
memory: 36504kb

input:

1
200000 5
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 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 1 0 0 0 0 0 0 0 0 0 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 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 0 0 0 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:

5934202

result:

ok 1 number(s): "5934202"

Test #27:

score: 0
Accepted
time: 93ms
memory: 28064kb

input:

1
200000 5
0 1 0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 0 0 0...

output:

8173171

result:

ok 1 number(s): "8173171"

Test #28:

score: 0
Accepted
time: 103ms
memory: 32564kb

input:

1
200000 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

1064429

result:

ok 1 number(s): "1064429"

Test #29:

score: 0
Accepted
time: 81ms
memory: 25172kb

input:

1
200000 5
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

818194

result:

ok 1 number(s): "818194"

Test #30:

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

input:

1
100000 10
1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 1 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 1 0 1 0 1 1 1 0 0 1 1 1 0 0 1 0 0 ...

output:

1235113

result:

ok 1 number(s): "1235113"

Test #31:

score: 0
Accepted
time: 111ms
memory: 26732kb

input:

1
100000 10
1 0 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 0 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 ...

output:

9869675

result:

ok 1 number(s): "9869675"

Test #32:

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

input:

1
100000 10
0 0 0 1 1 0 1 1 1 0 0 1 0 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 0 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 0 1 0 1 0 1 0 0 0 1 1 0 1 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 1 0 0 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 ...

output:

7196862

result:

ok 1 number(s): "7196862"

Test #33:

score: 0
Accepted
time: 163ms
memory: 30084kb

input:

1
100000 10
1 1 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 1 0 0 0 0 1 1 1 0 1 1 0 0 0 1 1 0 0 1 1 0 0 1 0 0 0 0 1 1 0 1 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 0 1 0 0 1 ...

output:

9872682

result:

ok 1 number(s): "9872682"

Test #34:

score: 0
Accepted
time: 166ms
memory: 32268kb

input:

1
100000 10
0 1 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 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 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 0 0 1 0 0 0 0 0 0 0 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:

13049

result:

ok 1 number(s): "13049"

Test #35:

score: 0
Accepted
time: 130ms
memory: 28960kb

input:

1
100000 10
1 0 1 0 1 1 0 0 0 0 1 0 1 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 ...

output:

13771636

result:

ok 1 number(s): "13771636"

Test #36:

score: 0
Accepted
time: 67ms
memory: 17272kb

input:

1
100000 10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

30911184

result:

ok 1 number(s): "30911184"

Test #37:

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

input:

1
100000 10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 1 0 0 0 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:

207086

result:

ok 1 number(s): "207086"

Test #38:

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

input:

1
100000 10
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 ...

output:

393255

result:

ok 1 number(s): "393255"

Test #39:

score: 0
Accepted
time: 108ms
memory: 25520kb

input:

1
50000 20
0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 0 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 0 1 0...

output:

1240552

result:

ok 1 number(s): "1240552"

Test #40:

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

input:

1
50000 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1...

output:

626260

result:

ok 1 number(s): "626260"

Test #41:

score: 0
Accepted
time: 131ms
memory: 20384kb

input:

1
50000 20
1 1 0 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0 0 0 0 0 1 1 0 0 0 1 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 0 1 1 0 1 0 1 1 1 1 0 1 1 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 0 0 1 0...

output:

5804743

result:

ok 1 number(s): "5804743"

Test #42:

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

input:

1
50000 20
0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 1 0 1 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0...

output:

17117278

result:

ok 1 number(s): "17117278"

Test #43:

score: 0
Accepted
time: 133ms
memory: 21664kb

input:

1
50000 20
0 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 1 1 0 1 0 0 0 1 1 1 1 1 0 1 1 0 0 0 1 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 1 1 1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 1 1 0 1 0 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1...

output:

1901504

result:

ok 1 number(s): "1901504"

Test #44:

score: 0
Accepted
time: 134ms
memory: 17208kb

input:

1
50000 20
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 1 0 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 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 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:

14451721

result:

ok 1 number(s): "14451721"

Test #45:

score: 0
Accepted
time: 82ms
memory: 14440kb

input:

1
50000 20
1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0...

output:

7645412

result:

ok 1 number(s): "7645412"

Test #46:

score: 0
Accepted
time: 108ms
memory: 19676kb

input:

1
50000 20
0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0...

output:

1504165

result:

ok 1 number(s): "1504165"

Test #47:

score: 0
Accepted
time: 104ms
memory: 18756kb

input:

1
50000 20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

88321

result:

ok 1 number(s): "88321"

Test #48:

score: 0
Accepted
time: 102ms
memory: 15216kb

input:

1
20000 50
1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 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 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 1 1...

output:

89216557

result:

ok 1 number(s): "89216557"

Test #49:

score: 0
Accepted
time: 83ms
memory: 13112kb

input:

1
20000 50
1 1 1 1 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 0 1 1 0 1 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 1 1 0 0 1 0 1...

output:

1541442

result:

ok 1 number(s): "1541442"

Test #50:

score: 0
Accepted
time: 101ms
memory: 13620kb

input:

1
20000 50
0 0 1 1 1 1 1 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 0 1 1 1 1 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 1 0 1 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 1 0 0 1 0 0 1 0 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0 1 1 0 1 0...

output:

4692084

result:

ok 1 number(s): "4692084"

Test #51:

score: 0
Accepted
time: 126ms
memory: 14832kb

input:

1
20000 50
1 0 0 1 1 1 0 1 1 1 0 0 1 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 1 1 0 0 0 0 1 1 0 1 0 0 0 1 1 1 1 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1...

output:

646082

result:

ok 1 number(s): "646082"

Test #52:

score: 0
Accepted
time: 104ms
memory: 13888kb

input:

1
20000 50
0 0 0 0 0 0 0 0 0 0 0 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 1 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 1 0 0 1 0 0 1 0 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 0 0 0 0 0 0 0 0 0 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:

9110638

result:

ok 1 number(s): "9110638"

Test #53:

score: 0
Accepted
time: 121ms
memory: 13896kb

input:

1
20000 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0...

output:

3457736

result:

ok 1 number(s): "3457736"

Test #54:

score: 0
Accepted
time: 119ms
memory: 14968kb

input:

1
20000 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 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 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

4148699

result:

ok 1 number(s): "4148699"

Test #55:

score: 0
Accepted
time: 85ms
memory: 13420kb

input:

1
20000 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

331723

result:

ok 1 number(s): "331723"

Test #56:

score: 0
Accepted
time: 68ms
memory: 13384kb

input:

1
20000 50
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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

642587

result:

ok 1 number(s): "642587"

Test #57:

score: 0
Accepted
time: 63ms
memory: 11736kb

input:

1
10000 100
1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 0 1 1 0 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 0 1 1 1 1 1 1 1 1 1 0 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 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

36645043

result:

ok 1 number(s): "36645043"

Test #58:

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

input:

1
10000 100
1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 1 1 0 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 ...

output:

9345100

result:

ok 1 number(s): "9345100"

Test #59:

score: 0
Accepted
time: 101ms
memory: 13168kb

input:

1
10000 100
0 0 1 1 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 0 1 0 1 0 1 1 0 1 1 0 1 1 1 0 0 0 1 1 1 0 1 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 0 1 0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 0 0 1 1 0 1 0 0 1 1 1 1 0 1 1 1 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 0 0 0 1 1 1 1 0 ...

output:

3713760

result:

ok 1 number(s): "3713760"

Test #60:

score: 0
Accepted
time: 70ms
memory: 12220kb

input:

1
10000 100
1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 1 1 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 1 1 1 0 1 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 1 0 0 1 1 0 1 0 0 1 0 1 1 1 1 0 ...

output:

3494889

result:

ok 1 number(s): "3494889"

Test #61:

score: 0
Accepted
time: 99ms
memory: 12540kb

input:

1
10000 100
1 0 0 0 0 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 1 1 0 1 1 0 1 1 1 1 0 0 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 0 1 1 1 0 1 1 0 0 1 0 0 1 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 ...

output:

372328

result:

ok 1 number(s): "372328"

Test #62:

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

input:

1
10000 100
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 ...

output:

4377215

result:

ok 1 number(s): "4377215"

Test #63:

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

input:

1
10000 100
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 ...

output:

3673637

result:

ok 1 number(s): "3673637"

Test #64:

score: 0
Accepted
time: 126ms
memory: 13096kb

input:

1
10000 100
0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

430965

result:

ok 1 number(s): "430965"

Test #65:

score: 0
Accepted
time: 94ms
memory: 12988kb

input:

1
10000 100
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

3847

result:

ok 1 number(s): "3847"

Test #66:

score: 0
Accepted
time: 91ms
memory: 12492kb

input:

1
5000 200
1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 1 1 0 1 1 0 1 1 1 1 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 0 0 1 0 1 1 1 1 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1 1 1 0 0 1 0...

output:

99117017

result:

ok 1 number(s): "99117017"

Test #67:

score: 0
Accepted
time: 77ms
memory: 11964kb

input:

1
5000 200
1 1 1 1 1 1 1 1 0 1 1 1 1 0 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 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 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 0 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0...

output:

38315534

result:

ok 1 number(s): "38315534"

Test #68:

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

input:

1
5000 200
0 0 0 0 0 0 0 1 1 0 0 0 1 1 1 0 1 0 1 0 0 0 1 1 1 0 1 1 1 1 0 0 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 1 1 0 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 0 0 1 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 1 1 1 0 1 0 0 0 0 1 0 0 0 1 1 1...

output:

15177266

result:

ok 1 number(s): "15177266"

Test #69:

score: 0
Accepted
time: 112ms
memory: 12688kb

input:

1
5000 200
1 1 1 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 0 1 1 1 0...

output:

6522348

result:

ok 1 number(s): "6522348"

Test #70:

score: 0
Accepted
time: 112ms
memory: 12284kb

input:

1
5000 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0...

output:

3491262

result:

ok 1 number(s): "3491262"

Test #71:

score: 0
Accepted
time: 131ms
memory: 12232kb

input:

1
5000 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

2505365

result:

ok 1 number(s): "2505365"

Test #72:

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

input:

1
5000 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1...

output:

1793666

result:

ok 1 number(s): "1793666"

Test #73:

score: 0
Accepted
time: 122ms
memory: 12416kb

input:

1
5000 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

466554

result:

ok 1 number(s): "466554"

Test #74:

score: 0
Accepted
time: 63ms
memory: 11972kb

input:

1
5000 200
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0...

output:

36494

result:

ok 1 number(s): "36494"

Test #75:

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

input:

1
2000 500
0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 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 0 0 0 1 0 1 0 0 0 0 0 1 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 1 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0...

output:

367000263

result:

ok 1 number(s): "367000263"

Test #76:

score: 0
Accepted
time: 78ms
memory: 11952kb

input:

1
2000 500
0 0 1 1 0 0 0 0 0 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 1 1 1 0 1 1 0 1 0 1 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 1 0 0 0 1 1 1 1 0 1 0 0 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 1 1 0 0 0 0 0 1 0 0 1 1 1 0 1 1 0 1 1 1 0 1...

output:

188014592

result:

ok 1 number(s): "188014592"

Test #77:

score: 0
Accepted
time: 89ms
memory: 11996kb

input:

1
2000 500
0 0 1 1 1 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0 1 1 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 0 0 0 1 0 0 0 1 1 0 1 0 1 1 1 1 0 1...

output:

100652894

result:

ok 1 number(s): "100652894"

Test #78:

score: 0
Accepted
time: 81ms
memory: 11840kb

input:

1
2000 500
1 1 0 1 0 1 0 1 1 1 1 1 0 1 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0...

output:

47315691

result:

ok 1 number(s): "47315691"

Test #79:

score: 0
Accepted
time: 87ms
memory: 12096kb

input:

1
2000 500
0 0 0 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 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0...

output:

93796357

result:

ok 1 number(s): "93796357"

Test #80:

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

input:

1
2000 500
0 0 0 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 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

1453983

result:

ok 1 number(s): "1453983"

Test #81:

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

input:

1
2000 500
0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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...

output:

908815

result:

ok 1 number(s): "908815"

Test #82:

score: 0
Accepted
time: 122ms
memory: 11996kb

input:

1
2000 500
0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 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 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1...

output:

893207

result:

ok 1 number(s): "893207"

Test #83:

score: 0
Accepted
time: 103ms
memory: 12008kb

input:

1
2000 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0...

output:

111763

result:

ok 1 number(s): "111763"

Test #84:

score: 0
Accepted
time: 62ms
memory: 11856kb

input:

1
1000 1000
0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 1 0 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 0 0 0 1 0 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 0 0 1 0 0 1 1 0 0 ...

output:

423437179

result:

ok 1 number(s): "423437179"

Test #85:

score: 0
Accepted
time: 58ms
memory: 11868kb

input:

1
1000 1000
1 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 1 1 0 1 0 ...

output:

326333773

result:

ok 1 number(s): "326333773"

Test #86:

score: 0
Accepted
time: 89ms
memory: 11896kb

input:

1
1000 1000
1 1 0 1 1 0 1 1 0 1 0 1 0 1 0 1 1 1 0 1 0 0 1 0 0 0 0 0 1 1 0 1 0 1 1 0 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 0 0 1 1 1 0 1 ...

output:

136977119

result:

ok 1 number(s): "136977119"

Test #87:

score: 0
Accepted
time: 64ms
memory: 11748kb

input:

1
1000 1000
1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 ...

output:

214043012

result:

ok 1 number(s): "214043012"

Test #88:

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

input:

1
1000 1000
1 1 0 1 1 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 0 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 1 0 0 0 1 1 0 0 1 1 0 0 0 1 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 ...

output:

48322834

result:

ok 1 number(s): "48322834"

Test #89:

score: 0
Accepted
time: 96ms
memory: 11876kb

input:

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

output:

2939924

result:

ok 1 number(s): "2939924"

Test #90:

score: 0
Accepted
time: 131ms
memory: 11808kb

input:

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

output:

645013

result:

ok 1 number(s): "645013"

Test #91:

score: 0
Accepted
time: 73ms
memory: 11776kb

input:

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

output:

507609

result:

ok 1 number(s): "507609"

Test #92:

score: 0
Accepted
time: 102ms
memory: 11836kb

input:

1
1000 1000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

49725

result:

ok 1 number(s): "49725"

Test #93:

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

input:

1
1000000 1
0 0 0 0 0 1 1 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 1 0 0 1 1 0 1 1 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0 0 1 1 1 0 1 0 0 1 1 0 0 ...

output:

0

result:

ok 1 number(s): "0"

Test #94:

score: 0
Accepted
time: 87ms
memory: 14928kb

input:

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

output:

-1

result:

ok 1 number(s): "-1"

Test #95:

score: 0
Accepted
time: 63ms
memory: 11792kb

input:

1
1000 1000
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

998001000

result:

ok 1 number(s): "998001000"

Extra Test:

score: 0
Extra Test Passed