map + 前缀和
B. Balanced Substring time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a string s consisting only of characters 0 and 1. A substring [ l , r ] of s is a string s l s l + 1 s l + 2 ... s r , and its length equals to r - l + 1. A substring is called balanced if the number of zeroes ( 0) equals to the number of ones in this substring. You have to determine the length of the longest balanced substring of s . Input The first line contains n ( 1 ≤ n ≤ 100000) — the number of characters in s . The second line contains a