QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#19574#2125. Skrzyżowania [B]CharlieVinnie10 ✓8558ms470164kbC++147.5kb2022-02-05 15:43:492022-05-06 06:01:33

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-06 06:01:33]
  • 评测
  • 测评结果:10
  • 用时:8558ms
  • 内存:470164kb
  • [2022-02-05 15:43:49]
  • 提交

answer

#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define clr(a,v) memset(a,v,sizeof(a))
#define Fin(file) freopen(file".in","r",stdin)
#define Fout(file) freopen(file".out","w",stdout)
#define Fgen(file) freopen(file".in","w",stdout)
#define Fans(file) freopen(file".ans","w",stdout)
// #define int long long
using namespace std;

const int N=1e6+5,M=15005,K=840;

// template < class T, int SZ >
// class Myvector{
//     int nxt[SZ],tot;
//     T val[SZ];
    
// public:
    
//     void clear() { tot=0; }
    
//     int newhead() { return ++tot; }
    
//     void add(int& h,const T& v)
//     {
//         nxt[++tot]=h;
//         h=tot;
//         val[tot]=v;
//     }
    
//     T& get(int p) { return val[p]; }
    
//     int next(int p) { return nxt[p]; }
// };

// #define ForMyvector(vec,head,obj)\
// obj=vec.get(head); for(int _o=head; _o; _o=vec.next(_o),obj=vec.get(_o))


struct Query{
    int id,cp;
};

char s[N][12];
int n,m,Q,len[N];
int cut[K][M];
int type[K];
int nxtcon[K];
int qx1[N],qx2[N],qdir[N],qtim[N],qrealtim[N],ans[N];
// vector<int> son[K][M];
// vector<Query> qry[K][M];
int son[K][M];
// int qid[K][M],qcp[K][M];
// Myvector<Query,K*M> qry;
vector<Query> qry[K][M];
int dep[K*M];

int num(int i,int j)
{
    return (i-1)*m+j;
}

void dfs(int t,int u,int d,int op)
{
    dep[u]=d;
    
    // if(qid[t][u]){
    //     ans[qid[t][u]]=min(ans[qid[t][u]],d-dep[qcp[t][u]]);
    // }
    for(auto qr:qry[t][u]){
        ans[qr.id]=min(ans[qr.id],d-dep[qr.cp]);
    }
    
    if(son[t][u]&2){
        dfs((t-1+840)%840,u,d+1,op);
        dep[u]=d;
    }
    if(son[t][u]&1){
        dfs(t,u+op,d,op);
        dep[u]=d;
    }
}

void solve0()
{
    clr(son,0);
    For(t,0,839) For(i,0,n) qry[t][i].clear();
    
    For(t,0,839){
        For(i,0,n-1){
            if(type[t]==0 && cut[t][i+1]){
                son[(t+1)%840][i]|=2;
            }
            else{
                son[t][i+1]|=1;
            }
        }
    }
    
    For(i,1,Q) if(qdir[i]==0){
        int x1=qx1[i],x2=qx2[i],t=qtim[i];
        
        qry[t][x1].push_back({i,x2});
    }
    
    For(t,0,839) dfs(t,n,0,-1);
}

void solve1()
{
    clr(son,0);
    For(t,0,839) For(i,0,n) qry[t][i].clear();
    
    For(t,0,839){
        For(i,1,n){
            if(type[t]==0 && cut[t][i]){
                son[(t+1)%840][i]|=2;
            }
            else{
                son[t][i-1]|=1;
            }
        }
    }
    
    For(i,1,Q) if(qdir[i]==1){
        int x1=qx1[i],x2=qx2[i],t=qtim[i];
        
        qry[t][x1].push_back({i,x2});
    }
    
    For(t,0,839) dfs(t,0,0,1);
}

void solve2()
{
    clr(son,0);
    For(t,0,839) For(i,0,m) qry[t][i].clear();
    
    For(t,0,839){
        For(i,0,m-1){
            if(type[t]==1 && cut[t][i+1]){
                son[(t+1)%840][i]|=2;
            }
            else{
                son[t][i+1]|=1;
            }
        }
    }
    
    For(i,1,Q) if(qdir[i]==2){
        int x1=qx1[i],x2=qx2[i],t=qtim[i];
        
        qry[t][x1].push_back({i,x2});
    }
    
    For(t,0,839) dfs(t,m,0,-1);
}

void solve3()
{
    clr(son,0);
    For(t,0,839) For(i,0,m) qry[t][i].clear();
    
    For(t,0,839){
        For(i,1,m){
            if(type[t]==1 && cut[t][i]){
                son[(t+1)%840][i]|=2;
            }
            else{
                son[t][i-1]|=1;
            }
        }
    }
    
    For(i,1,Q) if(qdir[i]==3){
        int x1=qx1[i],x2=qx2[i],t=qtim[i];
        
        qry[t][x1].push_back({i,x2});
    }
    
    For(t,0,839) dfs(t,0,0,1);
}


int read()
{
    char Charlie;
    while((Charlie=getchar())<'0'||Charlie>'9') ;
    int Vinnie=Charlie-'0';
    while((Charlie=getchar())>='0'&&Charlie<='9') Vinnie=(Vinnie<<3)+(Vinnie<<1)+Charlie-'0';
    return Vinnie;
}

signed main()
{
    // Fin("J");
    // Fout("J");
    
    n=read(); m=read(); Q=read();
    
    For(i,1,n) For(j,1,m){
        int o=num(i,j);
        scanf(" %s",s[o]);
        len[o]=strlen(s[o]);
    }
    
    For(t,0,839){
        // Try to cut horizotally first
        
        type[t]=0;
        
        int flg=0;
        
        For(i,1,n){
            int ok=1;
            For(j,1,m){
                int o=num(i,j);
                if(s[o][t%len[o]]=='0'){
                    ok=0; break;
                }
            }
            if(ok) { cut[t][i]=1; flg=1; }
        }
        
        if(!flg){
            // If fail, then cut vertically
            
            type[t]=1;
            
            For(j,1,m){
                int ok=1;
                For(i,1,n){
                    int o=num(i,j);
                    if(s[o][t%len[o]]=='1'){
                        ok=0; break;
                    }
                }
                if(ok) { cut[t][j]=1; flg=1; }
            }
            
            if(!flg) type[t]=2;
        }
    }
    
    clr(nxtcon,0x3f);
    
    int all_same=1;
    For(t,0,839){
        if(type[t]!=type[0]){
            all_same=0; break;
        }
    }
    
    if(!all_same){
        For(t,0,839){
            if(type[t]==2){
                nxtcon[t]=0; continue;
            }
            
            int t0;
            for(t0=(t+1)%840;type[t0]==type[t];t0=(t0+1)%840) ;
            
            nxtcon[t]=(t0-t+840)%840;
        }
    }
    
    cerr<<"befor query: "<<clock()<<endl;
    
    For(i,1,Q){
        int t,x1,y1,x2,y2;
        t=read(); x1=read(); y1=read(); x2=read(); y2=read();
        
        qrealtim[i]=t;
        t%=840;
        qtim[i]=t;
        
        if(type[t]==2){
            qdir[i]=-1;
            ans[i]=0;
            continue;
        }
        
        if(type[t]==0){
            qx1[i]=x1; qx2[i]=x2;
            ans[i]=nxtcon[t];
            if(x1<x2) qdir[i]=0;
            else qdir[i]=1;
        }
        else{
            qx1[i]=y1; qx2[i]=y2;
            ans[i]=nxtcon[t];
            if(y1<y2) qdir[i]=2;
            else qdir[i]=3;
        }
    }
    
    cerr<<"before solve0: "<<clock()<<endl;
    solve0();
    cerr<<"before solve1: "<<clock()<<endl;
    solve1();
    cerr<<"before solve2: "<<clock()<<endl;
    solve2();
    cerr<<"before solve3: "<<clock()<<endl;
    solve3();
    
    For(i,1,Q) printf("%d\n",qrealtim[i]+ans[i]);
    
    cerr<<"Time = "<<clock()<<" ms"<<endl;
    return 0;
}

/*
10 10 1
0001000 0001000 00100 0001000 10000000 10000000 00100 0001000 0001000 000010
0001000 0001000 0001000 00001 0001000 0001000 100000 0001000 0001000 00001
00000001 00001 0001000 00001 0001000 00001 0001000 00001 0001000 000010
0001000 0001000 000001 0001000 0001000 0001000 0001000 0001000 0001000 0001000
0001000 0001000 0001000 0001000 0001000 0001000 100000 100000 0001000 0001000
00000001 0001000 0001000 00001 0001000 00001 0001000 00001 00001 0001000
0001000 0001000 0001000 0001000 10000000 000010 0001000 0001000 0001000 0001000
0001000 00001 0001000 00001 10000000 00001 0001000 0001000 0001000 00001
100000 00001 0001000 00001 0001000 0001000 0001000 00001 0001000 0001000
0001000 00001 0001000 00001 0001000 00001 0001000 100000 0001000 00001
265353479 7 1 0 9
*/

/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?)
    * do smth instead of nothing and stay organized
    * WRITE STUFF DOWN
    * DON'T GET STUCK ON ONE APPROACH
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 96ms
memory: 353408kb

input:

2 2 7
01 1100
001 10
0 0 0 2 2
1 0 1 2 1
5 2 1 0 0
0 0 2 2 2
15 1 1 0 0
16 1 1 0 0
7 2 2 2 2

output:

1
3
6
0
15
17
7

result:

ok 7 lines

Test #2:

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

input:

1 1 50
01
473389465 0 0 1 1
369935687 0 1 0 0
93785116 0 1 1 1
317278726 0 1 0 0
922020549 0 0 0 0
356322399 0 1 0 1
160444511 0 0 1 1
656722660 0 0 0 1
345415125 0 1 0 0
82989921 1 0 1 0
15670833 0 0 0 0
903824966 1 1 0 0
222446557 0 0 0 0
787082157 1 0 0 1
157610365 1 0 0 1
207203173 0 1 0 0
11635...

output:

473389466
369935687
93785116
317278727
922020549
356322399
160444512
656722661
345415125
82989921
15670833
903824967
222446557
787082158
157610366
207203173
116355109
159738252
129216261
931002478
578934618
506770479
174544880
380268815
248933035
64724335
517722149
387653370
564246503
480070885
3310...

result:

ok 50 lines

Test #3:

score: 0
Accepted
time: 116ms
memory: 351644kb

input:

3 3 50
01100 0101 00111011
0101 11010101 11000
11100 11001 00111011
973980763 1 2 3 3
658136597 2 3 3 2
382205742 0 2 0 3
220766232 1 2 0 0
141170003 3 1 0 0
539518033 2 3 0 2
758496199 3 1 3 3
500743676 0 0 0 1
782893395 3 0 2 2
589168287 0 3 0 2
983970880 3 3 1 2
445804983 0 3 1 0
403765462 3 1 1 ...

output:

973980763
658136598
382205742
220766232
141170003
539518034
758496199
500743676
782893397
589168287
983970880
445804983
403765463
13942477
669022942
962208299
959363141
214677655
703999673
356803562
115113794
243445192
921363323
208473452
183219279
638535152
153752990
782187717
223129592
773992404
2...

result:

ok 50 lines

Test #4:

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

input:

3 3 50
01000100 0111001 0001
1000 1101 000111
11010101 0101 01110
190647164 2 0 3 1
115441193 1 1 0 1
724740562 2 3 1 0
748899505 2 1 2 0
290587738 1 1 2 1
549871504 2 0 0 2
366527842 3 3 2 2
514427220 2 0 0 1
826983967 0 1 2 0
595228940 2 0 0 0
484524045 2 1 0 3
32697397 3 0 2 0
313624569 1 2 0 2
8...

output:

190647164
115441193
724740563
748899505
290587738
549871505
366527842
514427220
826983967
595228940
484524045
32697398
313624569
880446904
170384451
797294439
289464346
579690398
386568281
197307945
265030724
661516937
128819806
355162499
787632995
719899085
913015243
138407571
260497487
128727404
3...

result:

ok 50 lines

Test #5:

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

input:

7 1 50
110111
100
0010
10010101
011
10111
11100000
246365830 3 0 7 0
543033260 1 0 6 1
516869940 2 1 5 1
441857331 4 0 2 0
251217777 5 1 5 0
924531669 6 1 3 1
813421836 2 1 0 1
606403238 4 0 3 0
870408537 5 0 2 0
162929845 7 0 4 1
713696855 1 1 1 1
94245918 4 1 7 0
780464468 7 1 1 1
982347758 2 1 1 ...

output:

246365836
543033261
516869940
441857332
251217777
924531673
813421838
606403238
870408537
162929847
713696855
94245923
780464473
982347758
593605831
653522636
70695416
751586541
989966902
70121313
146513442
719901623
688236751
868679157
530084706
863763223
967370860
535416673
263551699
932787652
502...

result:

ok 50 lines

Test #6:

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

input:

2 8 50
101111 01 01010 10011 0110 11100000 01101 00110
0110000 00100 110 01 100 01011 00011110 01100
308303693 0 0 0 4
527949594 2 8 0 4
932224004 0 2 0 7
208736956 2 2 1 2
733532181 0 4 1 7
48319771 0 3 2 3
306487183 0 2 1 6
598229726 2 1 1 3
234568667 1 5 0 7
902918896 1 7 2 5
732882668 2 8 0 0
58...

output:

308303693
527949597
932224006
208736956
733532181
48319771
306487185
598229727
234568668
902918896
732882669
589295033
740122041
533694720
363695646
465296018
180116723
144107601
777166896
751224566
678038483
820327493
892519619
759698275
138692795
946015687
134973143
407076284
720449707
49601071
30...

result:

ok 50 lines

Test #7:

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

input:

50 50 50
100 0110 001000 1001 01 1101 01101101 01101 1001101 01000010 00001 10100010 01100 01 1111011 110 001 001 01111100 100011 10101 00111 10101100 010 01 10 1000 10110110 00111110 011 01001 10 0010 011001 0110 1011 00001 101111 01001 1101 01011 1000 0011 1101111 11111110 001110 11010100 1011000 ...

output:

176852147
749280886
629772129
611648008
923989848
234211490
912787302
146590578
504949584
588408279
269561722
476756557
539252929
600984391
795142492
342799460
763957091
778143033
217629272
469785411
107133226
731062460
440078382
743611189
225967257
911692141
226104314
248323534
125627739
520498791
...

result:

ok 50 lines

Test #8:

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

input:

10 10 50
0001000 0001000 00100 0001000 10000000 10000000 00100 0001000 0001000 000010
0001000 0001000 0001000 00001 0001000 0001000 100000 0001000 0001000 00001
00000001 00001 0001000 00001 0001000 00001 0001000 00001 0001000 000010
0001000 0001000 000001 0001000 0001000 0001000 0001000 0001000 0001...

output:

272634043
806727554
491644303
67529346
59372099
244027437
395077595
51723766
863139882
464986770
349424008
492230244
816978396
294978981
752844837
560448990
869601372
463305916
298927163
151034651
265353483
650155957
972902479
548998880
946219760
938975376
806885880
30838265
4099609
31445046
8173530...

result:

ok 50 lines

Test #9:

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

input:

10 10 50
10000011 10000011 10000011 1110111 10000011 10000011 00111 00111 10000011 1110111
01001 011 01001 01001 01001 10000011 1110011 1110011 1110011 01001
001 00111 0010100 10000011 10000011 00111 001 10000011 001 10000011
10000011 10000011 10000011 10000011 10000011 10000011 10000011 10000011 10...

output:

512844004
177301036
598872749
189248078
864124884
430826019
664644953
442459873
174667819
334095455
562163198
884392894
968239160
339002569
267012313
915464786
475073714
358650861
456490009
815638062
340186953
474498657
44298257
677451198
466452153
961097564
284282629
782574806
700097964
231910150
2...

result:

ok 50 lines

Test #10:

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

input:

10 10 50
1110111 1110111 101111 1110111 1110111 1110111 1110111 1110111 1110111 01111111
1110111 10111 1110111 10111 10111 110111 1110111 1110111 110111 01111111
1110111 1110111 1110111 1110111 1110111 110111 11101 110111 11111101 1110111
11110111 1110111 11110111 1110111 1110111 11101 1110111 11101...

