Codeforces Round 1035 (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
2119 Codeforces Round 1035 (Div. 2) FINISHED False 7200 24679522 July 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 16154 ) C A Good Problem PROGRAMMING bitmasks constructive algorithms math

You are given four positive integers (n, l, r, k). You need to find the lexicographically smallest(^{\text{∗}}) array (a) of length (n), consisting of integers, such that: For every (1 \leq i \leq n), (l \leq a_i \leq r). (a_1 \, \& \, a_2 \, \& \, \ldots \, \& \, a_n = a_1 \oplus a_2 \oplus \ldots \oplus a_n), where (\&) denotes the bitwise AND operation and (\oplus) denotes the bitwise XOR operation . If no such array exists, output (-1). Otherwise, since the entire array might be too large to output, output (a_k) only. (^{\text{∗}})An array (a) is lexicographically smaller than an array (b) if and only if one of the following holds: (a) is a prefix of (b), but (a \ne b); or in the first position where (a) and (b) differ, the array (a) has a smaller element than the corresponding element in (b). 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. Each test case contains four positive integers (n,l,r,k) ((1 \le k \le n \le 10^{18}), (1 \le l \le r \le 10^{18})). For each test case, output (a_k) or (-1) if no array meets the conditions. In the first test case, the array (a = 4). It can be proven that there is no array that meets the above requirements and has a smaller lexicographic order. In the second test case, the array (a= 1,1,1). It can be proven that there is no array that meets the above requirements and has a smaller lexicographic order. In the third test case and the fourth test case, the array (a = 6,6,8,8). It can be proven that there is no array that meets the above requirements and has a smaller lexicographic order. In the fifth test case and the sixth test case, it can be proven that there is no array that meets the above requirements.

Tutorials

