Codeforces Global Round 16

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
1566 Codeforces Global Round 16 FINISHED False 9000 144948323 Sept. 12, 2021, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 18999 ) C MAX-MEX Cut PROGRAMMING bitmasks constructive algorithms dp greedy

A binary string is a string that consists of characters 0 and 1 . A bi-table is a table that has exactly two rows of equal length, each being a binary string. Let operatorname{MEX} of a bi-table be the smallest digit among 0 , 1 , or 2 that does not occur in the bi-table. For example, operatorname{MEX} for begin{bmatrix} 0011 1010 end{bmatrix} is 2 , because 0 and 1 occur in the bi-table at least once. operatorname{MEX} for begin{bmatrix} 111 111 end{bmatrix} is 0 , because 0 and 2 do not occur in the bi-table, and 0 < 2 . You are given a bi-table with n columns. You should cut it into any number of bi-tables (each consisting of consecutive columns) so that each column is in exactly one bi-table. It is possible to cut the bi-table into a single bi-table -- the whole bi-table. What is the maximal sum of operatorname{MEX} of all resulting bi-tables can be? The input consists of multiple test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Description of the test cases follows. The first line of the description of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the number of columns in the bi-table. Each of the next two lines contains a binary string of length n -- the rows of the bi-table. It's guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case print a single integer -- the maximal sum of operatorname{MEX} of all bi-tables that it is possible to get by cutting the given bi-table optimally. In the first test case you can cut the bi-table as follows: The sum of operatorname{MEX} is 8 .

Tutorials

Codeforces Global Round 16 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
128685901 gxlois C Sept. 13, 2021, 1:52 a.m. OK D TESTS 16 46 8908800
128658518 cyrus_msk C Sept. 12, 2021, 4:50 p.m. OK D TESTS 16 46 10956800
128683867 hiatran18 C Sept. 13, 2021, 12:44 a.m. OK FPC TESTS 16 77 4915200
128661185 PAG C Sept. 12, 2021, 5 p.m. OK FPC TESTS 16 93 6553600
128655276 JlKmn C Sept. 12, 2021, 4:36 p.m. OK .NET Core C# TESTS 16 109 15257600
128650790 Aeros_CodeForces C Sept. 12, 2021, 4:20 p.m. OK .NET Core C# TESTS 16 140 12595200
128650977 reosfire C Sept. 12, 2021, 4:21 p.m. OK .NET Core C# TESTS 16 140 12595200
128653524 TomTales C Sept. 12, 2021, 4:30 p.m. OK .NET Core C# TESTS 16 156 13516800

remove filters

Back to search problems