output:

847579477
249413895
13924200
516693467
675540547
654936145
432253478
999508212
750514053
755118668
625231056
682374395
50450851
109303897
866296302
407971588
588819696
585358007
991946236
805640300
502310434
279456279
860518214
945962923
480457008
27422679
944805095
746902194
812969006
637050241
170...

result:

ok 50 lines

Test #11:

score: 0
Accepted
time: 118ms
memory: 352312kb

input:

50 50 50
01000 001 00100000 00100000 00100000 00100000 001 00100000 0010000 01000 00100000 00100000 0010000 00100000 00100000 00100000 00100000 01000 00100000 001 00100000 001 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 00100000 01000 001 0010000 00100000 00100000 01000 0...

output:

658072423
947051578
422549042
395092266
908591965
168694729
380494210
164364298
272419314
201263267
675643761
767042122
378990002
72323959
173901802
849423842
576170650
708431258
168711418
184593146
36290058
830428666
939318274
532320442
199198777
154575218
287539730
139640111
788137658
689588914
29...

result:

ok 50 lines

Test #12:

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

input:

50 50 50
00101000 111101 0100111 111101 111101 0100111 111101 0100111 111101 111101 111101 111101 00101000 0100111 111101 111101 0100111 111101 111101 00011 111101 00101000 111101 00101000 111101 0100111 0100111 111101 111101 111101 111101 111101 0100111 00101000 00101000 00011 111101 00101000 11110...

output:

644429823
579167910
434685073
965024855
144668229
574853863
760824501
102788134
143974231
900706523
494435360
448197661
744765053
758044443
594820677
780299487
482161193
822157451
680074159
228013657
366480368
616399044
31040960
575918585
169802985
139093995
791660286
646756381
400392154
114846074
2...

result:

ok 50 lines

Test #13:

score: 0
Accepted
time: 105ms
memory: 352752kb

input:

50 50 50
11011 11011 11011 10111111 11011 11011 11011 11011 11011 10111111 11011 11011 11011 1111101 11011 1111101 1111101 10111111 1111101 1111101 11011 11011 11011 011 1111101 11011 11011 10111111 11011 11011 10111111 1111101 11011 10111111 11011 1111101 11011 11011 1111101 11011 1111101 10111111 ...

output:

549256667
270170297
651631632
703447942
789000262
29952923
140191257
25973137
543661307
705550257
342276527
920051431
228824942
78411197
850292507
882359837
933105792
150794022
713758527
932337122
92768582
220076776
543948382
567898297
494048482
4009902
191168087
89891002
410337340
133767102
1398421...

result:

ok 50 lines

Test #14:

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

input:

48 49 48
0000010 00000010 10000 0000010 00000010 10000 00000010 10000 10000 10000 001000 001000 10000 00000010 00000010 10000 10000 10000 10000 10000 10000 10000 00000010 10000 10000 10000 00000010 00000010 001000 10000 001000 10000 10000 10000 00000010 00000010 10000 10000 10000 10000 0000010 00000...

output:

785856050
911603580
442356270
985206070
260463555
380568070
953413030
556273565
53033750
622600610
967605340
967714405
953530640
999708245
124970935
173569368
346263845
160182680
783269060
213575120
959950530
289333120
287466375
757035850
76203220
874674725
822091120
95412770
708107335
9861550
88510...

result:

ok 48 lines

Test #15:

score: 0
Accepted
time: 117ms
memory: 351948kb

input:

49 48 49
10000010 10000010 1000110 1000110 01101 10000010 10000010 01101 10000010 10000010 10000010 01101 01101 110001 10000010 10000010 10000010 01101 1000110 10000010 10000010 01101 110001 10000010 10000010 110001 110001 10000010 01101 1000110 10000010 10000010 10000010 01101 10000010 1000110 1000...

output:

455308337
882093248
540634282
612654317
147347381
221862935
364789624
461793732
530369611
379679807
95259047
912728081
786713670
140464279
313954680
595521031
668366299
221284960
43101867
949037473
813482617
928766742
882961927
289304957
460133263
953708905
4121757
573406207
815323350
281233239
3158...

result:

ok 49 lines

Test #16:

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

input:

49 50 50
10111 101111 101111 11011111 11011111 101111 11011111 11011111 101111 101111 10111 101111 101111 101111 101111 11011111 101111 10111 101111 101111 10111 101111 11011111 10111 1110111 101111 101111 101111 101111 1110111 101111 101111 11011111 1110111 11011111 10111 101111 11011111 101111 101...

output:

987331993
344878927
641222677
195385069
263776849
874038709
680762893
239916973
371246005
893395045
174979645
949433539
965062255
210372109
433366231
999068383
213523333
961310053
146261983
849303865
897948583
593269651
518865715
509416421
98928931
887328793
752928385
355915723
134416711
917760613
5...

result:

ok 50 lines

Test #17:

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

input:

50 50 50
011111 01111 01111 10111111 011111 0111111 0111111 10111111 01111 011111 0111111 10111111 01111 0111111 011111 10111111 01111 10111111 10111111 011111 01111 01111 10111111 0111111 10111111 01111 10111111 011111 0111111 011111 011111 10111111 011111 011111 01111 10111111 011111 01111 0111111...

output:

137744492
286831330
88712864
938155116
676265592
749304394
8570702
24758398
339757911
569693430
964670056
895717975
730167584
27657583
196163814
173195362
677129192
940237100
154173385
764987534
532146912
168153467
616061727
236660329
814038233
51209324
32435605
221563330
391209789
17913092
74506485...

result:

ok 50 lines

Test #18:

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

input:

50 50 50
010000 01000 10000000 100000 000100 0000010 000010 01000 00001 000001 000010 010000 001000 001000 0000100 00010000 0010000 0000100 00001 00100 0001000 0000010 0000010 01000000 0000100 00100 00100 000001 00001 0000010 0010000 0100000 00010 00000010 00000100 00001 0000001 0000001 01000000 100...

output:

719120274
488002667
101180836
497511455
261530928
132476316
371843446
448924787
373472409
898110130
921245534
138384159
939080464
155838606
459329001
559383356
255362765
960929598
296670712
73020815
530032723
6408481
370978219
952205953
537685141
360328459
605986008
433147597
319361331
358555997
919...

result:

ok 50 lines

Test #19:

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

input:

50 50 49
1110111 11111101 11111101 011111 1110111 011111 11110 11110 011111 11110 11111101 11110 11111101 11110 1110111 11111101 11111101 11110 11111101 11110 11111101 011111 11111101 011111 11111101 11111101 1110111 1110111 1110111 11111101 11110 1110111 1110111 11110 1110111 011111 11110 11111101 ...

output:

145142562
457627508
25485932
420050822
539349698
521020139
472271779
587472329
785950385
632220885
550584008
863801523
316703318
969757728
353373018
595026156
822356739
236775788
791265650
901817563
881427125
504656789
726496038
663087705
327025098
248146441
612506424
182380979
682517438
315089083
6...

result:

ok 49 lines

Test #20:

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

input:

48 50 48
01000 0000010 001 010 0000010 0010000 00001000 01000 00010000 0000100 00010 0010000 0000010 01000 010 100 001 0001000 10000000 00010000 0100000 010 00000100 001 00100000 001 100 100 01000 00010 10000000 00010 00010 100 0000100 0001000 00010000 010 0010000 10000000 001 001 0001000 01000 0010...

output:

961390472
132162834
786066206
797011471
973782520
908941056
295059487
741777272
542101444
897101817
867844460
109371182
553813982
810191772
630770596
704376256
550604455
806286646
183214078
689876576
716575841
237363275
776047354
756685266
918316640
455354944
289891835
67380272
45400270
442848071
13...

result:

ok 48 lines

Test #21:

score: 0
Accepted
time: 95ms
memory: 350676kb

input:

50 50 50
01100011 1000101 1001001 01001111 01110111 101110 1000011 100100 1010000 01100011 1101 11100011 1000010 11111011 11001011 00000101 1100000 11001001 10111001 1000111 00001101 111101 11010011 01100011 000101 10101101 10101011 1100011 00101011 1011000 1001001 10011101 00000011 00010011 0110000...

output:

642721450
444218058
239766821
724901010
237787337
91608374
997475150
537012384
610501684
32010503
319716028
549538786
410030099
67371170
608981951
429973099
860063027
193288698
317332935
410734555
956024370
182883698
970522775
336779298
532861852
43640777
272796312
188646029
826880545
840378900
4955...

result:

ok 50 lines

Subtask #2:

score: 1
Accepted

Test #22:

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

input:

100 100 50
100 01 1000 101 0100110 1101001 010 01 01010 1100 100 10 001110 1011011 000001 0101 11100 0000011 10 111000 0011 101 101 0110 01110 100 10110 01 10 1110010 00100 0111 0000110 10101 1110100 10 01 010100 0011 11001 1010100 10000 01 110001 0101 10 100011 01 1000 110 10110 1010 1010 100 00100...

output:

590777323
168524929
495013110
941253665
522988291
375812585
335626575
786796871
504856183
565603809
652692212
251368404
468031124
174389390
28156007
616764135
287007031
1834667
318880791
290354392
770563461
611281194
222031118
309266419
451588763
494977504
260651816
703644647
418414941
142737065
506...

result:

ok 50 lines

Test #23:

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

input:

100 100 50
001 011111 1100111 1001101 00010 01001 01 01111 10 01 0011111 100100 01 0011 011001 001001 1001001 011100 1001101 10 0111 10 10 0011 001110 1011011 0010 01011 0011 01110 1110 0101110 011111 011100 100000 10010 0001 110 0001010 0111001 010011 0011001 01001 00110 1000 0101000 0001 01110 100...

output:

260067982
812046135
131493329
990447629
264163306
813525803
298690111
70182634
731108740
968497241
164694479
432792914
144152942
690476563
262336497
41222041
946502772
429465369
367578018
464318387
718764794
714795253
227023908
525183168
991709270
68328093
636418456
504431929
780353887
485388769
157...

result:

ok 50 lines

Test #24:

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

input:

100 100 50
00001 001 0100 0000001 0000001 0000001 0000001 0100 0100 0100 0100 0100 0000001 0100 0000001 0100 0000001 0000001 0100 00001 0100 0000001 0100 0000001 0100 0100 001 001 0100 0000001 0100 001 0000001 0100 0100 0000001 001 001 0000001 0100 0100 001 0100 00001 0000001 0000001 001 00001 00001...

output:

244212277
578551609
936253957
485536057
506949197
302802925
307706165
379121229
778509881
584646909
598178449
325033157
500899177
737677229
174200606
811625960
365812569
484435069
977092129
443521489
91654073
769071905
977772629
24821005
362806533
595942901
722807433
552155649
325997097
687021325
75...

result:

ok 50 lines

Test #25:

score: 0
Accepted
time: 116ms
memory: 351332kb

input:

100 100 50
10000 0101 10000 0101 10000 0101 0101 0101 0101 0101 10000 0101 0101 0101 0101 10000 0101 0101 0101 1011110 0101 1011110 1011110 0101 10000 0101 10000 0101 0101 10000 0101 0101 10000 10000 10000 101010 10000 0101 0101 0101 1011110 0101 0101 101010 10000 0101 0101 0101 0101 1011110 0101 10...

output:

115753439
430076582
532846546
275420296
946305449
134002942
699480326
256800795
812413806
617770629
244477066
188660916
549673997
170544773
253649032
976400977
129163176
512660219
245097551
470971213
252165723
107852315
428854359
248413755
322659413
59813252
410455403
485937447
965349721
695789544
1...

result:

ok 50 lines

Test #26:

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

input:

100 100 50
011 011 011 011 011 011 011 01111 011 011 1110 011 011 1110 1110 011 011 1110 011 011 1110 011 011 011 1110 011 011 011 1110111 1110 1110 011 011 011 011 01111 011 011 1110 011 01111 011 01111 011 011 011 011 1110 011 011 1110111 01111 011 011 011 1110 1110111 011 01111 011 011 011 111011...

output:

54684093
562402542
365017452
114795228
81650091
471776658
74789308
509800020
352097859
330197817
720679413
491205009
452252757
317605302
502157109
106313763
968659611
682584339
974690805
972312792
810864879
799723368
225029112
773050084
360357801
991590603
472475187
305551095
485038572
942909264
990...

result:

ok 50 lines

Test #27:

score: 0
Accepted
time: 416ms
memory: 374908kb

input:

10000 1 50
0010
0010
0000001
001
0010
0010
00010
00010
0010
00010
0010
001
0010
0010
0000001
0010
0010
0010
0010
00010
0010
0010
00010
0010
0010
0010
0000001
0010
0010
0010
0010
00010
0010
0010
00010
00010
00010
0010
00010
0010
0010
001
00010
0010
0010
0010
00010
0010
0000001
0010
00010
0010
0000001...

output:

167105839
874160405
657038529
189710901
68178115
637344405
692338465
290259313
700566837
811176675
867408784
274744279
566885265
534634224
684256051
441023209
774960397
353432595
743261882
624678547
603549727
153897427
753735627
220974500
51585535
668866879
932110800
747656302
19184192
64161571
2668...

result:

ok 50 lines

Test #28:

score: 0
Accepted
time: 518ms
memory: 385560kb

input:

10000 1 50
101000
101000
11001
1011
101000
101000
11001
101000
101000
101000
101000
101000
101000
101000
11001
11001
101000
101000
11001
0111110
101000
1011
101000
101000
101000
101000
11001
101000
101000
1011
101000
0111110
101000
101000
101000
101000
101000
101000
101000
101000
11001
0111110
10100...

output:

924875797
8635978
586785653
719051277
497499197
500005093
658741237
179966913
209638177
893592517
179473637
36917817
434631553
203964117
173348497
445593133
530673353
429152737
307561953
520636837
451216577
871502037
453319733
271057213
9001257
788263937
931116277
342479017
917932617
117387473
21956...

result:

ok 50 lines

Test #29:

score: 0
Accepted
time: 605ms
memory: 386324kb

input:

10000 1 50
0111
0111
11110
11110
0111
0111
0111
1111011
0111
1111011
1111011
0111
11110
11110
0111
11110
1111011
11110
11110
0111
1111011
111101
0111
0111
0111
111101
0111
11110
0111
11110
0111
1111011
111101
11110
0111
111101
0111
0111
11110
11110
0111
1111011
0111
0111
0111
0111
0111
0111
111101
0...

output:

826180324
592973224
284816284
867128224
349174144
849183724
830345044
220860364
579831844
916186324
409002724
280374364
945916024
181253944
165772324
285978424
991323904
273446464
726799924
483826984
425553391
165797104
472408024
881766064
765786844
687088924
102290584
701007304
545839984
261854044
...

result:

ok 50 lines

Test #30:

score: 0
Accepted
time: 576ms
memory: 386652kb

input:

1 10000 50
0001 0001000 000100 000100 0001 0001 000100 000100 000100 0001 0001 0001 0001 000100 0001 10000 000100 000100 000100 000100 10000 000100 0001 0001000 000100 0001000 000100 0001 0001 10000 000100 000100 000100 000100 10000 000100 000100 0001 0001 000100 000100 000100 0001000 0001 000100 10...

output:

802107435
918399135
545324895
396253839
296032215
835161015
156000855
164411355
898742295
809133615
560119395
561696915
823940715
328518795
88215375
850230195
850527555
447993255
199827855
857971215
157729575
292160655
923825115
239817315
759677745
600103815
686094195
234694155
99729255
641651475
40...

result:

ok 50 lines

Test #31:

score: 0
Accepted
time: 539ms
memory: 385036kb

input:

1 10000 50
01100 011100 01100 011100 011100 011100 011100 01100 01100 011100 011100 01100 011100 011100 01100 0001001 0001001 0001001 01100 01100 01100 011100 01100 01100 01100 011100 01100 0001001 01100 01100 011100 01100 011100 0001001 01100 01100 01100 01100 0001001 0001001 011100 01100 01100 011...

output:

596403807
569495937
105151196
733761507
350999431
781102461
393273411
512693877
722070482
374988781
617740707
354455797
143650587
398740292
98089316
552811647
469584716
942696201
780829167
232695217
630832971
134838476
422299401
880537587
3553171
310289696
562661217
451936677
32972062
324171441
1671...

