Codeforces Round 1020 (Div. 3)

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
2106 Codeforces Round 1020 (Div. 3) FINISHED False 8100 30900323 April 24, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4402 ) F Goblin PROGRAMMING dp dsu greedy math

Dr. TC has a new patient called Goblin. He wants to test Goblin's intelligence, but he has gotten bored of his standard test. So, he decided to make it a bit harder. First, he creates a binary string(^{\text{∗}}) (s) having (n) characters. Then, he creates (n) binary strings (a_1, a_2, \ldots, a_n). It is known that (a_i) is created by first copying (s), then flipping the (i)-th character ((1) becomes (0) and vice versa). After creating all (n) strings, he arranges them into an (n \times n) grid (g) where (g_{i, j} = a_{i_j}). A set (S) of size (k) containing distinct integer pairs (\{(x_1, y_1), (x_2, y_2), \ldots, (x_k, y_k)\}) is considered good if: (1 \leq x_i, y_i \leq n) for all (1 \leq i \leq k). (g_{x_i, y_i} = 0) for all (1 \leq i \leq k). For any two integers (i) and (j) ((1 \leq i, j \leq k)), coordinate ((x_i, y_i)) is reachable from coordinate ((x_j, y_j)) by traveling through a sequence of adjacent cells (which share a side) that all have a value of (0). Goblin's task is to find the maximum possible size of a good set (S). Because Dr. TC is generous, this time he gave him two seconds to find the answer instead of one. Goblin is not known for his honesty, so he has asked you to help him cheat. (^{\text{∗}})A binary string is a string that only consists of characters (1) and (0). The first line of the input consists of a single integer (t) ((1 \le t \le 10^3)) — the number of test cases. The first line of each test contains a single integer (n) ((1 \le n \le 2 \cdot 10^5)) — the length of the binary string (s). The second line of each test contains a single binary string (s) of length (n). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single number, the maximum po

Tutorials

Codeforces Round 1020 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317084824 _Equinox F April 24, 2025, 5:33 p.m. OK C# 10 TESTS 16 218 4812800
317081043 _Equinox F April 24, 2025, 5:06 p.m. OK C# 10 TESTS 16 218 4812800
317129133 abaksjkdas F April 25, 2025, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317121047 OUYU_NOW F April 25, 2025, 2:20 a.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317120037 goulthen F April 25, 2025, 1:56 a.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317109688 Phantom_Dreams F April 24, 2025, 10:05 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317103752 sumit10 F April 24, 2025, 8:37 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317082243 fayoor F April 24, 2025, 5:14 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317077165 xiaozhao2002 F April 24, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 16 46 0
317133062 zerocxq F April 25, 2025, 5:43 a.m. OK C++17 (GCC 7-32) TESTS 16 46 102400
317129339 005-Baurzhan-Sh-2028 F April 25, 2025, 4:54 a.m. OK C++17 (GCC 7-32) TESTS 16 46 102400
317127917 MrLuoTrue F April 25, 2025, 4:32 a.m. OK C++17 (GCC 7-32) TESTS 16 46 102400

remove filters

Back to search problems