D. 切割字符串

    Type: Default File IO: str 1000ms 256MiB

切割字符串

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

小明出题出累了,去搬了一道题。

给你一个01串,长度是NN

你需要从中切出kk个区间[Li,Ri][L_i,R_i]满足:

(1)Ri<Li+1R_i<L_{i+1},对所有1i<k1\leq i<k成立。

(2)S[Li,Ri]<S[Li+1,Ri+1]S_{[L_i,R_i]}<S_{[L_{i+1},R_{i+1}]}对所有1i<k1\leq i<k成立。

问,最大的kk是多少?

输入格式

第一行输入NN

第二行输入一个长度为NN0101串。

输出格式

输出一个数字表示答案。

7
0101010
3
30
000011001110101001011110001001
9

data3.in
data3.out data4.in
data4.out
data5.in
data5.out

数据范围

对于10%的数据:N20N\leq 20

对于40%的数据:N100N\leq 100

对于60%的数据:N1500N\leq 1500

对于100%的数据:N2.5×104N\leq 2.5\times 10^4

0127测试

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2026-1-27 8:30
End at
2026-1-27 11:42
Duration
3.2 hour(s)
Host
Partic.
36