result:

ok 50 lines

Test #32:

score: 0
Accepted
time: 342ms
memory: 372272kb

input:

1 10000 50
1101 0111111 011111 011111 011111 011111 1101 011111 1101 011111 10111 011111 011111 1101 1101 1101 1101 1101 1101 1101 10111 0111111 1101 10111 1101 1101 0111111 1101 1101 1101 1101 1101 1101 0111111 1101 011111 1101 1101 10111 011111 10111 1101 0111111 1101 10111 1101 10111 1101 1101 01...

output:

684265815
632847040
22003641
645754264
244354693
236858653
331062183
427412837
758525121
913116476
419354048
242000681
107902768
327212587
473047077
302206379
378845797
628031238
580075364
500707845
933844453
124101990
325458349
907821623
809452053
826571897
96113286
500488770
667659253
60663479
138...

result:

ok 50 lines

Test #33:

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

input:

50 200 50
1000000 01000 01000 01000 01000 1000000 01000 01000 1000000 01000 01000 01000 01000 01000 01000 000100 01000 0010 1000000 01000 01000 1000000 01000 01000 1000000 000100 01000 01000 0010 01000 01000 1000000 01000 01000 1000000 01000 000100 01000 01000 01000 1000000 000100 01000 1000000 0100...

output:

580391416
55862956
604659901
569955981
579086581
396849916
60366231
74552146
457076306
392948121
605107686
587101876
290765536
941020671
303455526
374920926
131584441
753570316
45358576
76848161
467062361
229354266
228061431
71113121
899614281
264237481
259072761
609599956
322047736
807983041
816290...

result:

ok 50 lines

Test #34:

score: 0
Accepted
time: 118ms
memory: 352052kb

input:

50 200 50
01001 0010100 01001 01001 01001 101101 1011 0010100 1011 01001 01001 0010100 01001 01001 1011 01001 01001 01001 01001 01001 01001 01001 01001 01001 1011 01001 101101 1011 01001 01001 01001 1011 01001 01001 01001 101101 01001 0010100 1011 01001 0010100 1011 0010100 01001 01001 0010100 10110...

output:

805123844
567873536
923184669
396781356
307152087
859361664
387259264
791195200
246264555
58598795
127450079
138837189
393819290
489025572
202258952
240993626
689128604
385685881
396213072
104408068
177928828
188113376
182111120
522550020
108121282
149404155
13530756
683895984
41805479
887978316
551...

result:

ok 50 lines

Test #35:

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

input:

50 200 50
1101 1101 1101 1111011 11110 11110 111110 1101 111110 1101 1101 1111011 111110 1101 1101 1101 1101 111110 11110 1101 111110 1101 11110 1101 1101 1101 1101 1101 11110 111110 1111011 1101 111110 1101 1101 111110 1101 1101 1101 111110 1101 1101 1101 111110 1101 111110 1101 1101 1101 111110 11...

output:

815096134
308743802
283994238
382723758
688388418
413884754
369849998
48167838
294574886
472518642
369230502
845131494
161551566
682994832
240375550
604252827
253239750
404356194
451885422
881407470
79134354
881775086
57776862
447829750
209256014
329077850
540231326
305214498
65261550
284744610
1145...

result:

ok 50 lines

Test #36:

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

input:

100 100 50
11011 1011 101111 11011 101111 1101111 11011 11011 11011 101111 101111 11011 11011 101111 1101111 101111 101111 11011 1101111 1101111 1011 101111 101111 1011 1101111 1101111 101111 11011 11011 101111 1011 11011 1011 11011 101111 101111 1011 11011 1011 1101111 1101111 11011 1011 11011 1011...

output:

262160670
912681793
182288861
338353984
695387584
14150033
35621148
45919456
877738411
74399529
685733208
890559788
894250012
87683957
293470708
617409138
767119049
211345445
730541116
134219768
343011747
91048227
694028085
841943669
785792928
95362779
73847880
205312159
468938235
522563958
62863992...

result:

ok 50 lines

Test #37:

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

input:

99 99 50
010000 01000 0010000 1000 000010 10000 00100 100000 000010 1000 00001 000010 0001 0001 01000 000100 0010 0001 000001 000001 0000100 0100000 1000 0010000 0001 00100 1000000 00010 00010 0100000 10000 00001 0000010 10000 1000 00010 0000010 0001000 001000 0100000 0000100 01000 10000 0001 000010...

output:

748194562
779286520
63174008
510660767
439200609
776447429
641959750
972370841
439930120
215418679
560939032
542263238
594769579
41266043
131208172
904767529
429459433
318291624
570961211
319229056
604751387
886655880
591102245
879134058
704009562
36376723
329044219
589541265
560266782
216864457
914...

result:

ok 50 lines

Test #38:

score: 0
Accepted
time: 740ms
memory: 388732kb

input:

9999 1 50
101
1011111
101
0111
0111
011
1101111
1101
1111101
0111
0111
1101
11011
110
11101
0111
110
11110
11011
011
11011
11011
11110
0111111
1111011
1110
1101
01111
1011
0111111
101
0111111
01111
1101111
11011
0111111
1011
1011
0111
110
11101
1110
101
11110
1111011
1101111
11110
10111
10111
1011
0...

output:

281662087
753165202
331510479
967594461
185834422
361347060
114494435
294975113
348691783
981565972
989648099
330855955
865916739
56578853
680408872
366280738
473196980
673492440
240942161
755465657
873855069
956387134
714637144
725006412
643143435
915618774
547669791
2245059
866820412
702146092
669...

result:

ok 50 lines

Test #39:

score: 0
Accepted
time: 792ms
memory: 389148kb

input:

1 10000 50
010000 000100 000001 001000 1000 0100000 0001 000001 0000001 0010 0001 010000 01000 0010 010000 0010 10000 0010000 0000100 00100 0010000 010000 100000 001000 0000001 001000 00100 000001 1000 0001000 001000 0010 0001000 0001000 0000100 00001 0100 1000000 0000100 0100000 01000 0000010 00000...

output:

65518369
846496168
712685093
872024085
59613984
14611486
469528545
74999376
610721697
174463559
370081581
188199042
177074374
739319621
179296747
953731937
444167598
185644802
386812567
977682691
687299685
392068864
649441824
115016976
994084796
601633508
688962353
535695024
397062578
50522901
85849...

result:

ok 50 lines

Test #40:

score: 0
Accepted
time: 118ms
memory: 350332kb

input:

100 100 50
1011011 1011110 1110101 100010 1010001 010 1011001 1101110 11011 1001001 010010 1100101 1011101 101110 101111 1000001 001011 111010 00101 1010011 1010011 1010111 000111 00011 1011110 1000000 01001 1001100 110 011111 1000100 1011010 1010011 000011 1100111 10011 1010011 00011 1001 1000101 1...

output:

697468718
245818213
846333045
819822295
613870243
108242453
746387393
683923252
165127421
237469849
143147869
513131495
387858330
513424300
79757224
88419143
883539310
459758033
796423849
336514891
40909932
458510309
674571064
344801164
1861693
220776553
631495066
720640694
543955824
520932208
24624...

result:

ok 50 lines

Test #41:

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

input:

100 98 50
1010001 111000 010001 111000 11101 1011011 1011 110110 1011100 0010010 010010 111101 011100 0011101 01010 0010100 0010111 0111 0011000 1001 1011000 010100 0011110 0011110 0001 110111 110001 0010011 0010010 0010010 1111101 01000 111110 111110 1001 011010 01001 01011 011110 1011111 11011 111...

output:

675347344
488182989
146423344
167171247
71356446
628383110
359524210
195246202
405617776
237983989
159301017
26634050
314675871
117809892
230823485
41516564
652233416
867164753
245543193
957081094
66912047
153547108
870509049
121504877
693729321
781876830
628988361
187540255
350517775
948970940
5490...

result:

ok 50 lines

Test #42:

score: 0
Accepted
time: 657ms
memory: 386300kb

input:

10000 1 50
0010101
01000
0101111
011000
1101
0010100
011111
010011
0000011
1101
0101010
10100
000011
0100100
0100001
0010001
0110001
0111001
11001
0111011
00100
0000110
011
0011010
0100011
0010110
0000100
0110110
0110010
0101
0101
010111
011110
001001
0010011
0100
0010100
0100111
0111011
0111101
101...

output:

275583798
501484578
597182838
228944478
869827518
299420058
672959238
705166938
522000318
444936198
848023638
390914538
499033038
692450598
999893118
160122438
37283358
42349818
160783938
679629678
621193818
757842498
408746478
164132598
428875818
461746698
785198778
252597198
175441518
704744838
66...

result:

ok 50 lines

Test #43:

score: 0
Accepted
time: 713ms
memory: 386840kb

input:

10000 1 50
01111
0101111
01001
101001
101011
1000110
0000110
01111
100000
0001110
110011
0101111
001
1001101
01101
0001111
01101
011
0100101
000010
1101001
111001
001011
00011
0100101
100011
0101110
1100001
110001
01111
101011
0101100
01001
1001001
001011
1000011
1001101
011000
01010
1101001
00111
1...

output:

567054105
328891005
326793525
665580225
513512505
899860845
720540165
183413505
402663585
18583245
235270065
478138425
821674485
480547545
512026125
949473345
229089765
416270745
414224925
711941085
296032305
862439685
81411885
145502625
175122285
278010945
346987545
969213345
614606505
780055845
67...

result:

ok 50 lines

Test #44:

score: 0
Accepted
time: 712ms
memory: 386420kb

input:

1 10000 50
10000 11010 1111100 01 1111000 10001 010001 011010 0011100 011 011001 0010100 1110 10100 1010011 010000 10001 1111000 10000 1010001 1011100 010000 110100 1111101 1111001 1100 011001 0100 1010111 010 010001 0010111 1010010 010101 10001 10010 0010001 0110111 1110 0110001 0011001 0110000 111...

output:

568785205
158371705
477820765
786912625
851414545
232467685
949886485
475381405
843519805
355960705
35409985
683289385
935631265
971226685
877467145
350559925
656791585
203554045
306376765
469266205
800438725
137480905
635583265
167217745
253946065
636180085
256338385
571119985
828504385
403777705
1...

result:

ok 50 lines

Test #45:

score: 0
Accepted
time: 676ms
memory: 386684kb

input:

1 9998 50
110100 000110 001100 100110 0010011 0011011 11001 0111101 0100011 0111101 010100 0001001 001101 0011 010111 1101001 0111011 01010 1111001 01101 11000 000100 0000111 0101011 01001 0010101 010110 0010011 11001 100110 11100 0100101 0111111 0011001 0000101 010111 1011 0010111 1100101 0011011 0...

output:

972778911
399163911
730368771
771225111
207638451
85860711
503340711
844762911
813267951
916379211
294369711
403520991
813843771
428341311
437179791
396148311
930822591
91040151
290442711
58270071
22213491
370178451
566584731
794441871
132922551
520279311
528433191
853879431
124659051
11431671
16238...

result:

ok 50 lines

Test #46:

score: 0
Accepted
time: 206ms
memory: 360992kb

input:

2500 4 50
1110110 0110100 0111001 011100
11001 0100110 0110101 011010
111010 0111110 01101 1111101
1100110 1100110 100110 1001101
011011 0010010 011100 0110100
0110111 0110110 0110100 1101101
10011 0100100 1011 01010
0010001 01111 0100001 0111001
1100 0101 011010 10011
111000 01010 01100 01001
01011...

output:

10839582
652078647
959785295
194007695
281410167
232757735
728089407
141057784
256913247
784248162
376678751
695893127
122390187
30409242
784666655
91182087
227999607
191624460
89967374
972614667
912282245
398097927
834162917
348151242
331920627
660397505
491085717
514630080
56955447
190128977
29493...

result:

ok 50 lines

Test #47:

score: 0
Accepted
time: 210ms
memory: 360624kb

input:

2500 2 50
0010101 0111010
1010000 0011011
1100 0111001
1100110 0100101
00011 111000
011 111010
0100000 0111000
010 101011
0000001 0100001
011111 0011101
011111 0101011
0100100 0001101
0110111 0010110
010011 0101111
010000 11101
1110111 0001101
01 000011
1001 0001110
001110 0010100
0010101 0111111
10...

output:

681676950
321196410
654738570
725383410
976749753
755733646
92195733
165645210
768942870
65575293
38552790
409593810
600543450
535708050
749644710
758858250
76305750
226640130
491325093
509621430
770599770
222221013
238455150
96493050
123702321
700894820
250184193
223055430
501331470
102927450
55981...

result:

ok 50 lines

Subtask #3:

score: 1
Accepted

Test #48:

score: 1
Accepted
time: 238ms
memory: 358808kb

input:

700 700 70000
11000 1101001 01 0100100 00000101 11110 0111011 01 001100 111101 100 101 10 1110 100 11101101 0110000 10100010 10 00100110 0110110 1100 01001100 10 10110100 01 100101 111100 1011101 00100 10 11110 100 01 001100 00111011 100 0111 0000011 0001 111100 11011 0111111 0011101 10 10010000 110...

output:

86969386
447259202
912287149
660943662
718175409
837211427
120737529
124513481
572080716
349272562
702860859
570693627
583855882
268262548
682372543
930713392
214225811
878875311
752637745
317898762
486943111
71186444
891844718
886051577
993388535
428720725
196325374
725392463
456822833
5098088
6092...

result:

ok 70000 lines

Test #49:

score: 0
Accepted
time: 1432ms
memory: 365556kb

input:

700 700 70000
0001000 0001000 0001000 0001000 000001 0001000 000001 000001 0001000 0001000 0001000 0001000 0001000 000001 0001000 0001000 000001 0001000 0001000 00010 000001 00010 00001000 000001 0001000 0001000 000001 0001000 00010 0001000 0001000 0001000 000001 0001000 00010 000001 000001 000001 0...

output:

822221263
812445756
789326352
977559110
242568903
251645201
138265039
971410835
172292438
974039503
512663938
65575555
321579331
181964030
323163235
883989711
13771719
104128146
623488939
214890063
410304177
735998637
399479
190459797
472323316
789696477
451445578
53377810
885626101
124695224
662866...

result:

ok 70000 lines

Test #50:

score: 0
Accepted
time: 656ms
memory: 363752kb

input:

700 700 70000
101 101 101 101 11101 101 101 101 11101 101 101 11101111 11101111 11101111 11101111 11101 11101 101 101 101 1110111 11101111 101 11101 11101 11101 101 101 11101 101 101 101 11101 101 101 11101111 11101 11101 11101111 1110111 1110111 101 101 101 101 101 101 101 101 101 11101 101 11101 1...

output:

98067775
754035811
641151826
254550763
595542154
103703680
447829693
989930986
650414818
293432660
676662232
50882744
967765900
631654339
633754411
464495128
85316776
541592515
856078657
38488909
242417758
662646580
769510280
229264168
84410740
598507153
39614638
801027628
656758522
272638045
293474...

result:

ok 70000 lines

Test #51:

score: 0
Accepted
time: 282ms
memory: 359112kb

input:

350 700 70000
11111110 011 1011101 1011101 1011101 11111110 1011101 1011101 1011101 1011101 1011101 10011 1011101 1011101 1011101 011 11111110 1011101 011 11111110 1011101 1011101 11111110 1011101 011 1011101 11111110 1011101 011 1011101 11111110 1011101 1011101 1011101 1011101 1011101 1011101 10111...

output:

747958176
514160244
251532721
212578763
655593018
678835518
887080874
434654992
223750736
863785228
911687355
20630741
368088120
387266972
103325736
56289564
193700145
955007220
468120672
100387956
870049131
575826441
924085515
15730738
575683869
605681727
406018989
915440799
248172690
401640152
287...

result:

ok 70000 lines

Test #52:

score: 0
Accepted
time: 659ms
memory: 359988kb

input:

700 350 70000
10000000 0010000 00001 001000 001000 0010000 001000 0010000 001000 001000 0010000 0010000 0010000 10000000 0010000 0010000 0010000 10000000 00001 0010000 0010000 0010000 00001 001000 0010000 0010000 10000000 0010000 0010000 0010000 0010000 0010000 0010000 0010000 0010000 00001 10000000...

output:

