Codeforces Round 1042 (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
2131 Codeforces Round 1042 (Div. 3) FINISHED False 8100 21569123 Aug. 10, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4699 ) F Unjust Binary Life PROGRAMMING binary search binary search data structures greedy greedy math two pointers

Yuri is given two binary strings (a) and (b), both of which are of length (n). The two strings dynamically define an (n \times n) grid. Let ((i, j)) denote the cell in the (i)-th row and (j)-th column. The initial value of cell ((i, j)) has the value of (a_i \oplus b_j), where (\oplus) denotes the bitwise XOR operation . . Yuri's journey always starts at cell ((1, 1)). From a cell ((i, j)), she can only move down to ((i + 1, j)) or right to ((i, j + 1)). Her journey is possible if there exists a valid path such that all cells on the path, including ((1, 1)), have a value of 0. Before her departure, she can do the following operation for any number of times: Choose one index (1 \le i \le n), and flip the value of either (a_i) or (b_i) ((0) becomes (1), and (1) becomes (0)). The grid will also change accordingly. Let (f(x, y)) denote the minimum required operations so that Yuri can make her journey to the cell ((x,y)). You must determine the sum of (f(x, y)) over all (1 \leq x, y \leq n). Note that each of these (n^2) cases is independent, meaning you need to assume the grid is in its original state in each case (i.e., no actual operations are performed). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains one integer (n) ((1 \le n \le 2 \cdot 10^5)). The second line of each test case contains a binary string (a) ((|a| = n), (a_i \in \{0, 1\})). The third line of each test case contains a binary string (b) ((|b| = n), (b_i \in \{0, 1\})). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output one integer — the sum of minimum operations over all possible cells. In the first test case, the $$$2 \times

Tutorials

