QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#286512#7967. 二进制ucup-team022AC ✓432ms217812kbC++172.6kb2023-12-17 23:02:042023-12-17 23:02:04

Judging History

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

  • [2023-12-17 23:02:04]
  • 评测
  • 测评结果:AC
  • 用时:432ms
  • 内存:217812kb
  • [2023-12-17 23:02:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef priority_queue<int,vector<int>,greater<int> >PQ;
const int N=1048577;
int n,m;
char s[N];
int pre[N],nxt[N],a[N];
int B[N];
inline void add(int i,int x){for(;i<=n;i+=i&-i)B[i]+=x;}
inline int ask(int i){int x=0;for(;i;i&=i-1)x+=B[i];return x;}
PQ P[N],Q[N];
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cin>>n;
    cin>>(s+1);
    m=n;
    for(int w=1,len=1;w<=n;w<<=1,++len){
        memset(B,0,sizeof B);
        int mask=(1<<len)-1;
        for(int i=1;i<=m;++i)nxt[i]=i+1,pre[i]=i-1;
        nxt[0]=1,pre[m+1]=m;
        a[1]=0;
        for(int i=1;i<=len;++i)a[1]=a[1]*2+(s[i]-'0');
        for(int i=2;i<=m-len+1;++i)
            a[i]=(a[i-1]<<1|(s[i+len-1]-'0'))&mask;
        for(int i=1;i<=m-len+1;++i)
            Q[a[i]].emplace(i);
        int del=0;
        for(int i=w;i<2*w&&i<=n;++i){
//			cerr<<"QWQ"<<":"<<i<<" "<<m<<endl;
            if(len>m-del||Q[i].size()==P[i].size()){
                cout<<"-1 0\n";
                Q[i]=P[i]=PQ();
                continue;
            }
            del+=len;
            while(P[i].size()&&Q[i].top()==P[i].top())Q[i].pop(),P[i].pop();
            int pos=Q[i].top();
            cout<<pos-ask(pos)<<" "<<Q[i].size()-P[i].size()<<'\n';
            Q[i]=P[i]=PQ();
            int np=pos,pr=pre[pos];
            add(pos,len);
            for(int j=1;j<=len;++j){
                if(a[np]>i)P[a[np]].emplace(np),a[np]=0;
                np=nxt[np];
            }
            nxt[pr]=np,pre[np]=pr;
            if(len>m-del)continue;
            for(int i=1;i<=len;++i)pr=pre[pr];
            if(pr==0)pr=nxt[pr];
            np=pr;
            if(a[pr]>i)P[a[pr]].emplace(pr),a[pr]=0;
            a[pr]=0;
            for(int i=1;i<=len;++i){
                a[pr]=a[pr]<<1|(s[np]-'0');
                np=nxt[np];
            }
            if(a[pr]>i)Q[a[pr]].emplace(pr);
            for(int i=1;i<=len+1;++i){
                pr=nxt[pr];
                if(pr>m)break;
                if(a[pr]>i)P[a[pr]].emplace(pr),a[pr]=0;
                if(np<=m){
                    a[pr]=(a[pre[pr]]<<1|(s[np]-'0'))&mask;
                    np=nxt[np];
                    if(a[pr]>i)Q[a[pr]].emplace(pr);
                }
            }
//			for(int i=nxt[0];i<=m;i=nxt[i])cerr<<s[i];
//			cerr<<endl;
        }
        static char tt[N];
        int nlen=0;
        for(int i=nxt[0];i<=m;i=nxt[i]){
            tt[++nlen]=s[i];
        }
        m=nlen;
        for(int i=1;i<=m;++i)s[i]=tt[i];
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 16ms
memory: 73208kb

input:

20
01001101101101110010

output:

2 11
5 5
4 5
11 1
4 2
7 1
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0

result:

ok 20 lines

Test #2:

score: 0
Accepted
time: 180ms
memory: 166728kb

input:

1000000
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1 1000000
-1 0
1 999998
-1 0
-1 0
-1 0
1 999995
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
1 999991
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
1 999986
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0...

result:

ok 1000000 lines

Test #3:

score: 0
Accepted
time: 262ms
memory: 163364kb

input:

1000000
1111111101011101110011011111111111111110110011110111011100111001011011011110101110111111111111111111111111011111101111110110111111111110111010111111100110011101101110011111111101111110111111111110111111111111011011110110111101101101110101100111111111001010111111111111010111011111111011110111...

output:

1 800681
7 159535
1 641144
13 31730
5 127804
5 127761
1 513379
542 6405
25 25324
54 25337
5 102464
30 25561
17 102196
17 102484
1 410890
2647 1324
618 5080
20 5103
99 20219
304 4894
89 20442
21 20308
15 82150
810 5135
82 20422
158 20309
20 81880
83 20567
39 81909
40 82119
1 328769
4222 267
2829 1056...

result:

ok 1000000 lines

Test #4:

score: 0
Accepted
time: 227ms
memory: 162860kb

input:

1000000
1101111101110111111111011101011111110111101001111110111111110100111111001011111011110011111011100111111111111111010001111110011010101111111111011100110111010101111111111111111110110111001101111111100111111011110111111111111111101111111110101010011111101110111111111111111111111101111110111111...

output:

1 800315
1 159901
1 640412
38 31850
3 128050
3 128165
1 512243
97 6369
45 25480
12 25565
8 102482
40 25580
13 102583
13 102460
1 409776
295 1288
274 5080
345 4929
39 20549
187 5053
73 20509
118 20499
14 81980
447 5084
39 20492
84 20487
17 82091
52 20447
16 82006
16 82071
1 327699
441 231
571 1056
28...

result:

ok 1000000 lines

Test #5:

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

input:

1000000
1011101110000111111111111010111100111001110111111101111110010111011011101111111111111111011111111011111111111111110110111111111110111111001011111101110111111011111111111111111011110011111011111100011111110110111111110110111100111101111111111011111111111011110111101111101011111111111111111111...

output:

1 799990
4 159695
2 640293
4 32324
17 127370
2 127967
3 512321
177 6381
15 25942
244 25350
10 102018
11 25885
12 102077
15 102178
3 410139
2620 1289
753 5091
16 5090
134 20850
959 5103
279 20246
18 20591
20 81421
770 5138
79 20743
292 20352
31 81720
147 20754
34 81414
45 81806
3 328330
6959 252
3565...

result:

ok 1000000 lines

Test #6:

score: 0
Accepted
time: 263ms
memory: 162616kb

input:

1000000
1001011111111110110111110111100110111110111111111111111111111101110111010010110101111101101101111010100111110111111101111111111101001111101100100101111111111110010011111111100111111110110111101111111111101111111111111111111101111111111111010100001111110111100111011110101111111111111101111101...

output:

1 799378
3 160096
3 639280
24 32304
10 127791
9 127869
3 511407
225 6534
55 25770
57 25712
10 102073
48 25844
11 102022
12 102244
3 409159
808 1350
451 5183
95 5244
56 20525
78 5110
52 20603
41 20369
29 81699
941 5203
83 20637
66 20630
27 81387
70 20753
30 81486
30 81965
3 327185
7290 264
1512 1085
...

result:

ok 1000000 lines

Test #7:

score: 0
Accepted
time: 287ms
memory: 159100kb

input:

1000000
1110011111011011101101111110010111111111011111101111111011011001111110101110010111110111101101111011011111010101111011111010110001001101110111110101111111101101111111111111101100011110101011101111100111100111010100111111010101001111101111111111010111111011010101110111011111111110111011111100...

output:

1 749001
2 188027
3 560972
22 47144
1 140882
1 140831
4 420138
109 11902
2 35242
48 35463
2 105414
35 35381
4 105445
9 105566
1 314570
671 2951
127 8950
30 8758
76 26482
146 8914
56 26546
18 26627
10 78783
547 8948
117 26429
55 26351
23 79089
107 26490
22 79070
19 78934
1 235630
2187 735
606 2215
20...

result:

ok 1000000 lines

Test #8:

score: 0
Accepted
time: 284ms
memory: 158832kb

input:

1000000
1111111111111110111101101111011101111101110111001111011111101111111111101111001111011101111101111001111100101010111100101111111111111011011111011001111111111111111101111111001110111101111111111110011111111111110111011010010111010111110111111111110001111111111111111011010011110111010011111011...

output:

1 749933
14 187494
1 562437
41 46840
15 140653
14 141001
1 421432
229 11754
59 35085
86 34888
14 105763
71 35195
13 105802
14 105692
1 315736
510 2914
520 8839
63 8754
95 26329
162 8710
166 26174
83 26395
12 79364
580 8784
60 26408
183 26168
13 79628
95 26269
14 79416
20 79323
1 236408
617 796
752 2...

result:

ok 1000000 lines

Test #9:

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

input:

1000000
1011111110111111111101011001101101010110101011111011111101101011101011110101010110101111110011111111111111110101111111101111111110110111000011110111111101110111111111111110011100111111011011111011001101111111010011011000011011110011011010111110110101111111110011101111001111001111110101011111...

output:

1 749803
8 187706
2 562095
20 46853
15 140852
13 140526
2 421565
119 11681
73 35171
15 35308
12 105543
137 35148
10 105375
8 105233
2 316323
168 2981
367 8699
688 8902
127 26266
154 8789
4 26515
14 26628
7 78911
682 8723
126 26421
12 26492
8 78878
132 26393
8 78837
4 78727
13 237587
3371 733
358 224...

result:

ok 1000000 lines

Test #10:

score: 0
Accepted
time: 263ms
memory: 158820kb

input:

1000000
0111111010111111111111011001111111111101010111110011111011111111111011111111110101111101111111010001111101111111011111111111111111111011001011111011011111111111110101110110111110111100111111011011101111111101111111101111011110110111101111011011110101110010000100110110111111111101111111101111...

output:

2 749371
6 187938
2 561431
20 46844
4 141093
13 141010
2 420417
79 11857
31 34986
21 35089
21 106002
102 35252
25 105755
32 105334
2 315077
206 2993
341 8863
203 8839
133 26144
272 8652
37 26436
91 26796
40 79201
493 8930
214 26318
77 26330
42 79420
207 26170
42 79154
44 79055
2 236017
1164 762
717 ...

result:

ok 1000000 lines

Test #11:

score: 0
Accepted
time: 308ms
memory: 150552kb

input:

1000000
1111110111111010110010101100011010111110010101111101111100000110101111111101111011100010011010101110111100110111100100011101111111111100100001010000101111111101101111100011110110011011101011011111010111111001101011110111101111001111110100111101101010111101111100011111101001110011111100110111...

output:

1 666195
5 222341
1 443852
13 74166
8 148174
6 148105
1 295743
9 24732
18 49433
4 49600
8 98571
22 49568
5 98534
3 98437
5 197297
88 8250
9 16481
59 16487
33 32946
73 16434
3 33163
79 32977
6 65589
18 16488
29 33079
14 33185
3 65343
21 32892
3 65540
1 65788
15 131502
192 2811
20 5438
281 5391
32 110...

result:

ok 1000000 lines

Test #12:

score: 0
Accepted
time: 373ms
memory: 135880kb

input:

1000000
0001110001000011100010011010000011100101101101101000000110110111011000111100110011101110100011011010100011100011010101001110000111010100001000000010111100010101000001101111111111100100001000000011111110111111101010000100111010000000000111001101010110010011010111100001011101001100111000110101...

output:

4 499935
5 250197
12 249736
4 125030
17 125167
23 124759
48 124973
4 62402
9 62627
14 62817
15 62347
29 62192
16 62563
31 62360
104 62611
5 31241
21 31158
120 31499
23 31125
27 31331
18 31485
18 31175
88 31169
31 30826
143 31361
21 31370
101 31187
36 31107
17 31248
71 31180
81 31422
9 15723
22 15516...

result:

ok 1000000 lines

Test #13:

score: 0
Accepted
time: 316ms
memory: 151116kb

input:

1000000
1010101110000001110110111111100111100111110110011110101011011101011101011111011001011000111101110111100111001111011100110111001110111001111010001110110111011111100001001011111000011100100001001011011110111111100110010101101101010100111010000101111100101111001110111001101000111111001111110110...

output:

1 666289
2 222169
4 444118
4 73988
10 148179
9 147923
8 296191
2 24935
8 49053
26 49473
17 98704
9 49089
17 98831
10 98748
4 197435
112 8320
36 16614
30 16292
42 32758
75 16635
13 32836
73 32866
5 65835
85 16512
31 32572
8 32982
11 65845
25 32625
11 66115
9 65951
6 131481
174 2819
56 5499
350 5626
1...

result:

ok 1000000 lines

Test #14:

score: 0
Accepted
time: 322ms
memory: 151624kb

input:

1000000
1001111111111101111011011110110111111111101101100001110011101001111011001111111001111110100111001111110001101110111111011111110000011011010101111110101011011001011110101111111101101101100110110110110100110111101011111111111001101110110101111111110101111111110001111111010111010010111111111101...

output:

1 667204
13 222002
3 445201
42 73822
14 148179
13 148031
3 297166
85 24497
32 49325
38 49156
13 99022
28 49295
11 98733
17 98905
3 198254
77 8348
204 16147
103 16527
25 32795
37 16337
72 32818
14 32865
17 66152
210 16281
18 33009
53 32728
32 65999
22 33092
25 65806
26 66182
3 132069
206 2753
411 559...

result:

ok 1000000 lines

Test #15:

score: 0
Accepted
time: 366ms
memory: 149112kb

input:

1000000
0010101010011000000101000001010000000011001010100100101000001010000001001100010110011001111011001100000011001000011000100011001000011100011000000000110101100001011010100101000001100000000000110100010010000000010101000001011110010101101010110010001000001001001010000100000100100100000110100111...

output:

3 333954
4 222169
9 111784
6 148128
12 74037
28 74370
74 37413
4 98576
29 49550
13 49389
52 24646
47 49673
112 24694
95 24826
177 12585
29 65565
23 33010
41 32950
42 16595
25 32877
93 16507
151 16532
248 8109
35 33017
38 16651
106 16526
478 8164
205 16618
191 8204
443 8374
642 4208
21 43930
69 21631...

result:

ok 1000000 lines

Test #16:

score: 0
Accepted
time: 384ms
memory: 149520kb

input:

1000000
0001001110100100100001001001000100010000110000000100000000000101000000000010111000001010111000110101000100110111010000100000100000011010011000010001010010101101011000000001110111001000010010001001001000010001000010001100010100010000110110101001001010100011000000010100100010000000100000000000...

output:

4 333034
8 222243
6 110790
6 148114
54 74128
33 74184
63 36604
9 98727
10 49383
60 49532
79 24593
61 49564
62 24617
131 24460
249 12141
6 65826
7 32900
50 32838
52 16543
72 32993
87 16535
89 16562
459 8028
72 33073
92 16487
146 16485
270 8125
504 16395
398 8060
546 8148
723 3990
10 44001
47 21823
61...

result:

ok 1000000 lines

Test #17:

score: 0
Accepted
time: 374ms
memory: 149624kb

input:

1000000
0000000000000010100100001111000100000010111100010110111100000001001010100100001110000010010010000010001000000100100111000101000100000001000010100111101010000000111010011010000110010001000010000001000011110001100010011111000011100010101010100001100110110001011000010001000010000001101100000010...

output:

15 333427
16 222077
22 111349
17 147864
31 74212
19 74011
28 37335
21 98651
43 49209
44 49302
27 24908
30 49365
111 24643
42 24794
156 12536
29 65655
28 32994
36 32900
57 16307
61 32821
157 16479
170 16526
256 8380
134 32954
106 16406
80 16373
181 8268
129 16528
86 8262
244 8331
303 4201
37 43968
51...

result:

ok 1000000 lines

Test #18:

score: 0
Accepted
time: 374ms
memory: 149552kb

input:

1000000
0001100110000010011011001001101101011000101101000010110000000000000001001100100000000110010110001001001000000000010101100101001000100111000100010010000000010000110001001011101010000001001000000101000110000010011000000000000101100100000010100001000000110101100000111010000010010000001001010000...

output:

4 332903
4 222115
5 110787
10 148255
11 73858
10 74035
120 36750
23 98787
11 49465
14 49269
11 24587
23 49711
13 24319
130 24553
557 12196
11 65837
50 32949
31 32839
147 16623
42 32864
56 16404
149 16446
382 8134
95 32981
38 16724
161 16173
300 8141
214 16409
168 8141
518 8197
922 3998
12 43979
79 2...

result:

ok 1000000 lines

Test #19:

score: 0
Accepted
time: 356ms
memory: 141812kb

input:

1000000
0010101111101111000111111000011000001110000001101111111001011110100010010011110011011000100011111100111110000110100111101111100100010010001001101110000011101110000001111001100111111001010111011101110101010110110111101011000011100111100110000001111111111000111111011111000111111001100010010101...

output:

3 560179
4 234053
4 326124
11 109938
6 124115
6 137301
4 188818
8 50553
34 59384
38 50337
7 73777
5 65008
17 72291
8 85906
13 102903
4 23790
31 26760
12 25095
13 34289
18 23286
110 27051
8 27289
12 46486
20 29165
8 35839
16 28593
19 43695
12 41970
44 43929
13 49905
57 52988
33 11374
85 12414
14 1118...

result:

ok 1000000 lines

Test #20:

score: 0
Accepted
time: 355ms
memory: 141864kb

input:

1000000
1011101001111111001000100000001110111100110100000001111011100010101101011100110111101111111011100110110011010110111110100000111110110101110010110111111000110000110101111111010111001111110110000111101011110000101000001010001110001110110111001000110001111000110101101011100111110111100101001101...

output:

1 559653
4 234504
2 325148
2 109948
25 124554
7 136955
2 188188
5 50619
17 59327
3 50833
26 73721
25 64643
12 72310
9 85470
35 102710
2 23853
97 26763
84 25130
24 34197
58 23568
11 27264
10 27310
22 46407
41 29288
12 35353
26 28947
19 43356
14 41749
23 43716
20 49801
27 52902
82 11416
27 12435
258 1...

result:

ok 1000000 lines

Test #21:

score: 0
Accepted
time: 338ms
memory: 141620kb

input:

1000000
1111100110101111000000001111100011110101110110001010101010100110111111010101001111101100110110001100111101100110001010111010011011111101001101000101100111101111100011011010101111101010011101000000000110001010111001010010111110111001111000000100001101101011111101010111011011010010000001111100...

output:

1 559090
4 234661
1 324426
11 109983
1 124678
6 137386
11 187034
5 50883
38 59100
1 50847
13 73829
3 64650
6 72733
27 85488
24 101538
141 23884
8 26997
17 24886
17 34214
57 23557
5 27284
14 27619
43 46206
18 29333
18 35315
39 28973
12 43756
55 41636
13 43849
25 49442
56 52088
64 11393
107 12491
17 1...

result:

ok 1000000 lines

Test #22:

score: 0
Accepted
time: 389ms
memory: 141900kb

input:

1000000
0101111000111011000111001110100110001101111111111011011110101001011010100111111000110111110101011110110111010111001001011111001101110010110111100011011001010101101000111111110111011101011100011100000100000001010001011100111101000000000010001101000111000111101011010010100010001101111111001001...

output:

2 559952
6 234620
3 325330
3 109960
5 124659
4 137248
6 188078
3 50525
8 59433
6 50776
9 73882
4 64822
11 72422
9 85583
4 102491
145 23621
30 26902
12 25033
17 34399
97 23507
8 27267
30 27580
10 46298
63 29184
32 35635
7 29011
38 43405
33 41835
9 43741
5 49788
7 52693
71 11303
172 12317
69 11445
64 ...

result:

ok 1000000 lines

Test #23:

score: 0
Accepted
time: 432ms
memory: 136132kb

input:

1000000
0111111011010001011001100011111001011010001000010111100110101111010110001001010011111001000101011011000011111000100101000111000010001010100001110100011010011100100010011111100011100101110011100000010100110101100001001000100001001010111011010110101010001101111110100101101111101001100110011010...

output:

2 500109
6 250031
2 250077
7 125120
8 124909
4 124997
13 125075
9 62503
5 62615
12 62342
3 62566
19 62573
19 62420
21 62331
36 62738
10 31228
19 31273
2 31298
89 31316
11 31177
23 31163
5 31295
98 31268
20 31199
186 31369
5 31127
135 31291
18 31212
48 31114
66 31272
137 31460
43 15600
30 15627
2 156...

result:

ok 1000000 lines

Test #24:

score: 0
Accepted
time: 357ms
memory: 141232kb

input:

1000000
0111101111010111101011111101110011001110100111001011011111001111011010100111000001010100000111100110110011110101111010000001001000111000000010110111011101111100010111100110101100111110011110001100111111111000101001111101100010110111100001011011101011001111000011110001101111100100001000101010...

output:

2 559746
4 234241
2 325503
25 109951
5 124289
3 137274
2 188225
59 50719
17 59232
3 50456
8 73830
16 64889
9 72382
6 85694
2 102520
37 23898
73 26820
30 25020
13 34210
19 23402
39 27049
4 27461
60 46367
48 29294
14 35593
30 28616
8 43760
9 41985
5 43704
11 49750
30 52763
8 11417
22 12481
64 11367
48...

result:

ok 1000000 lines

Test #25:

score: 0
Accepted
time: 387ms
memory: 140428kb

input:

999990
11011100000101101011000100110111100100100010110010010100001100110101111010101101101101110101010011110001001100111011011111101011101101101010010011110011011011101111011100101110000010111110001010111101001111110000110000001001110111101011100111001100111010110110111000110110100011101110011111010...

output:

1 530195
1 248196
1 281997
1 116204
4 131991
8 132079
16 149914
6 54627
6 61576
4 61721
14 70268
26 62034
26 70041
28 70364
52 79546
10 25930
7 28697
80 28843
45 32726
9 28844
13 32872
13 32900
14 37365
85 29162
58 32869
12 32772
23 37264
62 33188
27 37171
52 37416
59 42125
4 12634
51 13295
48 13376...

result:

ok 999990 lines

Test #26:

score: 0
Accepted
time: 400ms
memory: 140704kb

input:

999990
11110111111010000101101010100101111100011011010111011101111111001011110000010001011001110011100011001000100011001110100111011101010000111011011001110100001010110011001011110001100110011001011011011011001000000110001100110100101101001100100100001011000111000101000001011100101110000010100011111...

output:

1 530195
3 248057
1 282136
8 116351
10 131704
5 132287
1 149843
19 54749
1 61602
2 61393
5 70309
28 62179
7 70107
5 70277
15 79560
21 25929
22 28819
2 28855
15 32746
46 28817
52 32573
8 33008
4 37297
13 29370
3 32808
48 32677
27 37423
2 33076
26 37193
50 37408
165 42147
79 12628
21 13299
7 13411
36 ...

result:

ok 999990 lines

Test #27:

score: 0
Accepted
time: 390ms
memory: 140696kb

input:

999990
11010110000001001101000101110101111111110011110100100100110110011011011101111110001111111101011000010111100110000011110100011100010010010111100010111001100000100111011111111010110111011111001111001010001001110110101100101011000111101110100010111111011010001111010100101101010110111010100101010...

output:

1 530195
1 248079
3 282114
1 116130
10 131947
16 131974
18 150137
9 54699
6 61430
21 61763
8 70180
10 61996
11 69977
8 70481
29 79648
46 26072
30 28626
71 28728
9 32698
54 28853
31 32909
15 32757
17 37420
29 29258
10 32734
73 32839
15 37132
14 33231
16 37246
10 37487
47 42152
34 12661
12 13410
7 133...

result:

ok 999990 lines

Test #28:

score: 0
Accepted
time: 363ms
memory: 140604kb

input:

999996
11111111011111010000000100110000001010000011101100010111111100011010101011010100101010111111100110010000001110000011100001010010010000010100000001010001000001100111100010110011111100101000011011110100010110000111011101100011101010101100000000011100000111111001111111000001011011111001111000110...

output:

1 481204
7 220067
1 261136
11 123311
27 96753
8 108857
1 152275
4 78304
3 45007
40 47431
20 49321
1 59817
31 49039
25 58326
21 93940
2 51160
10 27143
19 22230
29 22775
53 26224
15 21203
90 22437
16 26881
29 37309
17 22502
96 23892
91 25145
26 31984
96 26338
63 33765
66 60169
1 24143
3 27017
37 15775...

result:

ok 999996 lines

Test #29:

score: 0
Accepted
time: 365ms
memory: 140416kb

input:

999992
11111111111111101101101111111111000000001110110111011000001110011000000101101001111101000010000010000110110111001001010011001101111011100001001101111111101111111111101001011111111011000101001100001100010010010100011101001000000011101111100100111111110100000101010011111111111110111111101000101...

output:

1 475807
14 221399
1 254407
27 125777
13 95620
12 107222
1 147181
17 80036
40 45741
50 47284
22 48334
15 59153
13 48065
11 56937
1 90236
12 51155
128 28880
56 23611
59 22128
30 26409
9 20877
39 22253
19 26077
9 37569
142 21579
29 23551
31 24509
6 31236
3 25697
41 32562
37 57659
7 24025
7 27127
62 17...

result:

ok 999992 lines

Test #30:

score: 0
Accepted
time: 364ms
memory: 139552kb

input:

999987
11010010101011001011001011010000111000100000011011000101011011100111001000010101000001110110110010011101111111011000001100010010110001110101111011110111111111001100000101111001110110110100010100100111010100010000111111010101001001010100110100110111101011111100110111100111101101001001110011110...

output:

1 526900
1 244092
10 282807
1 113677
1 130413
8 130855
19 151951
2 58404
2 55271
4 58852
18 71557
29 61322
25 69528
25 70535
59 81414
3 29946
12 28457
13 25338
37 29931
18 26303
62 32546
23 32934
27 38619
23 31699
63 29621
84 31178
48 38343
22 33469
42 37061
45 37880
40 43524
5 14212
10 15731
14 148...

result:

ok 999987 lines

Test #31:

score: 0
Accepted
time: 347ms
memory: 136176kb

input:

1000000
0011001100101011011000000111011111101000010100000000110101000011101111101110001100001100010000011110100110100110100000110001110011010011011000101110110100111100111000011110100001100100010111000101110000000011111111111010011110100110101011000111011100010000111000000111010011000000110001100110...

output:

3 500064
3 250068
4 249995
14 124997
6 125068
7 124985
12 125008
7 62500
80 62497
14 62513
40 62551
12 62476
10 62506
32 62251
30 62751
11 31199
25 31299
120 31382
48 31114
18 31296
157 31212
67 31513
69 31036
15 31371
51 31101
33 31294
139 31205
62 31129
70 31115
61 31247
93 31500
9 15575
9 15623
9...

result:

ok 1000000 lines

Test #32:

score: 0
Accepted
time: 388ms
memory: 136088kb

input:

1000000
0001100000111000011100100100100010011001011110101011000101001000010000001110111100011001110010110010100111111110101001001110000101101000010000001111111110011011000101010110100011010101101000000110000101100110100111001101011011100100101110101111000000001000000001101101111000010110111110001111...

output:

4 498857
4 250213
8 248642
8 125156
32 125056
11 124622
29 124015
18 62935
12 62219
22 62799
46 62254
17 62358
73 62261
41 62116
63 61894
28 31492
10 31442
20 31261
25 30956
38 31461
90 31335
32 31178
139 31074
13 31280
68 31073
28 31267
62 30993
22 31103
121 31010
53 30985
157 30901
13 15641
23 158...

result:

ok 1000000 lines

Test #33:

score: 0
Accepted
time: 371ms
memory: 135892kb

input:

1000000
0011000010001011111001000000101001101001111101001001010010100111010101100000001100100010001000110111110010111101101100101000110010101010100011010000110100011000000000010000010100000110101010111101001011010101010110010101001000001101010001100101111101100100100001101000000100011101110010000111...

output:

3 500364
3 249793
12 250569
6 124745
7 125047
7 125124
26 125442
8 62511
13 62232
11 62542
39 62504
46 62169
14 62952
29 62520
53 62919
11 31316
33 31195
11 30929
236 31298
14 31411
60 31126
41 31222
36 31280
46 31222
36 30944
30 31556
148 31392
145 31010
93 31507
341 31275
368 31638
14 15560
39 157...

result:

ok 1000000 lines

Test #34:

score: 0
Accepted
time: 357ms
memory: 140556kb

input:

999990
10000001111100100100000011111000111000000111110001010000001111100001100000011111000001000000111101111110000001111011110100000011110111011000000111101110010000001111011011100000011110110101000000111101100110000001111011000100000011110101111000000111101011010000001111010101100000011110101001000...

output:

1 530195
11 249019
7 281173
10 116693
8 132326
17 132562
14 148606
7 54687
130 62004
29 62129
71 70195
13 62373
79 70187
19 70296
26 78303
12 25762
164 28923
228 28984
147 33019
68 29111
125 33018
79 33079
103 37110
12 29355
273 33013
94 33079
69 37102
31 33191
70 37098
44 37142
246 41150
22 12335
1...

result:

ok 999990 lines

Test #35:

score: 0
Accepted
time: 318ms
memory: 141164kb

input:

999990
11011100101110111100010011010101111001101111011111000010001100101001110100101011011010111110001100111010110111110011101111101111110000010000110001010001110010010010110011010011110100010100110101010101110110010110110111010111111000011000111001011001111010011010111011011011111100011100111101011...

output:

1 530195
1 249020
1 281174
1 116695
1 132324
1 132562
1 148609
1 54689
1 62004
1 62128
1 70194
1 62374
1 70185
1 70299
1 78305
1 25764
1 28924
1 28985
1 33017
1 29108
1 33017
1 33078
1 37112
1 29358
1 33013
1 33073
1 37107
1 33196
1 37098
1 37149
1 41149
1 12341
1 13422
1 13453
1 15469
1 13515
1 154...

result:

ok 999990 lines

Test #36:

score: 0
Accepted
time: 200ms
memory: 217812kb

input:

1000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
-1 0
...

result:

ok 1000000 lines