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 |
|---|---|---|---|---|---|---|
| 2071 | Codeforces Round 1007 (Div. 2) | FINISHED | False | 8100 | 35652323 | Feb. 28, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1073 ) | D2 | Infinite Sequence (Hard Version) | PROGRAMMING | bitmasks constructive algorithms data structures dp implementation math |
This is the hard version of the problem. The difference between the versions is that in this version, (l\le r). You can hack only if you solved all versions of this problem. You are given a positive integer (n) and the first (n) terms of an infinite binary sequence (a), which is defined as follows: For (m>n), (a_m = a_1 \oplus a_2 \oplus \ldots \oplus a_{\lfloor \frac{m}{2} \rfloor})(^{\text{∗}}). Your task is to compute the sum of elements in a given range (l, r): (a_l + a_{l + 1} + \ldots + a_r). (^{\text{∗}})(\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 three integers (n), (l), and (r) ((1 \le n \le 2 \cdot 10^5), (1 \le l \leq r \le 10^{18})). The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((\color{red}{a_i \in \{0, 1\}})) — the first (n) terms of the sequence (a). It is guaranteed that the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, output a single integer — the sum of elements in the given range. In the first test case, the sequence (a) is equal to ()\underline{\color{red}{1}}, 1, 1, 0, 0, 1, 1, 1, 1, 1, \ldots() where (l = 1), and (r = 1). The sum of elements in the range (1, 1) is equal to ()a_1 = 1.() In the second test case, the sequence (a) is equal to ()\color{red}{1}, \color{red}{0}, \underline{1, 1, 1, 0, 0, 1, 1, 0}, \ldots() where (l = 3), and (r = 10). The sum of elements in the range (3, 10) is equal to ()a_3 + a_4 + \ldots + a_{10} = 1 + 1 + 1 + 0 + 0 + 1 + 1 + 0 = 5.() |
| Codeforces Round 1007 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 308376459 | TheTechCoder | D2 | Feb. 28, 2025, 4:30 p.m. | OK | C# 10 | TESTS | 11 | 281 | 18227200 | ||
| 308393659 | Teja-Smart | D2 | Feb. 28, 2025, 6:08 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 77 | 4812800 | ||
| 308409397 | cqbz163003gzm | D2 | Feb. 28, 2025, 8:26 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 1638400 | ||
| 308387411 | RaduM | D2 | Feb. 28, 2025, 5:25 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 93 | 3276800 | ||
| 308386769 | SoReMore | D2 | Feb. 28, 2025, 5:22 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 108 | 4403200 | ||
| 308394677 | SergiiGolovko | D2 | Feb. 28, 2025, 6:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 108 | 5734400 | ||
| 308388103 | n0sk1ll | D2 | Feb. 28, 2025, 5:29 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 109 | 409600 | ||
| 308379718 | ixitgufxgzfu | D2 | Feb. 28, 2025, 4:39 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 109 | 12083200 | ||
| 308402332 | _AdiYadav_ | D2 | Feb. 28, 2025, 7:22 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 124 | 0 | ||
| 308387019 | durduryu | D2 | Feb. 28, 2025, 5:23 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 124 | 3276800 | ||
| 308379656 | Az3ar | D2 | Feb. 28, 2025, 4:38 p.m. | OK | C++17 (GCC 7-32) | TESTS | 11 | 124 | 4096000 | ||
| 308419802 | Honerad | D2 | Feb. 28, 2025, 10:37 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 4096000 | ||
| 308379991 | kotatsugame | D2 | Feb. 28, 2025, 4:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 4300800 | ||
| 308438049 | Darsh_Jain | D2 | March 1, 2025, 3:55 a.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 7475200 | ||
| 308416306 | ayhan37 | D2 | Feb. 28, 2025, 9:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 77 | 16076800 | ||
| 308402020 | _Gin_ | D2 | Feb. 28, 2025, 7:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 1126400 | ||
| 308399354 | beyondpluto | D2 | Feb. 28, 2025, 6:56 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 2457600 | ||
| 308389651 | baoziiiiii | D2 | Feb. 28, 2025, 5:39 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 2764800 | ||
| 308428460 | enslaved | D2 | March 1, 2025, 1:45 a.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 4300800 | ||
| 308396019 | _Puzzles | D2 | Feb. 28, 2025, 6:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 4300800 | ||
| 308403230 | XDEv11 | D2 | Feb. 28, 2025, 7:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 11 | 78 | 5939200 | ||
| 308410013 | iLoveOru | D2 | Feb. 28, 2025, 8:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 1638400 | ||
| 308421197 | .XiaoXia | D2 | Feb. 28, 2025, 11:04 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 1945600 | ||
| 308390531 | _Seele_Vollerei_ | D2 | Feb. 28, 2025, 5:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 4403200 | ||
| 308430787 | _XVIIVX | D2 | March 1, 2025, 2:24 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 77 | 64204800 | ||
| 308382619 | NikitaMartyanov | D2 | Feb. 28, 2025, 4:46 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 78 | 2867200 | ||
| 308387051 | Mamedov | D2 | Feb. 28, 2025, 5:23 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 78 | 3276800 | ||
| 308379740 | maspy | D2 | Feb. 28, 2025, 4:39 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 92 | 13209600 | ||
| 308386755 | pienotpi | D2 | Feb. 28, 2025, 5:22 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 93 | 102400 | ||
| 308392612 | Rushdi | D2 | Feb. 28, 2025, 5:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 93 | 102400 | ||
| 308436231 | iregreteverything | D2 | March 1, 2025, 3:32 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 11 | 93 | 1228800 | ||
| 308374714 | Thetechieguyy | D2 | Feb. 28, 2025, 4:25 p.m. | OK | C# 8 | TESTS | 11 | 515 | 17203200 | ||
| 308386782 | rainboy | D2 | Feb. 28, 2025, 5:23 p.m. | OK | GNU C11 | TESTS | 11 | 124 | 3276800 | ||
| 308383437 | cyclop5 | D2 | Feb. 28, 2025, 4:48 p.m. | OK | Go | TESTS | 11 | 233 | 6553600 | ||
| 308375229 | thetechieyguy | D2 | Feb. 28, 2025, 4:27 p.m. | OK | Go | TESTS | 11 | 234 | 6553600 | ||
| 308375501 | Newstart27 | D2 | Feb. 28, 2025, 4:27 p.m. | OK | Go | TESTS | 11 | 265 | 6553600 | ||
| 308382993 | baoquaytay | D2 | Feb. 28, 2025, 4:47 p.m. | OK | Go | TESTS | 11 | 921 | 13312000 | ||
| 308376642 | luxemburger | D2 | Feb. 28, 2025, 4:30 p.m. | OK | Java 21 | TESTS | 11 | 328 | 204800 | ||
| 308383819 | Yaduvanshi_Sarvan | D2 | Feb. 28, 2025, 4:49 p.m. | OK | Java 21 | TESTS | 11 | 515 | 15667200 | ||
| 308380775 | 034_Bikash | D2 | Feb. 28, 2025, 4:42 p.m. | OK | Java 21 | TESTS | 11 | 655 | 1228800 | ||
| 308383884 | quynhit | D2 | Feb. 28, 2025, 4:49 p.m. | OK | Java 21 | TESTS | 11 | 749 | 4403200 | ||
| 308376690 | digitalman2 | D2 | Feb. 28, 2025, 4:31 p.m. | OK | Java 8 | TESTS | 11 | 389 | 7680000 | ||
| 308380398 | jueviolegrace | D2 | Feb. 28, 2025, 4:41 p.m. | OK | Java 8 | TESTS | 11 | 764 | 5734400 | ||
| 308375665 | TheCodeDude | D2 | Feb. 28, 2025, 4:28 p.m. | OK | Kotlin 1.9 | TESTS | 11 | 577 | 0 | ||
| 308384081 | vishnuppriyan_ | D2 | Feb. 28, 2025, 4:49 p.m. | OK | Kotlin 1.9 | TESTS | 11 | 592 | 0 | ||
| 308383780 | Khaled_Kamal_ | D2 | Feb. 28, 2025, 4:49 p.m. | OK | Kotlin 1.9 | TESTS | 11 | 608 | 0 | ||
| 308379943 | The_Bharadwaj | D2 | Feb. 28, 2025, 4:39 p.m. | OK | Node.js | TESTS | 11 | 1983 | 46694400 | ||
| 308377239 | TheTechBuilder | D2 | Feb. 28, 2025, 4:32 p.m. | OK | PHP | TESTS | 11 | 827 | 60928000 | ||
| 308441622 | Mukundan314 | D2 | March 1, 2025, 4:41 a.m. | OK | PyPy 3-64 | TESTS | 11 | 625 | 21094400 | ||
| 308382513 | AllH5 | D2 | Feb. 28, 2025, 4:46 p.m. | OK | PyPy 3-64 | TESTS | 11 | 702 | 22835200 | ||
| 308382494 | arora.apoorv | D2 | Feb. 28, 2025, 4:46 p.m. | OK | PyPy 3-64 | TESTS | 11 | 968 | 22630400 | ||
| 308380171 | DegTegFateh | D2 | Feb. 28, 2025, 4:40 p.m. | OK | PyPy 3-64 | TESTS | 11 | 1046 | 28262400 | ||
| 308391732 | Deityofds | D2 | Feb. 28, 2025, 5:53 p.m. | OK | PyPy 3-64 | TESTS | 11 | 1624 | 23142400 | ||
| 308377236 | Taghi | D2 | Feb. 28, 2025, 4:32 p.m. | OK | Python 3 | TESTS | 11 | 999 | 53555200 | ||
| 308379258 | NikolaT. | D2 | Feb. 28, 2025, 4:37 p.m. | OK | Ruby 3 | TESTS | 11 | 1608 | 27852800 | ||
| 308379173 | thecodingguyy | D2 | Feb. 28, 2025, 4:37 p.m. | OK | Ruby 3 | TESTS | 11 | 1640 | 28057600 | ||
| 308382309 | Dpkasd_12 | D2 | Feb. 28, 2025, 4:46 p.m. | OK | Rust 2021 | TESTS | 11 | 78 | 3993600 | ||
| 308378667 | DeanMenezes93 | D2 | Feb. 28, 2025, 4:36 p.m. | OK | Rust 2021 | TESTS | 11 | 124 | 4198400 | ||
| 308376472 | aim_xd | D2 | Feb. 28, 2025, 4:30 p.m. | OK | Rust 2021 | TESTS | 11 | 124 | 9932800 | ||
| 308377858 | TheCodeNinja | D2 | Feb. 28, 2025, 4:34 p.m. | OK | Scala | TESTS | 11 | 874 | 14233600 |
Back to search problems