Codeforces Round 1042 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
333446094 og.kostya F Aug. 10, 2025, 4:52 p.m. OK C# 10 TESTS 16 108 5734400
333450657 og.kostya F Aug. 10, 2025, 5:16 p.m. OK C# 13 TESTS 16 140 8499200
333488042 ctgg F Aug. 11, 2025, 3:47 a.m. OK C++17 (GCC 7-32) TESTS 16 61 3686400
333454089 k_Fa F Aug. 10, 2025, 5:42 p.m. OK C++17 (GCC 7-32) TESTS 16 61 6860800
333498254 AkShukla F Aug. 11, 2025, 5:57 a.m. OK C++17 (GCC 7-32) TESTS 16 62 0
333459582 TychoElling F Aug. 10, 2025, 6:33 p.m. OK C++17 (GCC 7-32) TESTS 16 62 921600
333478436 lmeodarkwa F Aug. 11, 2025, 1:27 a.m. OK C++17 (GCC 7-32) TESTS 16 62 1433600
333462933 svandich F Aug. 10, 2025, 7:14 p.m. OK C++17 (GCC 7-32) TESTS 16 62 1433600
333445451 thanhtop1 F Aug. 10, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 16 62 1433600
333492699 ylh_ F Aug. 11, 2025, 4:57 a.m. OK C++17 (GCC 7-32) TESTS 16 62 3276800
333469883 Quantum5hadow F Aug. 10, 2025, 9:09 p.m. OK C++17 (GCC 7-32) TESTS 16 62 4608000
333467593 shreekarunam F Aug. 10, 2025, 8:24 p.m. OK C++17 (GCC 7-32) TESTS 16 62 4608000
333475720 NoIdeaChair F Aug. 11, 2025, 12:23 a.m. OK C++20 (GCC 13-64) TESTS 16 46 1945600
333486467 Kidding__Ma F Aug. 11, 2025, 3:24 a.m. OK C++20 (GCC 13-64) TESTS 16 61 0
333457612 HelloFromMars F Aug. 10, 2025, 6:14 p.m. OK C++20 (GCC 13-64) TESTS 16 61 1945600
333443350 meteorift F Aug. 10, 2025, 4:47 p.m. OK C++20 (GCC 13-64) TESTS 16 61 1945600
333490688 mouseboy F Aug. 11, 2025, 4:27 a.m. OK C++20 (GCC 13-64) TESTS 16 61 5120000
333488486 yanghongyan F Aug. 11, 2025, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 16 62 0
333487136 Kidding__Ma F Aug. 11, 2025, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 16 62 0
333486776 jikong F Aug. 11, 2025, 3:28 a.m. OK C++20 (GCC 13-64) TESTS 16 62 0
333488451 cavendishlaber F Aug. 11, 2025, 3:53 a.m. OK C++20 (GCC 13-64) TESTS 16 62 307200
333453599 uttej_777 F Aug. 10, 2025, 5:38 p.m. OK C++20 (GCC 13-64) TESTS 16 62 307200
333458023 Sofapuden F Aug. 10, 2025, 6:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 46 0
333487796 yxfql F Aug. 11, 2025, 3:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 0
333480457 gaojtccc F Aug. 11, 2025, 2 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 102400
333486422 3616815138 F Aug. 11, 2025, 3:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 409600
333481244 -practicer- F Aug. 11, 2025, 2:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 409600
333482641 tornadorr F Aug. 11, 2025, 2:31 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 921600
333474751 Thawan F Aug. 10, 2025, 11:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 1638400
333459505 codevode F Aug. 10, 2025, 6:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 61 7680000
333493302 DreamChaser F Aug. 11, 2025, 5:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 62 0
333487045 nano_nanoo F Aug. 11, 2025, 3:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 16 62 0
333477219 0x3F F Aug. 11, 2025, 1:02 a.m. OK Go TESTS 16 108 9728000
333448696 joseantonio.vegaruiz F Aug. 10, 2025, 5:04 p.m. OK Java 21 TESTS 16 280 819200
333443763 CodeS4suke F Aug. 10, 2025, 4:48 p.m. OK Java 21 TESTS 16 405 17920000
333484643 man-ray F Aug. 11, 2025, 2:58 a.m. OK Java 21 TESTS 16 1124 92569600
333483356 adityadutt F Aug. 11, 2025, 2:40 a.m. OK Java 8 TESTS 16 249 4608000
333445485 g_lingesh123 F Aug. 10, 2025, 4:49 p.m. OK Java 8 TESTS 16 265 0
333447418 Anirudhg_027 F Aug. 10, 2025, 4:58 p.m. OK PyPy 3 TESTS 16 655 51302400
333484845 fatalerror F Aug. 11, 2025, 3:01 a.m. OK PyPy 3-64 TESTS 16 156 9216000
333447934 _Andrews_ F Aug. 10, 2025, 5 p.m. OK PyPy 3-64 TESTS 16 171 10240000
333467609 minuki646 F Aug. 10, 2025, 8:25 p.m. OK PyPy 3-64 TESTS 16 171 14028800
333480482 Coderhype F Aug. 11, 2025, 2 a.m. OK PyPy 3-64 TESTS 16 187 10752000
333467110 minuki646 F Aug. 10, 2025, 8:16 p.m. OK PyPy 3-64 TESTS 16 187 14233600
333475014 alexwice F Aug. 10, 2025, 11:56 p.m. OK PyPy 3-64 TESTS 16 202 19558400
333465451 vxgmichel F Aug. 10, 2025, 7:49 p.m. OK PyPy 3-64 TESTS 16 233 19148800
333463272 vlad_khmelnov F Aug. 10, 2025, 7:18 p.m. OK PyPy 3-64 TESTS 16 249 13721600
333453082 teekaytai F Aug. 10, 2025, 5:34 p.m. OK PyPy 3-64 TESTS 16 249 16486400
333464119 harurun4635 F Aug. 10, 2025, 7:29 p.m. OK PyPy 3-64 TESTS 16 265 17715200
333449329 Shiv_am__08 F Aug. 10, 2025, 5:08 p.m. OK Python 2 TESTS 16 953 50176000
333487186 skysilksock F Aug. 11, 2025, 3:34 a.m. OK Python 3 TESTS 16 281 34611200
333487702 skysilksock F Aug. 11, 2025, 3:41 a.m. OK Python 3 TESTS 16 327 45260800
333443920 masterparth2005 F Aug. 10, 2025, 4:48 p.m. OK Python 3 TESTS 16 530 80486400
333452619 igor99972 F Aug. 10, 2025, 5:30 p.m. OK Python 3 TESTS 16 546 45568000
333443770 omdeh F Aug. 10, 2025, 4:48 p.m. OK Python 3 TESTS 16 811 69017600
333444783 Devavrat_Verma F Aug. 10, 2025, 4:49 p.m. OK Python 3 TESTS 16 983 90419200
333451458 Rcrocks F Aug. 10, 2025, 5:21 p.m. OK Python 3 TESTS 16 1280 106086400

remove filters

Back to search problems