474014802
121561424
553655356
23024764
55028906
754196613
655227309
258219040
584478799
732296434
400106317
813218982
524162746
903426631
741223037
337364883
167889941
49481567
13198558
670545395
805891522
664366642
625425873
49037985
284308922
324186592
538238892
15652604
259436935
853553087
966984...

result:

ok 70000 lines

Test #53:

score: 0
Accepted
time: 494ms
memory: 362064kb

input:

700 350 70000
111101 111101 111101 111101 111101 11011 11011 111101 1111011 111101 111101 11011 111101 111101 11011 11011 111101 11011 111101 111101 111101 01111111 111101 1111011 111101 11011 111101 111101 1111011 11011 111101 1111011 111101 111101 111101 111101 1111011 11011 01111111 111101 111101...

output:

218805676
777239608
967930306
194286070
941669962
378890104
972725146
695220706
3650128
256928776
103365904
72269638
283790362
70591036
67339030
983424874
635928022
365224576
366479302
926395606
91164628
16086238
562079884
302283754
107949340
714147526
327851932
258060466
699331216
325049860
1975336...

result:

ok 70000 lines

Test #54:

score: 0
Accepted
time: 1361ms
memory: 365952kb

input:

700 700 70000
0000010 0000010 000010 0000010 0010000 0000001 1000000 0010000 00010 1000000 00100 00001 000010 00100 0010000 010000 00010 00001000 1000000 000100 10000 01000000 001000 0000001 0000100 0000001 0000100 000100 00010 00100 10000 000001 10000000 010000 000001 0000001 0100000 00000001 10000...

output:

397174702
502298589
252226250
76006839
653805599
609559023
656644911
33934042
541035046
389894501
628303543
240099406
94083332
642186117
401499515
452386460
259399056
886647399
270517909
801770952
271218178
52724839
265287631
317231342
57534663
808580135
30741380
871630371
326127067
155600740
673582...

result:

ok 70000 lines

Test #55:

score: 0
Accepted
time: 1315ms
memory: 366444kb

input:

698 700 70000
100 100 00000100 00001 010 00001 0100000 0100000 00010 00001 010 001 0000010 100 010 10000 00000001 0000001 0000001 0000010 010 1000000 01000000 00001000 0000001 10000 001 10000 0000001 10000 001 00001 010 0100000 00000100 00100 00000001 010 00000010 00010 0100000 00010000 0000100 0100...

output:

154741438
119520121
925413245
54750694
805733100
871157279
899913737
571484649
338562988
231055026
642032322
991598695
175351109
192534283
490647017
140843571
210172216
978321584
862724545
724628356
622157158
8771850
262814304
580255680
924997691
355723203
936322730
109559811
247871569
180392827
938...

result:

ok 70000 lines

Test #56:

score: 0
Accepted
time: 237ms
memory: 364100kb

input:

700 700 70000
0111101 11001 0110110 11010101 110001 10010100 0100111 0101001 0110100 1110000 100111 0100101 11010000 11000000 101100 0110001 0101000 01101 10001011 10001001 11001000 11011101 10010111 11011001 10111100 00101 0101011 10111000 11011101 10001110 11001101 11111110 00101 11101011 1111110 ...

output:

175322908
795283847
245127943
3360920
180936647
588896448
421511753
598765849
704106241
670604148
349009381
234075025
396873313
427867930
381985683
78765566
759629098
963530627
745119970
99363269
252684508
23961074
602961485
190704735
244946538
440098419
246716432
584217474
233338120
112968309
80973...

result:

ok 70000 lines

Subtask #4:

score: 1
Accepted

Test #57:

score: 1
Accepted
time: 246ms
memory: 357420kb

input:

700 700 70000
01 00111001 101 101 01 10 10 1100 10101 100 1101101 1000 00010 10011011 00001110 01111 01 0001001 111010 0011 001111 11000 1101011 1010010 1011100 110 101 0001 10 0100 01011 0101 001011 00011101 01 010111 0001110 01 01110000 11011 0011110 0100101 10010100 11101010 001 010 1000111 010 1...

output:

909116262
249162083
887678277
430573455
237747690
468967077
41027994
442850730
108139057
516931866
43537767
834809688
572324723
334074148
16747339
555982805
351585469
278686440
400426001
24231607
749576718
297473546
696243304
576489153
607342198
935847909
524718010
644722419
587364046
155175617
9968...

result:

ok 70000 lines

Test #58:

score: 0
Accepted
time: 412ms
memory: 361424kb

input:

700 700 70000
010 0100000 0100000 01101011 010 010 010 010 010 01101011 0100000 0100000 0100000 010 01111 0100000 010 010 010 010 010 010 01101011 010 010 010 01101011 010 0100000 01101011 010 010 010 010 010 010 010 01111 01111 01111 01111 010 01111 010 01111 010 01111 0100000 010 01111 0100000 010...

output:

900374777
400833380
948539127
459954990
345629993
245231209
142889920
224144372
910981556
32401345
991036184
727999516
508121771
751942826
210351647
68936636
241022230
113296997
218486066
64208943
594030941
842589025
851998489
830359388
556463888
574601924
362509
508008787
615236486
871745717
169588...

result:

ok 70000 lines

Test #59:

score: 0
Accepted
time: 713ms
memory: 360508kb

input:

350 700 70000
000100 0001000 000100 000100 000100 000100 0001000 000100 0001000 000100 000100 0001000 0001000 000100 00010 000100 0001000 000100 000100 00000010 00010 0001000 0001000 0001000 0001000 00010 000100 00000010 000100 00000010 0001000 00000010 000100 0001000 00010 000100 00010 000100 00010...

output:

577986225
326970057
851287059
295292937
347602251
620193915
207100251
313730775
212138097
706862679
397685295
268305885
581955033
60187545
899552373
597372309
168998409
297612231
463850877
172495125
481804437
250848243
625386969
636235707
244513611
520158195
763767723
858073203
905101023
355086759
7...

result:

ok 70000 lines

Test #60:

score: 0
Accepted
time: 422ms
memory: 361340kb

input:

350 700 70000
11110 11110 110 11110 11110 11110 110 11110 11011111 11110 11110 11110 11110 11110 11110 11110 1110111 11110 11011111 11110 11110 11011111 1110111 11110 110 11110 110 11110 11110 11110 11011111 11110 11110 11110 11110 110 11110 11110 11110 110 11011111 1110111 11110 11110 11110 110 111...

output:

608278539
47795174
700109509
27914524
394776489
822177259
239769874
124137374
216950164
338357659
260496409
596364214
643262329
865850864
441594159
595039314
333037159
574645184
504818779
488093214
476048334
637414849
112564844
585924524
631253584
846022814
8066669
30852614
141732289
713573204
99456...

result:

ok 70000 lines

Test #61:

score: 0
Accepted
time: 327ms
memory: 360444kb

input:

700 350 70000
001110 001110 00011000 001110 001110 001110 0100011 001110 001110 10110 00011000 001110 0100011 0100011 00011000 001110 001110 001110 001110 0100011 00011000 001110 0100011 001110 001110 00011000 00011000 001110 001110 001110 0100011 001110 001110 001110 10110 001110 0100011 10110 0100...

output:

566046794
579866842
78205725
795500968
355770914
895260680
673110437
706000688
589566500
46292361
634859668
541149927
311265712
382540484
575398533
912931349
564567893
478476614
214988504
475972929
5056982
659133782
197418135
259980058
869883382
94798238
427449279
475249670
562809999
546506240
55344...

result:

ok 70000 lines

Test #62:

score: 0
Accepted
time: 717ms
memory: 365568kb

input:

700 700 70000
01111111 1111011 1111011 11110 101 101 01111111 11110 01111111 01111111 1111011 101 01111111 101 1111011 01111111 101 101 101 01111111 1111011 101 1111011 1111011 1111011 11110 01111111 101 101 101 01111111 1111011 1111011 101 101 101 01111111 11110 1111011 1111011 11110 01111111 101 1...

output:

663976349
474480424
504886741
680628159
521655368
319659115
227692493
91343538
661817434
222181080
572684885
789741476
694234874
451865610
857222928
249155357
102870120
232411531
198914745
911813039
120827013
740718179
41082427
594234445
732517269
931794179
51414695
20288657
283251628
220887792
9970...

result:

ok 70000 lines

Test #63:

score: 0
Accepted
time: 695ms
memory: 366572kb

input:

700 700 70000
11011111 11011111 11011111 110 110 110 11110 1111101 110 11011111 110 110 11110 11011111 110 11011111 11110 11011111 11011111 11011111 110 11110 11011111 11011111 1111101 11110 110 1111101 11110 11011111 11110 1111101 110 11011111 11110 110 110 11011111 11110 1111101 1111101 1111101 11...

output:

629127891
311315849
966885192
949957999
704344918
63671639
486549703
54214683
670182685
276201650
105429427
172241307
957721018
879851018
806045614
979103969
609324641
407179264
425543950
329461230
232654433
233757621
375407457
831150277
424820356
112871740
838942243
975139807
646346688
718971524
66...

result:

ok 70000 lines

Test #64:

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

input:

700 700 70000
0110 01100001 10 00100010 10100111 01101100 1111000 00111110 10111011 1010100 1011100 01111000 11000 1000010 00111010 11100000 1111100 01110100 01000 1001010 011010 011111 11110100 00110001 00100110 11111010 1110100 11101000 10110010 00110110 001001 011011 101001 00111010 1100101 00100...

output:

821971737
210632720
371634998
318340241
572329067
435098874
461770743
129179948
511452968
444075649
135156492
222337560
107623020
82302700
129915375
10465475
229245065
374931492
975823172
394895568
51316282
403610512
138990428
314521845
508340501
663495267
764021962
511755398
336240223
326799593
980...

result:

ok 70000 lines

Subtask #5:

score: 1
Accepted

Test #65:

score: 1
Accepted
time: 665ms
memory: 369672kb

input:

75 8000 600000
11110 1101 0010110 01001001 00111 10111 01 0010001 0001 1110011 0001 00001100 01 1110011 1000001 10111 10 01 0101 00100 11100111 11011111 01111010 1111110 0010 01 0111111 11110011 11011 1100100 11100 11110111 11111011 0011 01 01 10111 1100 00100101 10100 10101 11001 1101 00111000 0000...

output:

632833731
135090297
227761365
7625038
587513255
457786863
399550016
760098516
657823115
145311648
445604142
691166103
813572716
868241280
433696500
350370218
311090430
516497581
203963060
330286090
809568163
534944379
248698231
942521136
261583545
245407460
6341515
370071091
523391244
344919541
7651...

result:

ok 600000 lines

Test #66:

score: 0
Accepted
time: 2599ms
memory: 413808kb

input:

75 8000 600000
01000000 1000000 01000000 1000000 1000000 1000000 1000000 1000000 00000010 01000000 1000000 1000000 1000000 1000000 01000000 00010 1000000 1000000 01000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 01000000 01000000 1000000 1000000 1000000 1000000 00010 01000000 ...

output:

218892184
200149040
978995430
837834018
840791623
502754882
392868819
568125446
563569622
573172075
387376388
906757866
524956257
892554915
234106579
607340790
244722478
961270625
863619351
971129201
677841584
699484464
42864584
131414031
796764668
282545515
860750639
998708326
222719098
496827905
7...

result:

ok 600000 lines

Test #67:

score: 0
Accepted
time: 1178ms
memory: 382128kb

input:

75 8000 600000
0111111 11101 11101111 11101111 11101111 11101111 11101111 11101111 11101111 11101111 11101111 11101111 11101 11101111 11101111 11101111 11101 0111111 11101111 11101111 11101111 11101111 0111111 11110111 11101111 11101 0111111 11101111 11101 11110111 11101111 0111111 11101111 11101 11...

output:

600485638
545984195
830817019
887607083
789036883
56268537
183937699
933194619
927374699
449924483
913367595
72155131
696022235
799813531
139997987
315799835
81504443
78014203
258032642
92494835
104125395
70956451
207622547
162982547
667780747
314890987
538660179
375766259
579915939
188387019
113135...

result:

ok 600000 lines

Test #68:

score: 0
Accepted
time: 1026ms
memory: 391932kb

input:

73 8000 599998
1111110 1111110 10000 10000 1111110 10000 10000 1111110 10000 10000 00111001 10000 10000 10000 10000 10000 10000 1111110 00111001 10000 00111001 00111001 01011110 10000 10000 10000 1111110 10000 10000 10000 10000 1111110 1111110 10000 1111110 10000 01011110 1111110 1111110 1111110 100...

output:

142532696
290221321
556921657
741954370
13642454
163692968
669041246
710746779
231661482
958949321
726780563
227236833
396518337
508020006
352959248
970457018
715538257
297618074
511348304
871063421
434458960
130215958
137693038
33228599
824418742
504755468
211119774
1244065
643911336
355126049
1545...

result:

ok 599998 lines

Test #69:

score: 0
Accepted
time: 3287ms
memory: 383004kb

input:

8000 75 600000
0010000 00010 00010 0010000 0010000 00010 0010000 00010 10000000 0010000 00010 10000000 0010000 00010 0010000 10000000 00010 0010000 00010 00010 00010 0010000 00010 0010000 00010 10000000 00010 10000000 00010 00010 00010 0010000 10000000 10000000 00010 0010000 0010000 00010 10000000 0...

output:

606457363
137150573
175239748
109740898
832238408
989161508
409437093
826213163
183241848
990858633
259424413
851494073
245624693
344048618
249537368
228100718
294571353
684168228
838967603
911430483
211766958
267129308
404279293
42842888
646166623
762699698
901411293
175927033
595223413
6316613
773...

result:

ok 600000 lines

Test #70:

score: 0
Accepted
time: 1666ms
memory: 414180kb

input:

8000 75 600000
11111011 11011 11111011 11111011 11111011 11111011 11011 11111011 11111011 11011 11011 11111011 1110111 11110111 1110111 1110111 11111011 11111011 11011 11011 11011 11111011 11111011 11111011 11111011 11111011 11111011 11011 11011 11111011 11110111 11111011 11111011 11111011 11111011 ...

output:

186585438
192146581
839546133
935898197
113409005
591577133
763659549
210458973
211452733
744511269
80828573
197074909
56765
140082485
930507165
403187677
165198437
869254205
921703149
647800493
495028493
24730693
190115869
847304933
51079581
273923813
399017197
555730197
815201261
831758053
4438121...

result:

ok 600000 lines

Test #71:

score: 0
Accepted
time: 1098ms
memory: 396632kb

input:

7999 73 599999
00101111 00101111 00101111 11101000 11101000 0001111 0001111 0001111 00101111 0001111 00101111 0001111 0001111 00101111 11101000 00101111 00001 00101111 11101000 00101111 00101111 00001 00101111 00101111 11101000 11101000 00101111 00101111 00101111 00101111 00001 00101111 00101111 000...

output:

903910280
80884304
311470064
792360200
880340753
774264672
219553017
892463523
969570384
112989883
641984297
469183918
125038194
389874212
697413558
160219598
249046420
150775480
537839463
977944912
647198264
951875092
730715365
947292184
371748299
57444266
234887250
886879282
929211152
682150126
63...

result:

ok 599999 lines

Test #72:

score: 0
Accepted
time: 1943ms
memory: 421768kb

input:

8000 75 600000
11011111 11011111 11101 11101 11011111 11011111 1101111 11011111 11101 11011111 11101 1101111 1101111 11101 11101 11101 11101 1101111 1101111 1101111 11011111 11011111 11101 11011111 11101 1101111 11011111 1101111 11011111 11101 1101111 11101 11101 1101111 11101 11101 1101111 11101 11...

output:

408264902
451197648
822962494
95420253
277850925
758857198
841694397
202748855
615237793
278006729
587327617
30308449
783392255
794947763
288052832
12240623
430684850
306906960
197614844
211936445
584075350
218329817
432892984
900150231
386880739
995247813
295142345
380349823
529961120
317754963
691...

result:

ok 600000 lines

Test #73:

score: 0
Accepted
time: 845ms
memory: 403792kb

input:

75 8000 600000
1000011 10001110 0011111 0000011 10101111 01001 10001 1000101 10110011 10000011 10000010 10110010 10010001 10011101 10110100 0100101 0000001 0001011 11011 01111 11010010 00001 10011100 0110001 0101001 10100100 1100 1011011 11010010 11100010 0011111 11110000 10000000 0010011 1000011 10...