Codeforces Round 1035 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
327634850 Melamori C July 5, 2025, 6:23 p.m. OK C# 13 TESTS 15 124 3891200
327674859 pookie_coder C July 6, 2025, 6 a.m. OK C++17 (GCC 7-32) TESTS 15 46 0
327669672 codeforcessss C July 6, 2025, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 15 46 0
327662822 whirl_wind C July 6, 2025, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 15 46 0
327657261 Fly_wind C July 6, 2025, 12:57 a.m. OK C++17 (GCC 7-32) TESTS 15 46 0
327675186 ronakumar786 C July 6, 2025, 6:04 a.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327671282 S4532 C July 6, 2025, 5:15 a.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327670983 ayushranjan1208 C July 6, 2025, 5:11 a.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327662477 1ANH6 C July 6, 2025, 2:52 a.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327657513 egg325 C July 6, 2025, 1:04 a.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327634180 freakdeep C July 5, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 15 61 0
327674943 Hori C July 6, 2025, 6:01 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327672558 TheLastHutu C July 6, 2025, 5:33 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327669125 jay_jani_0011 C July 6, 2025, 4:43 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327667643 yzqz C July 6, 2025, 4:19 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327666940 LuOH3_ C July 6, 2025, 4:06 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327666018 yashgarg887 C July 6, 2025, 3:51 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327664489 dynamo0919 C July 6, 2025, 3:25 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327663303 Lenisel C July 6, 2025, 3:05 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327663294 XiaoXiiiiiiiiiiiiii C July 6, 2025, 3:05 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327663035 saksham_sharma5959 C July 6, 2025, 3:01 a.m. OK C++20 (GCC 13-64) TESTS 15 46 0
327671358 quziy C July 6, 2025, 5:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327671215 theflyingdutchman1 C July 6, 2025, 5:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327670348 HZH0821 C July 6, 2025, 5:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327659263 jackylova_fan_fan_fan C July 6, 2025, 1:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327657465 keye C July 6, 2025, 1:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327657308 noob_me_cant_code C July 6, 2025, 12:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327656690 Aletz C July 6, 2025, 12:40 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327656319 Aarav_J C July 6, 2025, 12:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327644380 sahil_beck C July 5, 2025, 7:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327637415 graidy_011888 C July 5, 2025, 6:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 15 46 0
327646411 NenadDapic C July 5, 2025, 8:24 p.m. OK FPC TESTS 15 77 0
327663600 IseriNina27 C July 6, 2025, 3:10 a.m. OK GNU C11 TESTS 15 46 2150400
327614027 ghostForcerr C July 5, 2025, 4:17 p.m. OK GNU C11 TESTS 15 93 102400
327658792 Reshare C July 6, 2025, 1:40 a.m. OK GNU C11 TESTS 15 108 102400
327615502 krishna_kun C July 5, 2025, 4:20 p.m. OK GNU C11 TESTS 15 108 102400
327618933 mpchoksi2586 C July 5, 2025, 4:27 p.m. OK GNU C11 TESTS 15 109 102400
327622082 bt55555 C July 5, 2025, 4:34 p.m. OK GNU C11 TESTS 15 109 204800
327614323 herit_desai C July 5, 2025, 4:18 p.m. OK GNU C11 TESTS 15 124 102400
327613811 VaishCodes C July 5, 2025, 4:17 p.m. OK GNU C11 TESTS 15 124 102400
327614440 flaviu2001 C July 5, 2025, 4:18 p.m. OK Go TESTS 15 437 1536000
327639214 fatal-98 C July 5, 2025, 7:02 p.m. OK Java 21 TESTS 15 265 716800
327618889 edum C July 5, 2025, 4:27 p.m. OK Java 21 TESTS 15 280 512000
327655962 feonex C July 6, 2025, 12:14 a.m. OK Java 21 TESTS 15 281 716800
327624389 Luckyx100 C July 5, 2025, 5:06 p.m. OK Java 21 TESTS 15 281 819200
327632479 Shreyas0803 C July 5, 2025, 6:04 p.m. OK Java 21 TESTS 15 296 716800
327620709 Saucyy C July 5, 2025, 4:31 p.m. OK Java 21 TESTS 15 296 716800
327673736 AdityaPandey208 C July 6, 2025, 5:47 a.m. OK Java 21 TESTS 15 296 819200
327641714 codes411 C July 5, 2025, 7:25 p.m. OK Java 21 TESTS 15 296 819200
327615020 NpHardcore_05 C July 5, 2025, 4:19 p.m. OK Java 21 TESTS 15 296 1126400
327672729 debyet C July 6, 2025, 5:35 a.m. OK Java 21 TESTS 15 296 1228800
327646974 Eslam_Ahmed C July 5, 2025, 8:31 p.m. OK Java 8 TESTS 15 155 0
327628970 kasiru_69 C July 5, 2025, 5:36 p.m. OK Java 8 TESTS 15 203 0
327621095 harshchhallani3 C July 5, 2025, 4:32 p.m. OK Java 8 TESTS 15 218 0
327618874 gaurimadan002 C July 5, 2025, 4:27 p.m. OK Java 8 TESTS 15 218 0
327614001 PA1_KUMAR_13 C July 5, 2025, 4:17 p.m. OK Java 8 TESTS 15 218 0
327614987 likhithkumarreddy1722 C July 5, 2025, 4:19 p.m. OK Java 8 TESTS 15 234 0
327655005 baixuejava C July 5, 2025, 11:40 p.m. OK Java 8 TESTS 15 249 0
327666509 aysuh-tibrewal C July 6, 2025, 3:59 a.m. OK Java 8 TESTS 15 265 0
327628802 test_name_please_ignore C July 5, 2025, 5:35 p.m. OK Java 8 TESTS 15 265 0
327672175 jatin310 C July 6, 2025, 5:28 a.m. OK Java 8 TESTS 15 296 0
327667761 lupunish C July 6, 2025, 4:21 a.m. OK Kotlin 1.9 TESTS 15 234 0
327614959 ultron513 C July 5, 2025, 4:19 p.m. OK PHP TESTS 15 140 204800
327640876 cp_commando C July 5, 2025, 7:17 p.m. OK PyPy 3 TESTS 15 374 9932800
327622452 Harikaran14 C July 5, 2025, 4:34 p.m. OK PyPy 3 TESTS 15 390 9932800
327664167 _PD_ C July 6, 2025, 3:19 a.m. OK PyPy 3 TESTS 15 421 10956800
327618326 Yunbvfrty C July 5, 2025, 4:26 p.m. OK PyPy 3 TESTS 15 436 10240000
327615812 _PD_ C July 5, 2025, 4:21 p.m. OK PyPy 3 TESTS 15 452 11366400
327619525 s.adithya_reddy C July 5, 2025, 4:29 p.m. OK PyPy 3 TESTS 15 453 10035200
327634173 gardengnome C July 5, 2025, 6:18 p.m. OK PyPy 3-64 TESTS 15 124 3584000
327631352 Only365 C July 5, 2025, 5:54 p.m. OK PyPy 3-64 TESTS 15 124 4710400
327627612 Fishion C July 5, 2025, 5:26 p.m. OK PyPy 3-64 TESTS 15 125 5836800
327628888 OAY71011 C July 5, 2025, 5:35 p.m. OK PyPy 3-64 TESTS 15 125 6041600
327619678 SD_or_GS C July 5, 2025, 4:29 p.m. OK PyPy 3-64 TESTS 15 140 5427200
327629048 daveshub_2 C July 5, 2025, 5:36 p.m. OK PyPy 3-64 TESTS 15 140 5529600
327664250 mikeac C July 6, 2025, 3:21 a.m. OK PyPy 3-64 TESTS 15 155 5324800
327657344 Little_Sheep_Yawn C July 6, 2025, 12:59 a.m. OK PyPy 3-64 TESTS 15 156 7065600
327629463 imsuraj675 C July 5, 2025, 5:39 p.m. OK PyPy 3-64 TESTS 15 156 9011200
327619464 kowshika C July 5, 2025, 4:29 p.m. OK PyPy 3-64 TESTS 15 171 6246400
327616012 adrian0310 C July 5, 2025, 4:22 p.m. OK Python 3 TESTS 15 92 1638400
327617063 ImJettMain C July 5, 2025, 4:24 p.m. OK Python 3 TESTS 15 93 1638400
327639534 MadhavPeddi C July 5, 2025, 7:05 p.m. OK Python 3 TESTS 15 93 1740800
327617030 redsurgence C July 5, 2025, 4:24 p.m. OK Python 3 TESTS 15 108 409600
327670503 xufour C July 6, 2025, 5:04 a.m. OK Python 3 TESTS 15 109 204800
327640431 Neyl C July 5, 2025, 7:13 p.m. OK Python 3 TESTS 15 109 307200
327629075 ChatIsThisReal C July 5, 2025, 5:36 p.m. OK Python 3 TESTS 15 109 307200
327658421 hu_huhu C July 6, 2025, 1:29 a.m. OK Python 3 TESTS 15 124 307200
327619661 Vrinda_156 C July 5, 2025, 4:29 p.m. OK Python 3 TESTS 15 124 307200
327672961 iam.vsr C July 6, 2025, 5:38 a.m. OK Python 3 TESTS 15 124 409600

remove filters

Back to search problems