Codeforces Round 1124 (Div. 1)

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
2268 Codeforces Round 1124 (Div. 1) FINISHED False 9000 746666 Sept. 26, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 932 ) C KiaKio and Energy Intervals PROGRAMMING binary search bitmasks brute force data structures divide and conquer greedy two pointers

Kia and Kio found a glowing array (a_1, a_2, \ldots, a_n) inside a crystal terminal in the ruins of an ancient digital kingdom. The terminal works like this. Kia picks a segment of the array: any two indices (l) and (r) with (l \lt r) (so the segment always has at least two elements). Kio then finds the strongest energy in that segment, (m = \max\left(a_l, a_{l+1}, \ldots, a_r\right)), and the terminal masks every element of the segment with (m) (bitwise AND), then fuses the results together (bitwise XOR): () (a_l \,\&\, m)\oplus(a_{l+1} \,\&\, m)\oplus\cdots\oplus(a_r \,\&\, m). () That number is the energy released. Kia wants the strongest possible blast. Over all valid segments ((l, r)), what is the largest energy the terminal can produce? Here, (\&) denotes the bitwise AND operation, and (\oplus) denotes the bitwise XOR operation. 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 a single integer (n) ((2 \le n \le 2\cdot10^5)) — the size of the array. The second line contains (n) integers (a_1,a_2,\ldots,a_n) ((0 \le a_i \lt 2^{18})). It is guaranteed that the sum of (n) over all test cases does not exceed (2\cdot10^5). For each test case, print a single integer — the maximum possible value of () (a_l \,\&\, m)\oplus(a_{l+1} \,\&\, m)\oplus\cdots\oplus(a_r \,\&\, m) () among all pairs ((l,r)) satisfying (l \lt r). In the first test case, one optimal interval is (l=1) and (r=2). The maximum element in this interval is (m=7). The value becomes ((1\,\& \,7)\oplus(7\,\&\,7) = 6).

Tutorials

157140

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392199637 albertwangwm C Sept. 26, 2026, 3:17 p.m. OK C++17 (GCC 7-32) TESTS 48 93 6348800
392226860 SpringWait C Sept. 26, 2026, 4:35 p.m. OK C++17 (GCC 7-32) TESTS 48 109 8192000
392198835 quanjun C Sept. 26, 2026, 3:15 p.m. OK C++17 (GCC 7-32) TESTS 48 109 8806400
392205044 intjr C Sept. 26, 2026, 3:29 p.m. OK C++17 (GCC 7-32) TESTS 48 125 3379200
392218365 jisoofan C Sept. 26, 2026, 4:05 p.m. OK C++17 (GCC 7-32) TESTS 48 156 7987200
392227905 EternalEpic C Sept. 26, 2026, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 48 156 20582400
392222417 guanhuai04 C Sept. 26, 2026, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 48 156 27033600
392284976 zhc123 C Sept. 27, 2026, 5:26 a.m. OK C++17 (GCC 7-32) TESTS 61 171 14848000
392206809 qwef_ C Sept. 26, 2026, 3:34 p.m. OK C++17 (GCC 7-32) TESTS 48 203 206950400
392226351 shi255 C Sept. 26, 2026, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 48 218 37068800
392198472 Ormlis C Sept. 26, 2026, 3:14 p.m. OK C++20 (GCC 13-64) TESTS 48 78 2150400
392278612 include_BM C Sept. 27, 2026, 3:35 a.m. OK C++20 (GCC 13-64) TESTS 60 93 6348800
392231534 EMEMAY C Sept. 26, 2026, 4:54 p.m. OK C++20 (GCC 13-64) TESTS 48 93 12697600
392237608 123456789010111213141516 C Sept. 26, 2026, 5:32 p.m. OK C++20 (GCC 13-64) TESTS 49 93 16998400
392237503 mahiro_zcy C Sept. 26, 2026, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 49 93 16998400
392278859 master_luo C Sept. 27, 2026, 3:39 a.m. OK C++20 (GCC 13-64) TESTS 60 109 7065600
392217917 GrandMasterRED C Sept. 26, 2026, 4:04 p.m. OK C++20 (GCC 13-64) TESTS 48 109 7987200
392200196 jn_275 C Sept. 26, 2026, 3:18 p.m. OK C++20 (GCC 13-64) TESTS 48 109 13926400
392226672 HeartBreakerKid C Sept. 26, 2026, 4:35 p.m. OK C++20 (GCC 13-64) TESTS 48 109 22835200
392232409 mip002 C Sept. 26, 2026, 4:58 p.m. OK C++20 (GCC 13-64) TESTS 48 109 37785600
392231399 Pumkinhead_Me C Sept. 26, 2026, 4:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 78 2764800
392202435 zltz4 C Sept. 26, 2026, 3:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 78 3072000
392217406 caichengyia C Sept. 26, 2026, 4:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 78 6656000
392224767 positive_deviation C Sept. 26, 2026, 4:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 93 17510400
392215693 LMydd0225 C Sept. 26, 2026, 3:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 93 72192000
392236938 Pumkinhead_Me C Sept. 26, 2026, 5:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 49 109 2867200
392247619 ytfish C Sept. 26, 2026, 7:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 56 109 3379200
392213974 dang3r C Sept. 26, 2026, 3:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 109 3379200
392216085 idontwannadothisanymore C Sept. 26, 2026, 3:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 109 5632000
392216151 bukhuk C Sept. 26, 2026, 3:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 48 109 6553600
392206357 Cybuster C Sept. 26, 2026, 3:32 p.m. OK D TESTS 48 296 13619200
392242446 Sensity C Sept. 26, 2026, 6:12 p.m. OK Go TESTS 51 109 36864000
392217570 AJ123496 C Sept. 26, 2026, 4:03 p.m. OK Java 21 TESTS 48 234 6963200
392230945 WaterBottlle C Sept. 26, 2026, 4:52 p.m. OK Java 21 TESTS 48 312 7987200
392223486 LT1 C Sept. 26, 2026, 4:23 p.m. OK Java 21 TESTS 48 500 44748800
392217991 hardiknarang2509 C Sept. 26, 2026, 4:04 p.m. OK Java 21 TESTS 48 515 22220800
392232087 dark_slayer007 C Sept. 26, 2026, 4:56 p.m. OK Java 8 TESTS 48 187 5632000
392211763 Tlatoani C Sept. 26, 2026, 3:46 p.m. OK Kotlin 2.2 TESTS 48 640 34508800
392264608 Little_Sheep_Yawn C Sept. 27, 2026, 1:58 a.m. OK PyPy 3-64 TESTS 58 1328 58572800
392233320 mtand872 C Sept. 26, 2026, 5:01 p.m. OK PyPy 3-64 TESTS 48 1343 71168000
392280065 xxxzenu C Sept. 27, 2026, 4:02 a.m. OK PyPy 3-64 TESTS 61 1953 137216000
392225794 Kevin-27 C Sept. 26, 2026, 4:31 p.m. OK Rust 2024 TESTS 48 109 17408000
392223433 qwerty787788 C Sept. 26, 2026, 4:23 p.m. OK Rust 2024 TESTS 48 359 104038400
392212596 DanielAnker C Sept. 26, 2026, 3:48 p.m. OK Rust 2024 TESTS 48 906 21811200

remove filters

Back to search problems