output:

857663925
854223128
656809622
459006646
624036246
886579558
535822918
354956238
872383234
251393378
442498138
864183012
150422286
125667653
626213148
174261685
268170629
937858582
572461947
904993928
881655142
218245931
396179382
177165115
538110924
580008406
687951679
429173418
715313862
369357127
...

result:

ok 600000 lines

Test #74:

score: 0
Accepted
time: 1061ms
memory: 404612kb

input:

8000 75 600000
10010111 01110 1000011 1011110 00011100 00110100 1110100 00111100 1100001 10010001 00111001 00011000 1100001 1001101 01 1100010 1000111 00011111 1101100 11010011 00111001 1101 01010111 00011101 1000001 10011100 00111111 11011001 11111110 1101001 1101100 11100 01110111 10011100 1111010...

output:

340669600
749265992
545956289
783317884
77875178
154005436
408626458
83935625
853891606
135377629
142386443
344751827
639664602
392054448
326047705
37306915
413797554
729110864
101964942
366763555
450896216
513600315
916769905
43631832
52922172
418078175
330026840
908809050
619286262
796571106
61608...

result:

ok 600000 lines

Test #75:

score: 0
Accepted
time: 3061ms
memory: 422676kb

input:

75 8000 600000
00000001 00001 01 01 00100000 0000010 0010000 00001 0010000 00000100 0001 00010000 10000000 00000100 1000 00010000 0010 00001000 01 01 00010 10000 0100 0000010 1000 10 00010 10 00001000 10 1000 10000000 00100000 0000010 10 00001 00100000 00001 1000 1000 10 10000 00001 0100 10 00000010...

output:

769505539
486440224
2453943
759528960
84171116
754519951
562718010
541147950
971633422
500270401
394073071
383416498
943704361
9709162
950038142
203656000
961513317
552413779
176607732
203286580
598676859
254376050
585520273
23755114
887166072
242071082
440626646
370755945
905768426
126549439
982729...

result:

ok 600000 lines

Subtask #6:

score: 1
Accepted

Test #76:

score: 1
Accepted
time: 722ms
memory: 369740kb

input:

8000 75 600000
0101000 10 01010 1110000 00110011 10111 0011000 1011 10001100 00111000 0110 0101110 00001 1011010 01 00111 01100000 01010111 0111101 0010 11010 1110 0111 00111 01 01 10011 01 1001111 10 10001 0011 00111 00001110 01 0101 0110 0001 01000 01 01101 0100 01101 11000 1101 01 0100011 1101 00...

output:

22632586
936119438
609114028
264409671
322654101
829917263
425600174
598761039
997346176
895400957
794094637
742701365
685882024
8040548
853715438
529453649
726598122
310802192
535924879
295078208
386033701
823757764
111094454
191990372
956730794
959489597
943903486
540325174
103422656
411194924
728...

result:

ok 600000 lines

Test #77:

score: 0
Accepted
time: 990ms
memory: 388832kb

input:

75 8000 600000
11100 11011011 11011011 0110010 11000110 11011011 11011011 0110010 0110010 11000110 0110010 11000110 0110010 11011011 0110010 0110010 0110010 0110010 0110010 0110010 0110010 0110010 11011011 0110010 11100 11000110 0110010 11100 0110010 11100 0110010 0110010 0110010 0110010 11100 01100...

output:

681864905
906961346
459372708
43349051
200941171
496354234
310373910
271266668
438494173
765066718
228570191
389213498
228666921
72176875
703873946
496020939
193932614
318835912
738448042
356621374
177833236
455456217
310808209
761559991
967885335
130243022
5082708
765658460
986347806
993137253
1759...

result:

ok 600000 lines

Test #78:

score: 0
Accepted
time: 2098ms
memory: 411448kb

input:

75 8000 599998
1000000 00001 00001 1000000 1000000 00001 00001 00001 00001 1000000 00001 00001 00000100 00001 00001 00001 00001 00001 00001 00001 1000000 00001 1000000 00001 00001 00001 1000000 00001 00000100 10000000 00001 00001 10000000 00001 10000000 00001 10000000 00000100 00001 00001 00000100 0...

output:

805539989
897693429
492279694
864561029
65099729
674154369
221466979
30614764
101880294
251933479
118025729
431858104
200584969
161027705
238770599
76926059
263195299
404664029
665387844
558861084
431770149
315939874
585474639
572798159
382806129
655659809
111128009
69131279
55780784
10517044
245828...

result:

ok 599998 lines

Test #79:

score: 0
Accepted
time: 1157ms
memory: 382552kb

input:

73 8000 600000
01111 01111 01111 01111 01111 0111111 01111 01111 01111111 0111111 0111111 01111111 01111 0111111 11111011 01111 01111 01111 01111 01111 01111 01111111 01111 0111111 01111 0111111 0111111 01111 01111111 01111 0111111 0111111 0111111 01111111 0111111 01111 0111111 01111 01111 01111 011...

output:

977268900
176103580
824045060
702090290
400584020
281719555
387579205
486962225
323049015
160231605
58988905
471862715
964079645
708928125
406408950
603315995
923600825
993288120
847224898
370363090
53454350
582067615
976672090
996291545
147234041
887044660
410313890
585068265
957383695
967931365
70...

result:

ok 600000 lines

Test #80:

score: 0
Accepted
time: 969ms
memory: 386784kb

input:

8000 75 600000
11011 00100001 01001011 0000011 00100001 0000011 11011 0000011 0000011 0000011 00100001 0000011 01001011 11011 0000011 11011 00100001 11011 0000011 00100001 11011 0000011 01001011 11011 0000011 0000011 0000011 0000011 11011 0000011 11011 0000011 0000011 0000011 0000011 01001011 000001...

output:

158738720
98200572
597693117
38205043
726668351
232362733
429134057
142217388
110057146
523038745
539660324
473331030
750237453
755941204
206278257
940311925
28981952
463978505
788574043
100843337
827998388
410740226
556470120
247455204
756606734
350975008
134158971
864387566
433752235
858924461
154...

result:

ok 600000 lines

Test #81:

score: 0
Accepted
time: 3535ms
memory: 384280kb

input:

7999 75 600000
0100000 0100000 00100000 00100 0100000 0100000 00100 0100000 0100000 00100 0100000 0100000 00100000 0100000 0100000 0100000 0100000 0100000 00100000 0100000 0100000 00100000 0100000 00000001 00100000 0100000 0100000 00000001 0100000 00100000 0100000 00100 0100000 0100000 0100000 01000...

output:

24151163
108233287
965357100
74025785
166648301
946698215
85484411
879787427
882333985
77756526
682962834
924903764
528131368
551309879
142921388
626245880
420626809
243026106
667490965
558071774
570729923
178940161
295909755
276992031
911096292
231087263
428859696
803070780
678323220
432504206
7724...

result:

ok 600000 lines

Test #82:

score: 0
Accepted
time: 1681ms
memory: 413732kb

input:

7998 74 599998
11110111 11011 11011 11110111 11011 0111111 11110111 11110111 11110111 0111111 11011 0111111 11110111 0111111 11110111 11110111 11011 0111111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 11110111 0111111 11110111 11110111 11110111 ...

output:

28472532
664890052
767119636
130055460
658123508
980798380
227150844
531190684
170920980
652949932
267730460
841143004
460049652
567694868
154886236
199971900
104566188
461110580
515565396
639945708
524483964
927526548
39759332
46290588
342444012
47147260
251603308
998760564
869933444
289313188
2213...

result:

ok 599998 lines

Test #83:

score: 0
Accepted
time: 2896ms
memory: 420528kb

input:

75 8000 600000
0000100 00001 10000000 0010000 00000001 00000001 00001000 00010 0000001 0010000 0000010 0010000 0100000 0000100 00010 0000100 00100000 0010000 0000010 01000000 00000010 0100000 00000010 00010 00000001 0000001 00000001 0000001 01000000 0001000 0001000 00000010 00001 00001 00100 0100000...

output:

325718040
793553057
81151892
603258625
200662897
400850304
522637382
495657513
983865363
431659830
774599589
15771326
13904771
410758205
342568582
766462489
607629991
643047383
916946637
858474830
221234649
234074887
875569121
204237082
16366721
190523652
786546399
945769909
39063124
604986653
76045...

result:

ok 600000 lines

Test #84:

score: 0
Accepted
time: 1007ms
memory: 404332kb

input:

74 7998 600000
11001110 0101001 11011 01000 11100001 01 1101010 01000101 01001010 1101100 11100101 0101010 01000101 01110110 01001101 01010010 1001101 11110011 01010101 01011000 01010010 11000101 01011000 01010111 11111010 11011000 01010010 11000011 01110111 01011100 0101101 1111000 01010110 1100011...

output:

31028263
78203667
253865033
539695643
477579995
626842410
642546994
33430597
396854388
683073979
665188493
602149420
971538597
346664668
931335476
373713585
151451231
691832994
256620035
97749120
740119949
166978795
712552461
359737630
35363395
224170814
571310184
577687688
393663779
937664084
52841...

result:

ok 600000 lines

Test #85:

score: 0
Accepted
time: 970ms
memory: 403772kb

input:

7998 73 600000
01111000 00010100 01010110 0100111 1101010 01110011 10000 01110010 00010101 01111110 01011000 00110001 11011100 1010110 01010010 0001110 00010010 10111011 1000111 0100011 0000010 11010101 00011000 01 0101111 01010111 01011100 01 11010111 1110110 01110111 01010001 10110101 11011000 010...

output:

292490382
740914347
72319382
477203202
258888849
986793816
187435858
498594846
516868601
900428631
913355922
301034182
119388071
779834826
918521081
928236343
530876105
856833706
573296392
595500316
307958498
721121822
332515485
759473952
846983337
339512241
552739412
838974302
453003662
638902005
9...

result:

ok 600000 lines

Test #86:

score: 0
Accepted
time: 2141ms
memory: 421268kb

input:

8000 75 600000
0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 0111 ...

output:

859299774
936622484
109763220
559563266
102940123
95525563
488102053
58430119
925411218
232724463
574607195
696938141
276184732
701314056
489060461
949668657
945461908
889400529
14910531
340991588
63745819
452993645
965777618
229713358
898520542
925173274
14995213
89924263
448715898
907316764
765885...

result:

ok 600000 lines

Subtask #7:

score: 1
Accepted

Test #87:

score: 1
Accepted
time: 776ms
memory: 374832kb

input:

80 10000 800000
01111 011 0010110 10 10 01 1101 1101 10010 01 101 1110 0001010 010110 111011 000100 01110 01 01 01 01000 010 101 100 1110110 10 0100 1010111 101 010 100 00011 100 0101011 1011 1010000 10 001010 110 1011110 1000 0000110 1101 10 110 10100 101001 001010 100 001110 0010 001010 111011 111...

output:

630530256
417214042
794171440
594494849
139984448
19933641
856954474
502298498
426226300
920480776
649782181
740964291
340703636
182815157
415340080
214305873
606845714
835391913
971982634
908061608
100297397
257233473
652085589
702257485
941701331
125316901
620799415
386615501
37705335
287644145
31...

result:

ok 800000 lines

Test #88:

score: 0
Accepted
time: 2902ms
memory: 427504kb

input:

80 10000 800000
0010 0010 0010 100 0010 0010 100 0010 00010 00010 0010 0010 0000010 0010 100 0010 0010 0000010 100 0010 0010 00010 0010 00010 0010 0010 0010 0010 00010 0000010 100 0010 0010 100 0010 0010 0010 100 100 100 00010 0010 0010 0010 0010 0010 0010 0000010 0010 0010 0010 00010 100 0010 0010 ...

output:

30233622
621919035
223208886
67818478
809310494
70740042
742498790
344942994
463397478
944586430
233519162
762351458
142543454
24024758
272335098
636403758
750898298
521539134
354071814
246440962
651320434
144752434
271007418
247468986
127975558
504229098
425288838
647990166
874688350
248853330
6379...

result:

ok 800000 lines

Test #89:

score: 0
Accepted
time: 1538ms
memory: 393592kb

input:

80 10000 800000
111101 1101 0111111 111101 111101 0111111 111101 111101 0111111 111101 111101 111101 111101 1101 1101 111101 1101 0111111 0111111 1101 0111111 111101 0111111 111101 0111111 11011 0111111 1101 111101 0111111 111101 111101 111101 111101 0111111 11011 111101 0111111 111101 111101 111101...

output:

311494438
773772160
54970735
76132942
179160400
897772966
649741072
359114788
73664002
465829498
602372992
296463790
695505934
739187128
832997338
234627441
146743504
36366556
743350162
172614490
799299070
331453708
231862138
887993164
871774054
401650408
409497586
979579216
649840648
921220246
9210...

result:

ok 800000 lines

Test #90:

score: 0
Accepted
time: 1619ms
memory: 416864kb

input:

80 10000 799998
0100100 100 10110 10110 0100100 0100100 0100100 0001 10110 0001 0100100 10110 0100100 10110 100 0100100 100 100 10110 10110 0100100 0100100 0100100 0100100 0100100 0100100 100 0100100 100 0100100 0100100 0001 0001 0100100 0001 0100100 0100100 10110 0100100 0100100 10110 100 0001 1011...

output:

147206109
862811277
554816175
479028250
90461914
439847776
362936176
25682027
671661755
949389326
866700066
727341767
556025112
754426352
128101880
957879455
786712007
907704697
916153005
947555177
453118366
214849282
273792115
281384982
17067847
750765882
122560157
550862611
155648677
721976606
846...

result:

ok 799998 lines

Test #91:

score: 0
Accepted
time: 4830ms
memory: 394136kb

input:

10000 80 800000
00010 00010 00010 000100 00010 00010 000100 1000 1000 000100 00010 0000100 1000 00010 00010 00010 00010 00010 00010 00010 000100 00010 00010 00010 00010 000100 00010 0000100 00010 00010 00010 000100 1000 00010 00010 00010 00010 00010 00010 000100 1000 1000 000100 00010 1000 00010 000...

output:

368029478
372241278
549213553
941887683
613991518
549918978
641717468
392887413
69800928
314286208
135841973
141770788
892492503
180566423
792008563
160422923
813627138
350677234
204434613
182964288
439820948
923367823
853247974
619424143
988116178
29704513
195304993
117168738
660945303
923709863
56...

result:

ok 800000 lines

Test #92:

score: 0
Accepted
time: 2140ms
memory: 433676kb

input:

10000 80 800000
1111011 11110 1111011 1111011 1111011 11110 11110 110 1111011 1111011 1111011 11110 11110 110 1111011 1101 110 1111011 110 1111011 110 1101 1111011 110 110 1111011 1111011 1111011 1111011 1111011 1111011 1111011 1111011 1111011 1111011 110 11110 11110 11110 1111011 1111011 11110 110 ...

output:

181056019
886028672
807427247
628394372
873657776
292677886
729428585
91581480
666289033
921665861
251484937
77306485
898583795
501604156
597157621
466496573
859307698
292733781
666431427
892733251
637116890
234189197
238940160
142127983
568970329
167100602
761745856
374773571
209136225
154270785
42...

result:

ok 800000 lines

Test #93:

score: 0
Accepted
time: 1878ms
memory: 421712kb

input:

9998 79 800000
0111 101 0111 0111 0111 101 0111 0111 00101 0111 0111 101 1101001 0111 0111 0111 0111 1101001 0111 00101 00101 1101001 101 0111 1101001 0111 0111 0111 0111 101 0111 0111 0111 1101001 101 1101001 1101001 101 0111 1101001 0111 1101001 0111 101 0111 0111 0111 1101001 1101001 0111 0111 11...

output:

366561820
899988456
826685492
112784977
449242175
342659220
389970164
311760100
830861936
300143712
66542576
472532564
504441472
197946777
429558024
433407080
968894824
282014628
871297984
567376000
478747228
623300736
664283140
558512464
639456740
108798580
256504714
404040553
468650168
518069108
4...

result:

ok 800000 lines

Test #94:

score: 0
Accepted
time: 6831ms
memory: 402632kb

input:

