Professional Documents
Culture Documents
|
riteshnub | Logout
You have +385! Wow!
HOME TOP CATALOG CONTESTS GYM PROBLEMSET GROUPS RATING EDU API CALENDAR HELP
00:00:07
In the resulting table we need to find the rectangle consisting only of ones that has the largest Start virtual contest
area.
We call a rectangle the set of all cells (i, j) in the table, such that x 1 ≤ i ≤ x 2 and
y1 ≤ j ≤ y2 for some integers 0 ≤ x 1 ≤ x 2 < n and 0 ≤ y1 ≤ y2 < n .
→ Clone Contest to Mashup
You can clone this contest to a mashup.
Recall that the cyclic shift of string s by k to the right is the string
sn−k+1 … sn s1 s2 … sn−k . For example, the cyclic shift of the string "01011" by 0 to the Clone Contest
right is the string itself "01011", its cyclic shift by 3 to the right is the string "01101".
Input → Submit?
Each test consists of multiple test cases. The first line contains a single integer t (
4
1 ≤ t ≤ 2 ⋅ 10 ) — the number of test cases. The description of test cases follows. Language: GNU G++17 7.3.0
The first and the only line of each test case contains a single binary string s ( Choose
Choose File No file chosen
1 ≤ |s| ≤ 2 ⋅ 10
5
), consisting of characters 0 and 1. file:
5
Submit
It is guaranteed that the sum of string lengths |s| over all test cases does not exceed 2 ⋅ 10 .
Output
For each test case, output a single integer — the maximum area of a rectangle consisting only → Problem tags
of ones. If there is no such rectangle, output 0.
math strings two pointers *1100
Example No tag edit access
input Copy
5 → Contest materials
0
1 Announcement (en)
101
011110 Tutorial (en)
101010
output Copy
0
1
2
6
1
Note
In the first test case, there is a table 1 × 1 consisting of a single character 0, so there are no
rectangles consisting of ones, and the answer is 0.
https://codeforces.com/problemset/problem/1820/B 1/2
4/2/24, 9:01 AM Problem - 1820B - Codeforces
In the second test case, there is a table 1 × 1, consisting of a single character 1, so the
answer is 1.
1 0 1
1 1 0
0 1 1
0 1 1 1 1 0
0 0 1 1 1 1
1 0 0 1 1 1
1 1 0 0 1 1
1 1 1 0 0 1
1 1 1 1 0 0
1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1
1 0 1 0 1 0
0 1 0 1 0 1
Supported by
https://codeforces.com/problemset/problem/1820/B 2/2