Codeforces Round 997 (Div. 2)

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
2056 Codeforces Round 997 (Div. 2) FINISHED False 7200 39281123 Jan. 17, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 344 ) F2 Xor of Median (Hard Version) PROGRAMMING bitmasks combinatorics

This is the hard version of the problem. The difference between the versions is that in this version, the constraints on (t), (k), and (m) are higher. You can hack only if you solved all versions of this problem. A sequence (a) of (n) integers is called good if the following condition holds: Let (\text{cnt}_x) be the number of occurrences of (x) in sequence (a). For all pairs (0 \le i < j < m), at least one of the following has to be true: (\text{cnt}_i = 0), (\text{cnt}_j = 0), or (\text{cnt}_i \le \text{cnt}_j). In other words, if both (i) and (j) are present in sequence (a), then the number of occurrences of (i) in (a) is less than or equal to the number of occurrences of (j) in (a). You are given integers (n) and (m). Calculate the value of the bitwise XOR of the median(^{\text{∗}}) of all good sequences (a) of length (n) with (0\le a_i < m). Note that the value of (n) can be very large, so you are given its binary representation instead. (^{\text{∗}})The median of a sequence (a) of length (n) is defined as the (\left\lfloor\frac{n + 1}{2}\right\rfloor)-th smallest value in the sequence. 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 two integers (k) and (m) ((1 \le k \le 2 \cdot 10^5), (1 \le m \le 10^9)) — the number of bits in (n) and the upper bound on the elements in sequence (a). The second line of each test case contains a binary string of length (k) — the binary representation of (n) with no leading zeros. It is guaranteed that the sum of (k) over all test cases does not exceed (2\cdot 10^5). For each test case, output a single integer representing the bitwise XOR of the median of all good sequences (a) of length (n) wher

Tutorials

Codeforces Round #997 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
301502900 Isuki F2 Jan. 18, 2025, 3:19 a.m. OK C++17 (GCC 7-32) TESTS 34 46 1331200
301467152 potato167 F2 Jan. 17, 2025, 5:13 p.m. OK C++17 (GCC 7-32) TESTS 34 109 0
301509040 saaaalty F2 Jan. 18, 2025, 4:44 a.m. OK C++17 (GCC 7-32) TESTS 34 125 0
301476717 4977 F2 Jan. 17, 2025, 6:29 p.m. OK C++20 (GCC 13-64) TESTS 34 62 102400
301466245 ahsoltan F2 Jan. 17, 2025, 5:08 p.m. OK C++20 (GCC 13-64) TESTS 34 62 102400
301460877 StarSilk F2 Jan. 17, 2025, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 34 62 102400
301492528 Markadiusz F2 Jan. 17, 2025, 10:47 p.m. OK C++20 (GCC 13-64) TESTS 34 77 102400
301457822 kotatsugame F2 Jan. 17, 2025, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 34 77 102400
301467275 noya2 F2 Jan. 17, 2025, 5:14 p.m. OK C++20 (GCC 13-64) TESTS 34 108 102400
301467296 Fysty F2 Jan. 17, 2025, 5:14 p.m. OK C++20 (GCC 13-64) TESTS 34 109 102400
301469099 hitonanode F2 Jan. 17, 2025, 5:26 p.m. OK C++20 (GCC 13-64) TESTS 34 140 102400
301477702 dialnote F2 Jan. 17, 2025, 6:39 p.m. OK C++20 (GCC 13-64) TESTS 34 155 102400
301469824 Dominater069 F2 Jan. 17, 2025, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 34 187 102400
301506492 Normalizerr F2 Jan. 18, 2025, 4:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 102400
301479145 AgafonovArtem F2 Jan. 17, 2025, 6:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 102400
301476251 AmirAli-Asgari F2 Jan. 17, 2025, 6:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 102400
301472429 _DRVGON_ F2 Jan. 17, 2025, 5:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 102400
301494241 cmk666 F2 Jan. 17, 2025, 11:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 512000
301495411 xuyifei1 F2 Jan. 18, 2025, 12:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 1638400
301504984 Tagaki_san F2 Jan. 18, 2025, 3:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 34 62 2355200
301477662 415411 F2 Jan. 17, 2025, 6:39 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 77 102400
301462597 peti1234 F2 Jan. 17, 2025, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 77 2560000
301477601 415411 F2 Jan. 17, 2025, 6:38 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 93 102400
301454776 arvindf232 F2 Jan. 17, 2025, 4:16 p.m. OK Kotlin 1.9 TESTS 34 1781 307200

remove filters

Back to search problems