1000 1000 800000
0010000 10000 10000 10000 10000 0010 10000 10000 10000 0010000 0010000 10000 0010000 10000 10000 0010000 10000 10000 10000 0010 10000 100 10000 10000 10000 100 0010 10000 10000 10000 0010 10000 0010000 0010 10000 100 0010 100 10000 10000 0010 10000 0010000 10000 100 0010000 0010000 ...

output:

457048640
723506970
977949931
741782510
867300130
54003525
790503891
752853460
214698120
99470635
381295225
541519000
987416590
386508200
31204765
88491125
811722740
255060855
25393605
676913935
476516145
716146990
646904280
898640300
81669800
581849705
700279625
422648870
104373765
992000195
911993...

result:

ok 800000 lines

Test #95:

score: 0
Accepted
time: 1668ms
memory: 401968kb

input:

1000 1000 800000
10111 1011 101111 10111 10111 101111 10111 1011 10111 10111 10111 10111 1011 1111110 101111 1011 101111 10111 101111 10111 1011 1011 1111110 101111 1011 10111 1011 1111110 1111110 10111 1111110 101111 10111 101111 1011 1011 10111 10111 10111 1111110 10111 1111110 10111 10111 10111 1...

output:

968374116
396099591
972495691
186656421
905122501
314464656
39926421
904838881
929651641
312462966
326114441
524408096
751630661
202626361
479895101
927652046
963481351
512599226
617561931
609449266
602222821
662013936
288228401
591117521
426369761
163266251
34888131
340949616
23204931
366763536
884...

result:

ok 800000 lines

Test #96:

score: 0
Accepted
time: 1911ms
memory: 396376kb

input:

999 999 799999
0001101 1010 0001101 0001101 00001 1010 0001101 0001101 0001101 0001101 0001101 00001 0001101 100100 100100 0001101 1010 0001101 0001101 00001 100100 0001101 0001101 0001101 100100 0001101 100100 1010 0001101 0001101 00001 0001101 0001101 0001101 00001 1010 00001 0001101 00001 0001101...

output:

256183020
908202528
612379513
794399060
295402866
158765850
148707786
515485401
1484691
302780211
117392455
224127405
812376225
845922507
62868969
210586745
435232017
93432852
70029177
259230361
767973153
631627587
106879182
168363604
784439130
357999918
1088203
240875813
822453294
92982085
89957099...

result:

ok 799999 lines

Test #97:

score: 0
Accepted
time: 2372ms
memory: 440488kb

input:

10000 80 800000
0111 1110111 110111 110111 110111 10111 10111 0111 10111 110111 1110111 0111 1110111 10111 1110111 10111 1110111 1110111 1110111 0111 10111 110111 110111 10111 110111 10111 1110111 10111 10111 0111 0111 0111 0111 110111 110111 0111 1110111 10111 110111 110111 10111 10111 110111 11101...

output:

596764067
867154749
882931141
245022809
291635008
933948914
590789501
761159365
558574031
206097167
290770978
9694749
8645200
692181573
677067444
346453800
659265114
292633736
750611093
55618066
603068433
738876784
252710914
787236889
436721091
797536125
534294391
937315202
286113904
752026219
93995...

result:

ok 800000 lines

Test #98:

score: 0
Accepted
time: 2519ms
memory: 440972kb

input:

9999 78 799998
0111111 11011 11011 101111 1011 11011 11011 101111 101111 101111 101111 11011 11011 101111 101111 1011 101111 101111 0111111 1011 0111111 0111111 11011 1011 11011 1011 11011 0111111 0111111 11011 0111111 1011 0111111 0111111 0111111 0111111 11011 1011 11011 0111111 101111 11011 011111...

output:

95864174
597782394
919450741
513597781
217071426
565634828
381160405
775311051
71907831
586575736
911307206
309022765
417904661
823786399
264186400
284315870
416920273
264969480
718290315
148900643
655359958
483091698
931096526
302589810
534551270
806223927
728589388
382294734
679749188
7829256
4234...

result:

ok 799998 lines

Test #99:

score: 0
Accepted
time: 2239ms
memory: 440908kb

input:

9996 77 800000
1101 11101 1101 11101 110 110 1110111 1110111 110 11101 1110111 11101 1110111 1101 1101 1110111 11101 110 1110111 1110111 11101 1101 1101 1110111 11101 1110111 11101 1101 110 11101 1110111 1101 110 11101 1101 1110111 1101 1101 11101 11101 1110111 11101 1101 1101 11101 110 11101 1101 1...

output:

581496456
599136599
267331986
340111686
536923735
754113914
117579126
354770572
879718976
64457190
922732153
695466249
865377332
403327957
746105836
12138340
658862378
100236418
103285350
566573675
740361480
483441752
6758783
952761040
777825420
672913772
15880124
30398119
529880886
404481572
866769...

result:

ok 800000 lines

Test #100:

score: 0
Accepted
time: 1092ms
memory: 415644kb

input:

80 10000 800000
10110 1110010 110111 0111010 1010110 0110101 1110000 010101 00100 0011010 10100 1011001 0111000 1010011 1111000 00111 100011 00100 1110001 0010110 0001 0011000 0110111 0110000 0110000 100101 1010100 101001 0111011 10101 101111 000001 101001 0011000 110001 000111 0110001 0111110 01010...

output:

424068823
780577248
144456277
109509930
763580340
673516885
122399568
938627829
376156368
439181586
995827047
743577228
245314342
921312995
661987863
49208838
41834574
436003561
402836033
274944804
68054442
670251168
540128494
131467587
650644282
57993274
805256333
478284987
344473581
300174283
1789...

result:

ok 800000 lines

Test #101:

score: 0
Accepted
time: 1206ms
memory: 415652kb

input:

10000 80 800000
1010 101101 100010 1100101 0100100 110011 11110 1110110 1000 100111 111010 1010 1000 101010 0100100 1101 1001 00011 00111 0100101 1110000 0100010 0101110 0101101 0111001 1100011 111100 100 0111100 0110010 100011 1110 1110100 101100 101110 1101011 0110110 0101010 0100001 00011 0110111...

output:

170686813
681436849
117901593
59525113
31050588
113099699
586381002
86097735
600037259
949018042
269322391
515857837
692448996
42214086
520368966
475585240
659388231
697535347
676100388
894624885
514169491
980170270
271577822
865763034
915931130
536419573
957422110
886084126
107794753
917017878
6905...

result:

ok 800000 lines

Test #102:

score: 0
Accepted
time: 780ms
memory: 405964kb

input:

1000 1000 800000
101 11000 0101000 111011 1001011 1001010 1101011 1011001 0011101 0111100 1011000 0111101 10100 110101 1111011 001001 10010 001001 1001011 001011 1001010 10000 001101 010001 10100 10100 10000 1101100 100101 10011 0011111 0101100 1011000 010101 0111000 0001 001011 1101000 1011000 1001...

output:

818286375
726187028
434924602
12959813
885550129
255044304
925529753
888083510
242875639
827917620
503545985
158375829
218024448
16459502
847101821
572281156
788474408
472555533
528603386
869400015
327184163
127412550
869716115
367449830
548924341
603334460
643831190
408483724
641532957
918038138
49...

result:

ok 800000 lines

Test #103:

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

input:

80 10000 800000
0100000 001 000001 010 1000000 1000000 0010 010 100 001 0000010 100000 000010 001 001000 0100 000100 10 010 001 0001000 010 00001 000100 00100 10 100 00100 100 010 00100 100 0000001 00001 0010000 10 10 010 0000001 1000 000010 0000010 00100 0100 01 000100 100 100 001000 10 0001 10 000...

output:

909243972
895878802
192669785
43135759
122072750
166247597
236182571
13952710
662612227
25009193
14431371
268309141
471905526
652787207
429630222
899377049
745349335
267936474
680265020
834864246
432274860
392885140
779671755
456166357
935322576
396897385
781204838
424000367
596562253
522346822
9973...

result:

ok 800000 lines

Test #104:

score: 0
Accepted
time: 2439ms
memory: 406688kb

input:

1000 1000 800000
1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 111...

output:

466067505
102826919
965321189
570088172
17249149
436703747
195257865
654442162
3473749
525942925
562596889
523001198
748212981
338634233
578601145
123441666
662993273
98611476
199563341
481121553
855990471
849276555
754813899
220310273
776334007
333318783
773268526
861037888
538922933
936225867
9082...

result:

ok 800000 lines

Subtask #8:

score: 1
Accepted

Test #105:

score: 1
Accepted
time: 909ms
memory: 374424kb

input:

10000 80 800000
10000 010 00001 1000 110001 0001001 00110 001010 101 110101 0111001 011100 00111 1011110 1101110 110001 1100 010 10 01001 01 11100 0010 1011 10 01011 0000101 111101 01 0110001 10 000010 10 110 10 110 110000 10 10 101100 100 1001 10111 01 011111 01011 101 01001 1010 01 101011 01 0100 ...

output:

130169453
555349519
192225031
912802322
413036379
86724075
570425514
564220731
912496705
715744504
50726133
972694571
228086181
688165832
364945867
692787539
1305526
662294029
893521459
735225638
445073221
449071842
3846947
875096986
49813684
667254528
303937671
135495762
573706829
833835368
7606702...

result:

ok 800000 lines

Test #106:

score: 0
Accepted
time: 1466ms
memory: 400620kb

input:

80 10000 800000
0001000 011101 0010 00110 0010 011101 011101 011101 011101 011101 011101 0001000 00110 011101 0001000 0001000 011101 011101 0001000 011101 0001000 0001000 011101 0001000 011101 0001000 011101 011101 011101 0001000 0001000 011101 00110 0010 011101 0010 011101 0001000 011101 00110 0001...

output:

801848599
347465946
719162703
818893441
579755670
181164820
393035915
609574675
436091924
267184293
764619983
451034551
38231654
972428420
596998079
93053502
803218442
544584861
629761909
771199877
392081606
423237193
99647882
833528924
962322301
670600662
856049623
556953746
955521822
977597173
993...

result:

ok 800000 lines

Test #107:

score: 0
Accepted
time: 3559ms
memory: 433668kb

input:

79 9999 799998
100000 0000010 0000010 100000 0000010 0000010 0100 0100 0000010 0000010 0000010 0000010 0000010 0100 0100 0000010 0000010 100000 0000010 0100 100000 0000010 0000010 0000010 0100 0000010 00001 0000010 00001 100000 0000010 0100 0100 0000010 0000010 0000010 0100 100000 0000010 0000010 00...

output:

988915044
197036628
124502628
58034142
957952357
92575103
157219711
361151355
142360741
344404646
269803497
895403731
228674528
650739479
617929828
747050883
51365214
643930698
875882005
290151377
346783211
226048639
95516335
501633718
64824590
798165961
88313615
378538704
622713208
35430953
3697657...

result:

ok 799998 lines

Test #108:

score: 0
Accepted
time: 1351ms
memory: 392280kb

input:

78 9998 799998
110 110 110 01111 110 01111 1101 110 110 1101 1101 1101 110 110 110 01111 1101 110 1101 110 1101111 1101111 110 110 110 110 1101111 110 1101 1101 110 110 110 110 110 110 1101 110 110 1101111 110 110 01111 110 01111 110 01111 110 110 110 110 1101 110 1101 110 110 110 1101111 110 1101 1...

output:

68799722
379015730
142912220
588854180
315470631
844201121
279314252
625788887
611014659
215534882
838969166
657722303
666671801
860127647
828623108
885349290
56815661
757094042
175095116
241452402
789398081
890786429
635943866
475600136
766163816
311974982
903011543
171130775
123392249
685365440
73...

result:

ok 799998 lines

Test #109:

score: 0
Accepted
time: 1808ms
memory: 394724kb

input:

10000 80 800000
0010011 01011 0010011 001000 001000 0010011 001000 0010011 001000 001000 001000 01011 0011 0010011 0011 01011 01011 001000 0010011 0010011 0010011 001000 001000 001000 001000 001000 001000 01011 001000 0010011 001000 001000 001000 001000 001000 001000 0010011 0011 001000 001000 00100...

output:

798044199
45918503
115281179
835559605
482952763
310968135
231936920
467319950
229207007
457216106
218198457
761769458
933530435
161591523
423013735
173310498
861864818
953759862
101064839
66193707
9906867
827668679
547316955
613758179
281991151
477361419
24382586
405753631
964629599
628609883
51660...

result:

ok 800000 lines

Test #110:

score: 0
Accepted
time: 4507ms
memory: 393360kb

input:

9998 79 800000
0001 1000000 000010 0001 01000 01000 01000 01000 01000 01000 01000 01000 01000 01000 0001 1000000 01000 01000 01000 01000 01000 01000 01000 0001 01000 000010 0001 0001 0001 01000 1000000 1000000 01000 01000 0001 000010 1000000 01000 01000 0001 01000 1000000 0001 01000 01000 0001 01000...

output:

171101376
451397921
511643961
990526251
871211346
260954171
845392326
475937891
157617406
679882996
265267621
688878926
971474501
163928946
603082106
455556676
981121561
474307906
850503526
160325311
654010816
56563226
592773586
686649386
546340021
233229846
336527031
744344791
723087191
743429121
6...

result:

ok 800000 lines

Test #111:

score: 0
Accepted
time: 1914ms
memory: 425776kb

input:

10000 80 800000
1110 1110 101 1110 1111110 1111110 1110 1110 1111110 1110 1110 1111110 1111110 01111 1111110 1111110 1110 1110 1110 1110 101 1110 101 101 01111 1111110 1110 101 1110 101 1110 01111 1111110 1110 1111110 1110 1110 01111 1110 1110 1110 1110 1110 1110 1110 1110 1110 1110 1111110 1110 111...

output:

886463755
821972591
2053028
584349848
984334535
516066419
746335591
992353679
892052375
876221007
998479175
7267615
703537807
71982779
422376431
365689843
747228495
643389719
17789243
743880243
133547104
741698079
87569007
557535355
899576835
503904183
515508747
619724827
548818239
987112171
7181678...

result:

ok 800000 lines

Test #112:

score: 0
Accepted
time: 1534ms
memory: 402156kb

input:

1000 1000 800000
1101110 1101110 1101110 1101110 1101110 11010 1101110 11010 1101110 1101110 1101110 110 1101110 1101110 1101110 1101110 11010 11010 1101110 1101110 1101110 1101110 11010 1101110 1101110 110 1101110 110 1010 1010 1101110 1101110 1101110 1101110 11010 11010 1101110 1010 1101110 110111...

output:

707325642
749073951
727494904
366149079
599199111
631177467
2076027
903357056
890583599
431918331
729338259
162041963
9381648
611035731
414749111
4193159
442326239
500537330
21934611
77208498
328045041
469111587
793638595
263405414
102366059
37032679
762667683
5870223
236187422
800466938
291800764
4...

result:

ok 800000 lines

Test #113:

score: 0
Accepted
time: 6035ms
memory: 400968kb

input:

999 998 799999
0000100 0000100 00010 0001 010 010 0000100 00010 010 010 010 00010 010 010 0000100 010 0001 010 010 0001 0000100 010 010 010 010 010 0001 010 010 0001 010 010 010 0000100 0000100 010 010 010 010 010 010 0000100 010 010 0000100 010 010 0000100 010 010 010 010 010 010 010 010 010 010 01...

output:

264946795
183507190
486164308
134727079
892895389
908005696
118130968
202767181
972101521
97557880
473379226
772239991
28647595
903785803
539354830
946829272
765892330
854400589
669238438
953250736
801753622
804093118
423710839
558997534
220013269
180831586
206858746
816620644
708886603
402469549
14...

result:

ok 799999 lines

Test #114:

score: 0
Accepted
time: 1579ms
memory: 401992kb

input:

1000 1000 799998
1101111 1101111 1101111 111101 01111 1011 1011 111101 1011 1101111 1101111 1101111 01111 1101111 01111 1011 01111 1011 1011 1011 1011 1011 1011 111101 1011 01111 111101 1011 111101 1011 01111 01111 1011 01111 1011 1011 1011 1011 01111 1011 1011 1011 01111 111101 1011 1011 01111 0111...

output:

561626665
517110537
120459229
989517757
598249181
394297885
843005093
941828057
940850005
980555713
305478717
42205897
167139270
421609025
32854933
496601505
276124317
137663197
769253117
496933573
251320181
788069405
854532585
399020717
470035713
727702669
506584137
903999609
41005257
72617873
9462...

