Skip to main content

Posts

Showing posts from November, 2022

Problem B,Maximum Substring,CodeTON Round 3 (Div. 1 + Div. 2, Rated, Prizes!)

B: Maximum Substring  A binary string is a string consisting only of the characters   0   and   1 . You are given a binary string  s. For some non-empty substring † †   t t  of string  s s  containing  x x  characters  0  and  y y  characters  1 , define its  cost  as: x ⋅ y x ⋅ y , if  x > 0 x > 0  and  y > 0 y > 0 ; x 2 x 2 , if  x > 0 x > 0  and  y = 0 y = 0 ; y 2 y 2 , if  x = 0 x = 0  and  y > 0 y > 0 . Given a binary string  s s  of length  n n , find the maximum cost across all its non-empty substrings. † †  A string  a  is a substring of a string  b  if  a a  can be obtained from  b  by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end. Input Each test consists of multiple test cas...