Codeforces Global Round 31 (Div. 1 + 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
2180 Codeforces Global Round 31 (Div. 1 + Div. 2) FINISHED False 9000 10250722 Dec. 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1725 ) E No Effect XOR PROGRAMMING bitmasks math

In the jungle, there is a lake with infinite lily pads on it. The lily pads are numbered with non-negative integers (0, 1, 2, 3, \ldots). The lily pads with numbers between (l) and (r) inclusive are called suitable , while all other lily pads are not suitable for the frogs to sit on. Currently, a single frog is sitting on each suitable lily pad. Ostad is watching the lake and wants to reorder the frogs. To do so, Ostad can pick a positive integer (x) and announce it to the frogs. After hearing the number, the frog sitting on the (i)-th lily pad will jump to the ((i \oplus x))-th one, where (\oplus) denotes the bitwise XOR operation . Ostad likes the frogs, and therefore he wants to pick the number (x) in such a way that all frogs stay within the range of suitable lily pads. Help Ostad by counting how many different numbers (x) Ostad can choose such that no frog jumps outside the suitable segment of the lily pads. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^5)). The description of the test cases follows. For each test case, there is a single line containing two integers (l) and (r) ((1 \leq l \leq r \leq 10^{15})). For each test case, output a single integer denoting the number of valid values for (x). In the first test case, (x = 3) is the only number that Ostad can choose, as (1 \oplus 3 = 2) and (2 \oplus 3 = 1), which are within the range (1, 2). There are no valid choices for Ostad in the second and third test cases. For the second case, since we require (x > 0), the only frog that we have will leave the range. Similarly, in the third case, no valid (x) exists to keep the frogs within the desired range. In the fourth test case, Ostad can choose (1), (2), or (3). Link to the visualizer

Tutorials

Codeforces Global Round 31

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
354253667 prologue1017 E Dec. 20, 2025, 3:16 a.m. OK C++17 (GCC 7-32) TESTS 19 109 0
354229958 -Guts E Dec. 19, 2025, 6:52 p.m. OK C++17 (GCC 7-32) TESTS 19 109 0
354230356 luoxueac E Dec. 19, 2025, 6:56 p.m. OK C++17 (GCC 7-32) TESTS 19 109 102400
354237262 alan-c E Dec. 19, 2025, 8:22 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354227368 ConwayTitty E Dec. 19, 2025, 6:27 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354217234 npl1210 E Dec. 19, 2025, 5:04 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354214170 Potassium E Dec. 19, 2025, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354214032 ByakJougan E Dec. 19, 2025, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354213919 devecent E Dec. 19, 2025, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354212253 santhoshsan23 E Dec. 19, 2025, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 19 109 4198400
354217841 _andyli E Dec. 19, 2025, 5:04 p.m. OK C++20 (GCC 13-64) TESTS 19 46 6144000
354245216 cipher404 E Dec. 19, 2025, 11:18 p.m. OK C++20 (GCC 13-64) TESTS 19 78 0
354261297 mg_05 E Dec. 20, 2025, 5:10 a.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
354256803 GrandTiger1729 E Dec. 20, 2025, 4:10 a.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
354256258 lightcreeper E Dec. 20, 2025, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
354236773 Youssef_Elwazzan E Dec. 19, 2025, 8:15 p.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
354221959 yami_sukehiro1 E Dec. 19, 2025, 5:46 p.m. OK C++20 (GCC 13-64) TESTS 19 78 102400
354245244 cipher404 E Dec. 19, 2025, 11:19 p.m. OK C++20 (GCC 13-64) TESTS 19 78 3993600
354218089 MohamedRady E Dec. 19, 2025, 5:04 p.m. OK C++20 (GCC 13-64) TESTS 19 78 3993600
354217699 kumar_shubham15 E Dec. 19, 2025, 5:04 p.m. OK C++20 (GCC 13-64) TESTS 19 78 3993600

remove filters

Back to search problems