result:

ok 799998 lines

Test #115:

score: 0
Accepted
time: 3880ms
memory: 441796kb

input:

80 10000 800000
000100 0000100 00010 1000000 00100 010000 0000010 0001 10000 0100 00100 010000 1000 001000 0000010 001000 0100 0100000 1000000 10000 0100 01000 100000 0010 0000001 0000001 001000 00100 00100 1000 100000 000010 0000001 0000010 0100 0000001 010000 0010 00100 100000 0001 100000 100000 1...

output:

132525813
363189947
922430581
775068011
187432150
875170634
477990835
464202338
596905539
120737421
778328590
513061992
584641727
747387953
125249947
95273775
223154933
28120847
611190323
831489055
18564562
978574151
279784221
931398105
949206116
303687303
694349889
177910249
218990124
950658679
776...

result:

ok 800000 lines

Test #116:

score: 0
Accepted
time: 2823ms
memory: 441096kb

input:

78 10000 799998
000001 10000 0010 0010 01000 1000000 0001000 001000 0001000 0001 00100 000010 0000010 00100 000010 01000 0100 010000 0100 1000 0001000 01000 0100 1000 000001 01000 0100 1000 0001 000010 0100000 0010000 1000000 1000000 00100 0010 0000010 01000 00100 00010 01000 00100 0010000 1000000 0...

output:

905044331
860705652
172919279
863541338
505146071
436642253
361089121
237822386
216677945
101431721
752440868
594411928
444590912
804144888
541159720
412484193
224054416
100113798
532214594
459941552
648802414
917223369
660424268
635313962
338144415
227001394
439644239
108109470
714728501
277103953
...

result:

ok 799998 lines

Test #117:

score: 0
Accepted
time: 2979ms
memory: 441620kb

input:

79 9996 799997
000001 00100 00001 00010 000010 00010 00100 01000 001000 1000000 0100000 0010000 00100 00010 1000 0100 001000 0010 010000 0100 000001 0001 0010 000001 0001 00010 1000 0000010 000010 0001 0000001 10000 0010 010000 0100000 0010000 0100 000001 0100 10000 1000000 0001 0010000 0100 00001 0...

output:

430701217
316577697
65109987
738447322
854168726
704655750
254557192
642664261
211186982
758030040
570962336
850038997
846824642
816835372
126778029
480901421
189934616
555521379
357130127
327077746
79226618
319895522
969214590
784045915
424092827
278094370
262736319
89533683
884262084
316634013
989...

result:

ok 799997 lines

Test #118:

score: 0
Accepted
time: 1184ms
memory: 417312kb

input:

78 9998 800000
110110 1011 111001 110010 010011 1001 01100 1000110 01001 1000010 01 1011110 01011 1101000 1001001 1011110 1000111 1010011 1001110 01101 1000101 01 1010101 11100 1101000 1000001 011011 01110 1101101 1000110 010010 011101 1010100 1101010 010100 110000 1000100 1000110 110101 01101 10001...

output:

492665870
134385892
559482512
993363403
444237837
419562839
484090295
705660990
881050501
519277321
200474790
12450218
448916943
12642082
930967909
880796339
146479190
447675319
731602230
167127559
998545849
63366919
525831286
277014862
641631139
811780052
27877944
160333543
589246944
308580645
5717...

result:

ok 800000 lines

Test #119:

score: 0
Accepted
time: 1207ms
memory: 416292kb

input:

9998 80 800000
0000001 1000011 0101011 0110101 1100101 1110111 001 001 011110 011 101000 0011001 10 0100011 1101001 101000 1010 001000 01010 0000101 011000 011001 0000011 101111 111000 111100 0111001 1000101 11000 0011011 0011111 0010101 101110 0100111 0001011 01010 001110 0100101 001110 0000111 010...

output:

672208277
12066984
208510282
774828421
725382142
186410564
145822998
205510496
794464707
118896016
949441090
683337375
991725303
561482931
558085153
92777070
633190438
665046736
246473413
274788675
501703018
688066950
852525418
996525354
410158503
118254871
289960450
107318798
571785218
919190309
13...

result:

ok 800000 lines

Test #120:

score: 0
Accepted
time: 762ms
memory: 405232kb

input:

1000 1000 800000
1110100 1001101 1000111 1111100 0010100 001100 0010110 11001 01010 01011 1111100 01100 0010100 101101 110101 100100 011100 01101 11000 11010 0000101 0100101 010100 001110 101110 01100 111100 0110101 0110100 010100 001101 0001101 0111 01101 0010101 1001 0000111 1001101 101100 001111 ...

output:

393458436
405140183
90896036
74138722
736966244
726584464
589210301
355483361
83793966
561974168
497317090
615168033
431844934
540816969
134654738
118756297
605052208
488602953
91851535
849748386
892451595
477999801
855228476
866220423
813510924
11135969
318169395
568677952
972534983
597876444
14472...

result:

ok 800000 lines

Test #121:

score: 0
Accepted
time: 2816ms
memory: 442324kb

input:

10000 80 800000
110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 110 ...

output:

725690439
864412614
946740295
490699179
644002722
614581794
260153330
832187144
14092953
921812531
81585712
162360783
149547081
765228890
839109081
634347071
4393675
989165765
110815188
488611455
938270980
140892244
485222440
871681981
677364709
401069599
831046561
807754823
855327521
796821046
2624...

result:

ok 800000 lines

Subtask #9:

score: 1
Accepted

Test #122:

score: 1
Accepted
time: 1076ms
memory: 381364kb

input:

66 15000 1000000
00001 0110 110010 010010 01011010 01 110 01101 0010 10101 1011111 0011011 1010 11100100 0110011 01100 1000111 1011 111110 001 111011 01100 0011 1010101 01100010 111100 011000 11010010 01 01111011 111010 011111 0100001 0111 01111011 001 0111010 010000 101 011 100 10100 110 100011 110...

output:

163164879
228575854
965852315
435303887
479976460
264754931
2373629
107504668
276053731
799982412
368757033
895568165
180509027
705281809
112516187
311463584
278276920
171553548
572447874
964609087
460247891
520313948
239292333
612271038
564232172
325640608
84907327
59213632
645704044
193537995
2605...

result:

ok 1000000 lines

Test #123:

score: 0
Accepted
time: 4369ms
memory: 458076kb

input:

66 15000 1000000
00001000 00001000 00010 00001000 00001000 0100000 00001000 00001000 00001000 00001000 00001000 00001000 00001000 00001000 100 00001000 00001000 100 100 00001000 00001000 00001000 00001000 00010 00001000 00010 00001000 00001000 00001000 100 00010 00001000 00010 00010 00001000 00010 0...

output:

379025892
691137484
120204140
49964796
891207060
260869100
844789796
922947412
859827788
428126780
473571300
707456796
469776332
872583188
915710060
147738092
262252116
874518972
747434276
25358588
82700596
749733220
184661692
242076452
723706284
783390724
905202788
921658412
573792404
829287652
185...

result:

ok 1000000 lines

Test #124:

score: 0
Accepted
time: 2047ms
memory: 402188kb

input:

66 15000 1000000
011111 10111 011111 10111 1101111 10111 10111 1101111 10111 10111 10111 011111 1101111 10111 10111 10111 01111111 10111 011111 01111111 10111 1101111 10111 10111 1101111 1101111 011111 1101111 10111 01111111 10111 10111 10111 10111 01111111 10111 1101111 1101111 011111 1101111 10111...

output:

11900341
986618976
538937451
856259317
565037996
163371246
816345441
211384851
604535366
893303361
717354161
48777031
454990221
8905006
331810136
372384121
129741431
187183431
523980051
384380421
122113561
146278146
116925921
198927966
69993176
930804166
255336731
831042821
949869631
424627141
20596...

result:

ok 1000000 lines

Test #125:

score: 0
Accepted
time: 1414ms
memory: 407660kb

input:

65 15000 1000000
11101 1010101 11101 01001000 1010101 11101 11101 11101 11101 1010101 11101 01001000 11101 11101 001 11101 11101 01001000 001 11101 01001000 1010101 11101 11101 11101 11101 11101 01001000 1010101 01001000 11101 11101 01001000 1010101 11101 1010101 11101 11101 01001000 1010101 0100100...

output:

975023173
577515839
736483446
976468382
375331936
598200744
222247329
628560306
528393484
265579113
694256662
578859272
957454478
762113699
500597119
246316185
793498414
447425308
763532032
499677520
518284624
150275480
945201766
24371077
255480894
863027142
942615003
80040813
82067133
482779070
349...

result:

ok 1000000 lines

Test #126:

score: 0
Accepted
time: 5701ms
memory: 405572kb

input:

15000 66 1000000
0001000 10000 0001000 0001000 100 100 0001000 10000 0001000 0001000 10000 0001000 10000 0001000 0001000 100 100 0001000 0001000 0001000 0001000 0001000 0001000 0001000 100 0001000 0001000 100 00010000 100 0001000 0001000 00010000 100 100 10000 100 0001000 0001000 0001000 00010000 10...

output:

139182809
518576095
261058913
173201500
928546979
875329115
58286693
901188389
677588467
499745214
150174391
296800633
718064231
39259853
937514847
79217694
513636420
55997294
584967470
636669281
238288564
5348094
162165181
10551355
25698312
120614182
81605646
580538535
214907332
974332313
628879842...

result:

ok 1000000 lines

Test #127:

score: 0
Accepted
time: 2631ms
memory: 453268kb

input:

15000 66 1000000
110 110 1110111 01111 01111 01111 01111 01111 01111 01111 01111 01111 01111 110 01111 01111 1110111 110 01111 01111 01111 01111 01111 01111 01111 110 11101111 110 01111 01111 110 01111 110 11101111 01111 01111 01111 01111 01111 01111 110 01111 01111 01111 01111 01111 01111 110 01111...

output:

343946195
141844235
954246525
651833445
641301980
126323845
888076710
208542500
392968530
416341995
444061020
878835025
373545155
821862505
55900160
461321225
702928930
920400685
511524620
36051560
397620780
740278676
448128366
947544695
952041650
460395680
34112260
176096275
539864475
385432795
172...

result:

ok 1000000 lines

Test #128:

score: 0
Accepted
time: 2321ms
memory: 446400kb

input:

14999 65 1000000
1011111 00101100 1011111 00101100 1011111 1011111 110 00101100 1011111 1011111 1011111 1011111 1011111 1011111 1011111 00101100 1011111 1011111 1011111 1011111 10110 1011111 110 1011111 00101100 1011111 1011111 110 00101100 1011111 1011111 00101100 00101100 1011111 1011111 10110 101...

output:

818224016
105825203
628291504
536962539
34478289
396516401
125131518
819416539
746665854
688174278
965988344
873558044
720033064
370815747
282509522
576086664
48438525
581283024
85779174
490169276
390463869
240003924
990891139
953744364
127805448
303602459
752446714
65603063
702028644
635380138
7620...

result:

ok 1000000 lines

Test #129:

score: 0
Accepted
time: 8558ms
memory: 409500kb

input:

1000 1000 1000000
0100000 000010 0100000 0100000 10000 10000 00000001 10000 0100000 0100000 000010 10000 00000001 10000 10000 10000 00000001 10000 10000 00000001 10000 10000 10000 10000 0100000 10000 10000 10000 10000 00000001 000010 0100000 10000 10000 10000 000010 10000 10000 000010 10000 0100000 ...

output:

423410110
368647445
361076865
24430585
283715730
502426375
28088280
761589320
195537050
102588775
101902600
578840520
518095145
3857115
530958685
79172885
877694805
352192540
317776965
205818885
476508360
331244085
529443635
142860745
895165150
103629710
176779875
890451685
700058460
443827295
89800...

result:

ok 1000000 lines

Test #130:

score: 0
Accepted
time: 1944ms
memory: 410720kb

input:

1000 1000 1000000
1111011 111011 1111011 01111111 1111011 1111011 1111011 1111011 1111011 1111011 1111011 01111111 11011 11011 1111011 01111111 1111011 111011 111011 1111011 1111011 11011 1111011 1111011 1111011 1111011 1111011 1111011 1111011 11011 1111011 111011 1111011 1111011 1111011 11011 01111...

output:

191476695
198312167
886323981
69897699
820010398
658613197
234381712
209925139
585840630
170699176
122921593
513229476
314904146
442125030
139210537
428503618
616152800
19012872
978324617
432048257
581511326
901350937
658389694
323468044
541415613
441105816
138255870
216680146
295484270
778074679
55...

result:

ok 1000000 lines

Test #131:

score: 0
Accepted
time: 1480ms
memory: 407604kb

input:

999 999 999999
01111101 01111101 01111101 01111101 100 100 100 01111101 00101 00101 01111101 01111101 01111101 00101 01111101 00101 01111101 01111101 01111101 100 01111101 01111101 100 01111101 0100011 01111101 01111101 0100011 00101 01111101 01111101 01111101 01111101 01111101 0100011 100 01111101 ...

output:

3485731
676862841
280405264
878063822
943537098
607189711
894639078
860536826
170651766
379172818
822531443
155126864
803399293
936409253
925071738
890136516
646959264
97073839
107094541
556582733
62930792
487974743
817354996
972926841
946104131
308266461
548839683
208679131
144034977
333141617
2187...

result:

ok 999999 lines

Test #132:

score: 0
Accepted
time: 3277ms
memory: 469880kb

input:

15000 66 1000000
011111 11110111 011111 11110111 011111 011111 1110111 1110111 011111 11110111 011111 011111 1110111 011111 10111 11110111 1110111 10111 011111 11110111 1110111 011111 011111 11110111 1110111 10111 11110111 11110111 10111 11110111 011111 1110111 10111 1110111 11110111 1110111 1110111...

output:

443904833
720735341
126338313
61911634
259673752
624763927
648250110
685906360
575121225
500587028
133512186
6339731
661208415
928153110
654680657
855636456
416698297
940225184
689284677
186719991
93111640
112490257
629932622
823898387
51592162
47870083
857047465
962538000
511160456
957246810
792080...

result:

ok 1000000 lines

Test #133:

score: 0
Accepted
time: 3305ms
memory: 468500kb

input:

14998 64 1000000
1011111 11011111 1011111 11110 11110 11110 11011111 1011111 1011111 11011111 11011111 11110 11110 11110 11110 1011111 1011111 111110 111110 111110 1011111 111110 11011111 111110 11110 1011111 11011111 11011111 111110 11110 111110 1011111 1011111 11110 111110 11011111 1011111 11110 1...

output:

64748743
541474336
751609300
587052428
228015348
28224139
776839086
656491156
585178477
83929761
263364257
554270539
207741662
729499146
46662532
959215572
35233157
971148561
218300490
53828987
41758409
309123560
865257701
565882710
681310785
372033522
386986859
444717798
351881444
360974488
5543919...

result:

ok 1000000 lines

Test #134:

score: 0
Accepted
time: 3006ms
memory: 467540kb

input:

14999 64 999998
10111 10111 011 011 1111011 1111011 011 011 10111111 10111111 1111011 1111011 10111111 011 1111011 1111011 011 10111 10111 10111 10111111 10111 10111111 10111111 011 1111011 10111 10111111 011 10111 10111111 011 011 10111 1111011 10111111 10111 10111111 1111011 1111011 10111111 11110...

output:

176093727
65971065
986123442
910273703
177259438
292091930
906475443
586273732
461768161
389811119
212173823
733048593
882029932
573050749
712024048
758773047
207863236
365397881
166082518
966589484
247133688
130054047
160301071
817282491
345976937
902925142
605272366
836060785
303662654
590662044
9...

result:

ok 999998 lines

Test #135:

score: 0
Accepted
time: 1627ms
memory: 443916kb

input:

66 15000 1000000
1101100 0001110 10001010 00011100 10001100 00101000 001010 00011100 1001101 1011000 11111101 10001111 00001101 111010 10011001 0011100 0101000 00111111 00111110 00101001 0111000 000010 01001100 01101000 1011000 01011010 01011000 0101111 1001111 0101000 1001001 1101101 0101000 000100...

output:

933808106
44920486
790774693
6219011
165537715
510524903
711470276
966037766
488991277
578381775
470955726
632981312
717120593
735510396
579851554
289875238
329864395
767877032
922262484
503148103
34428478
511486797
304478127
265953703
272049650
102832532
940372678
718064363
891468788
427056478
4582...

result:

ok 1000000 lines

Test #136:

score: 0
Accepted
time: 1702ms
memory: 443808kb

input:

15000 66 1000000
0010001 11000111 1010001 00000110 1000101 110101 10110110 0010101 10000110 1001001 0011101 11011110 0101011 11101110 01100 1000011 10011010 111100 00000110 10111011 01010111 111100 00101110 01110111 10001010 01001 00101011 10110011 1001001 1011001 10101110 01010011 1010 11110010 111...

output:

680510637
502769465
139348521
553388829
968668885
467414889
133637291
635729282
543453469
412132151
131852326
431905185
640957142
675881515
793559596
763904212
761179844
880449660
373716417
28210499
6749965
323527319
35315995
985172053
777927350
63610997
390424724
948256310
71328241
470793131
557624...

result:

ok 1000000 lines

Test #137:

score: 0
Accepted
time: 889ms
memory: 410552kb

input:

1000 1000 1000000
1100111 0001010 11101110 1000110 0101111 001010 00011110 1000011 10101000 00001000 00111111 00111100 10101001 0100111 1010111 001011 10011011 01111000 0000111 01111 0100110 11001010 10001010 1010010 10011001 11011110 01011000 1001011 01001110 10011010 01101010 1101110 001000 101110...

output:

294175464
530567435
561275417
484575777
514299794
263653011
440177651
725789906
305603371
841746093
867418499
354939073
220305539
571255898
194148
127914785
568908597
859306148
309892395
889380420
702861450
720156762
284273522
424499258
196751368
110468823
436492854
969245369
878415678
42748266
9485...

result:

ok 1000000 lines

Test #138:

score: 0
Accepted
time: 5201ms
memory: 470140kb

input:

66 15000 1000000
00100000 0000010 100 0010000 010 0000100 01000 001 1000000 00001000 10 10 010 100 0100000 001000 01 010000 0100000 010 01000 0000010 001 0010 01 0000001 0010 0000100 010 100000 10 01 1000 100 0000100 01000 10000000 00100000 0000010 100 100000 00100 1000000 0001000 000100 000001 10 0...

output:

863919221
183764618
949364952
242011843
313536924
771260920
406726459
952708680
644042185
11138990
767364541
422402081
872986061
529960865
673879759
223511211
792652420
509474292
503535604
622343412
801943362
679941461
333329312
978516142
201694527
614824537
437463512
946590952
127122638
334729230
4...

result:

ok 1000000 lines

Test #139:

score: 0
Accepted
time: 2429ms
memory: 413748kb

input:

1000 1000 1000000
111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 111011 11...

output:

65239691
743156029
37463693
98172366
751709028
898852366
77533234
153430831
606370914
674467623
196916735
75247796
443165407
264523648
663318717
819704151
944540149
8946192
173379315
60981407
481439707
200039683
602512464
276799598
475905423
203633886
313023836
377738680
700892876
211135575
20972803...

result:

ok 1000000 lines

Subtask #10:

score: 1
Accepted

Test #140:

score: 1
Accepted
time: 1116ms
memory: 382416kb

input:

15000 66 1000000
0010111 0110 100 10 010 0001000 010111 0010101 010011 101010 110 11001 1010110 10 00010100 01 010011 1101 0011 0011100 01011 1001 01 011 10100 11110001 10 001 10 001110 11100 01101000 01001 1110 011 1110 01110 0011111 00001 01000011 110011 11100 10001 0010 0010 001 01000 01 011 1110...

output:

211396835
20605089
567940304
58895984
88316671
16028748
378908463
170905804
530689535
116520461
875742799
100663882
111706729
839483719
536906868
78255734
838048087
403319135
577738784
754862511
128054468
645106799
110464458
465260221
513038561
451718654
252366840
901815339
958765311
526407259
43864...

result:

ok 1000000 lines

Test #141:

score: 0
Accepted
time: 1740ms
memory: 418528kb

input:

66 15000 1000000
11100 11100 11100 11100 1110111 010 11100 11100 11100 1110111 010 11100 11100 11100 11100 10101011 10101011 1110111 11100 11100 10101011 11100 10101011 11100 010 11100 11100 10101011 10101011 11100 010 11100 10101011 10101011 11100 11100 11100 10101011 010 11100 11100 10101011 10101...

output:

29440901
92789593
218956728
116551520
467096024
581990770
791335420
577616180
840384317
952322030
936103651
756773893
327886740
565259576
923083257
968915910
362843026
951559500
565241113
136767893
284801500
863872395
797560081
392348193
346438193
948528580
411739321
116351323
235008515
189168784
97...

result:

ok 1000000 lines

Test #142:

score: 0
Accepted
time: 4005ms
memory: 458524kb

input:

65 15000 999999
00001000 00001000 00001000 00001000 00001000 010 00001000 010 00010 00010 010 00010 1000000 00001000 010 00001000 010 00001000 00001000 00001000 010 010 00001000 00010 1000000 00010 00001000 010 00001000 00001000 010 00010 00001000 00001000 00001000 00010 1000000 00010 00010 00010 00...

output:

842236004
584458092
360062428
336257500
3489540
795575044
338505092
714765876
860237804
357344092
760076068
110942492
257582828
377390812
483237108
541835708
101025988
843482292
119020764
766004020
889586020
783699172
74784436
638551868
270026308
712080252
137134692
382726636
417116356
728396140
835...

result:

ok 999999 lines

Test #143:

score: 0
Accepted
time: 1960ms
memory: 402264kb

input:

64 15000 1000000
11011 11011 101111 101111 101111 11011 101111 101111 101111 101111 1111110 101111 101111 10111111 101111 101111 10111111 1111110 10111111 101111 101111 101111 10111111 101111 101111 101111 101111 10111111 10111111 101111 101111 101111 11011 101111 101111 10111111 1111110 1111110 110...

output:

737595067
77461567
798717619
412210069
105503635
881166733
261772495
856218019
62768503
682417765
885839653
562128511
118775611
309115663
14724463
386519203
290680487
155915665
439385899
195335563
94326295
21582475
628988701
140308279
953685433
656090059
926216527
251868673
263113771
213353521
64329...

result:

ok 1000000 lines

Test #144:

score: 0
Accepted
time: 2161ms
memory: 418420kb

input:

15000 66 1000000
11100 11100 11100 00010111 11100 0111100 11100 0111100 11100 11100 110011 11100 0111100 0111100 00010111 00010111 11100 11100 11100 11100 11100 11100 11100 11100 0111100 0111100 110011 110011 11100 11100 11100 00010111 11100 00010111 0111100 11100 0111100 110011 11100 11100 11100 01...

output:

637373136
141915323
995226846
576793659
744447807
699922224
805302777
842446063
54624039
160135658
656809562
356598542
282433080
81401242
84533802
777864176
711820798
816407238
969068979
755767280
835472472
919592223
305727438
590178940
563201628
494179158
234740306
274131445
971664727
963771016
222...

result:

ok 1000000 lines

Test #145:

score: 0
Accepted
time: 5373ms
memory: 405100kb

input:

15000 65 1000000
00000010 10000 00000010 10000 10000 00000010 10000 0100000 10000 10000 00000010 10000 10000 10000 0100000 0100000 10000 001 10000 10000 10000 001 10000 00000010 10000 00000010 10000 10000 001 10000 10000 10000 10000 001 001 00000010 10000 00000010 00000010 10000 10000 10000 10000 10...

output:

312092495
847240205
570631625
25245405
162121445
547016095
767515615
195233650
645029035
873445210
308960690
224171930
742610015
843033805
127634890
638406095
353508465
771307445
2785516
568285225
133997805
868196130
728255735
686958215
271989916
84112995
827732895
476444495
968195370
526032591
7241...

result:

ok 1000000 lines

Test #146:

score: 0
Accepted
time: 2963ms
memory: 458692kb

input:

14999 64 999999
11110 1011111 11101111 1011111 1011111 111110 11101111 11101111 11101111 1011111 11101111 111110 11110 11101111 11101111 11101111 111110 111110 11110 11110 11101111 111110 1011111 111110 11101111 1011111 111110 1011111 11101111 11101111 11110 11101111 11101111 11101111 11101111 11110...

output:

46980091
475945307
356839307
290104331
848046531
748773523
909118683
392619003
561881139
623088923
407330891
585265723
711638931
295008883
676900971
347885603
83959307
932466347
533833539
482261931
426718923
195096675
139847323
792518419
771922243
715838779
823491307
390028459
96616203
670750323
673...

result:

ok 999999 lines

Test #147:

score: 0
Accepted
time: 1625ms
memory: 402404kb

input:

1000 1000 1000000
1111010 01011 01011 101 01011 01011 101 1111010 1111010 01011 101 01011 00010111 01011 1111010 01011 1111010 1111010 01011 01011 01011 01011 01011 01011 1111010 1111010 01011 01011 1111010 01011 01011 01011 01011 1111010 1111010 1111010 1111010 01011 101 01011 1111010 01011 1111010...

output:

884187855
849675382
281254367
146292877
785593099
953238368
815011280
185862976
604803955
660353384
931630608
807356607
263388904
368235586
938212596
388339730
82488205
777741647
164206147
942345756
87227488
591548765
452790507
159123295
680521215
810041496
897323931
300930128
513376327
172523725
51...

result:

ok 1000000 lines

Test #148:

score: 0
Accepted
time: 8386ms
memory: 408976kb

input:

999 1000 999999
10000 10000 10000 10000 10000 10000 0000010 00100000 10000 10000 10000 010000 10000 10000 10000 010000 10000 10000 00100000 00100000 10000 0000010 010000 00100000 010000 00100000 10000 0000010 10000 010000 010000 00100000 10000 10000 10000 10000 010000 10000 00100000 0000010 10000 10...

output:

641585850
910774845
249992495
941688045
395260595
264167435
749017115
231850855
205886850
815417371
93828045
961325275
247553600
897130650
989239835
164461365
713299960
555762790
504247535
358926890
506214185
70798730
926966490
849664705
720253605
468583955
698308065
308045750
269721490
838335525
76...

result:

ok 999999 lines

Test #149:

score: 0
Accepted
time: 1813ms
memory: 409296kb

input:

998 998 1000000
11101 101111 11101 11101111 11101 11101 11101 11101 11101 11101 11101 11101 11101111 11101 11101 101111 1110111 11101 11101 101111 11101 11101 11101 1110111 11101 1110111 11101 11101 11101 11101 11101 11101 101111 11101 11101111 11101 11101111 11101111 1110111 11101111 1110111 11101 ...

output:

947330148
443181388
381999513
342171988
916754843
831544973
280566748
646528528
202733798
513959408
90859964
948472898
564996738
14902903
67473953
989049483
219930233
111468938
96046933
74747603
88176483
219801228
164220713
702342258
930545483
316881078
436665608
161496433
936381313
348680523
903075...

result:

ok 1000000 lines

Test #150:

score: 0
Accepted
time: 5657ms
memory: 468148kb

input:

66 15000 1000000
100 001 0000100 010 00100 1000000 00100 00000100 00000001 10000 00100 10000000 00000010 00000010 100 10000000 001 10000 00001000 00000001 001 00001000 1000000 01000000 00000100 0000001 00000010 00001 010 00010000 01000000 001 00001 10000 00100 10000000 0000100 00100 00100 0000010 01...

output:

470010644
988276060
221335283
171311085
28449538
796284110
341010843
119586833
795696312
344196505
362547648
517365484
586735723
397700729
315371643
976193100
538897611
510865424
959150782
930107187
43294261
277778725
100860257
40909178
94489774
682953427
71638728
154583531
531401667
375242855
83325...

result:

ok 1000000 lines

Test #151:

score: 0
Accepted
time: 5328ms
memory: 468780kb

input:

65 15000 1000000
0001000 0000100 000100 01000000 00100 0001000 0010000 0010000 00000100 000001 00010 01000 10000 00100000 00100 10000000 00010 00000010 00000100 0000010 001000 00100 00010 00001 1000000 00100 0000100 0010000 01000 0000001 00100000 000001 00001 000010 001000 0000100 1000000 00001 0000...

output:

917312741
684333766
419279369
241351570
218370552
727194776
90466159
336593855
770057060
314708186
14119609
624587297
628489839
371918894
542936688
882370585
8065268
8121767
393646213
582424899
135893513
203526700
76931543
294968700
806726901
617380418
985418745
656364350
521018009
839854037
3007937...

result:

ok 1000000 lines

Test #152:

score: 0
Accepted
time: 4255ms
memory: 469628kb

input:

66 15000 999997
0001000 0000001 1000000 0100000 100 10000 00001 00001000 100 001 0000100 00000010 00000100 100 00001 0001000 00000010 0000001 010 001 00010000 01000 010 00000100 001 1000000 0000001 10000000 00001 0000001 00000010 00100000 0010000 001 010 00010 001 10000000 0100000 00010 0001000 0010...

output:

836431788
324905486
753230451
412480935
710007049
234373706
550041595
582166723
199034566
26139723
492827534
618504518
889915979
641872099
841955318
268252332
267023132
806529534
809895589
7720288
146711438
897305286
456401651
792815616
433584612
648468497
794990183
498029225
594614144
918248128
183...

result:

ok 999997 lines

Test #153:

score: 0
Accepted
time: 1692ms
memory: 445192kb

input:

65 15000 1000000
0011111 01111 11011011 001001 011001 11101100 11111101 0011011 100001 01000001 11100100 0110 01010 0001101 01001010 0001101 101011 011111 01000000 110101 1111011 0101110 01100101 01000101 1001111 11011011 11010000 11100010 011 01000 010001 01011000 01100010 01111000 01000 11010 0100...

output:

946782758
967390084
546649510
219481785
225661821
115122650
16321206
324848925
347603098
163138535
617827112
99335698
768755820
844026549
695177328
775394354
420597239
30339033
922736046
910908778
255917677
974846339
207030846
909596025
77896728
276972538
806384698
460531618
262421807
213324636
7872...

result:

ok 1000000 lines

Test #154:

score: 0
Accepted
time: 1835ms
memory: 443608kb

input:

14998 64 1000000
01000100 01000001 1001010 11000000 0011101 01110011 01111100 11100000 01011100 11010 11000111 01100100 11101001 0101011 11001010 0101100 01001110 001100 01000110 11111000 01100110 01100011 11010 01110 0001001 01000100 110101 11101000 0001010 11001110 01110001 0111000 11001101 011110...

output:

777089405
603104475
397751147
102795632
100664324
610747033
420318053
2114927
22036343
413877611
928213288
573403724
473955671
735667150
71383525
505447168
88726934
874347984
828878215
303939144
433205921
472265107
535988434
420775025
606091073
46757585
114946391
281739839
90385334
487137600
1265842...

result:

ok 1000000 lines

Test #155:

score: 0
Accepted
time: 814ms
memory: 409572kb

input:

998 1000 1000000
11100 00011100 1100 00111001 0010100 1011101 10111101 1100100 00011010 11001101 1001100 01001010 10011011 00101101 01111000 01111110 10001000 10001101 01101100 00101 1101100 0110101 01101110 1011111 0100100 110111 10111100 01011000 010 0011110 000111 1001 1010111 11001011 11011001 1...

output:

547477809
275616789
669919613
122874647
512643465
3061693
995227233
10557091
196858557
970547255
391039955
34136344
380825160
598632196
513504655
974654973
33437577
208552800
348998298
374751638
293520694
224397626
370845875
960484695
313983188
406598063
687023112
387424746
98101128
360584251
764672...

result:

ok 1000000 lines

Test #156:

score: 0
Accepted
time: 3631ms
memory: 470164kb

input:

15000 66 1000000
011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011 011
111011 111011 11101...

output:

99805750
414327260
662393640
700113824
431649558
8095363
558908048
806014162
158553603
334683217
665859209
460699887
762692669
664949991
975237435
381894353
874520269
101382574
747076237
131501273
487673332
150445851
379496282
856361106
116511434
723383488
835541898
704276256
741306765
408908698
949...

result:

ok 1000000 lines