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 |
|---|---|---|---|---|---|---|
| 2006 | Codeforces Round 969 (Div. 1) | FINISHED | False | 9000 | 51377123 | Aug. 30, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 2066 ) | C | Eri and Expanded Sets | PROGRAMMING | binary search data structures number theory two pointers |
Let there be a set that contains distinct positive integers. To expand the set to contain as many integers as possible, Eri can choose two integers (x\neq y) from the set such that their average (\frac{x+y}2) is still a positive integer and isn't contained in the set, and add it to the set. The integers (x) and (y) remain in the set. Let's call the set of integers consecutive if, after the elements are sorted, the difference between any pair of adjacent elements is (1). For example, sets (\{2\}), (\{2, 5, 4, 3\}), (\{5, 6, 8, 7\}) are consecutive, while (\{2, 4, 5, 6\}), (\{9, 7\}) are not. Eri likes consecutive sets. Suppose there is an array (b), then Eri puts all elements in (b) into the set. If after a finite number of operations described above, the set can become consecutive, the array (b) will be called brilliant . Note that if the same integer appears in the array multiple times, we only put it into the set once , as a set always contains distinct positive integers. Eri has an array (a) of (n) positive integers. Please help him to count the number of pairs of integers ((l,r)) such that (1 \leq l \leq r \leq n) and the subarray (a_l, a_{l+1}, \ldots, a_r) is brilliant. Each test consists of multiple test cases. The first line contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \leq n \leq 4 \cdot 10^5)) — length of the array (a). The second line of each test case contains (n) integers (a_1, a_2, \ldots a_n) ((1 \leq a_i \leq 10^9)) — the elements of the array (a). It is guaranteed that the sum of (n) over all test cases doesn't exceed (4 \cdot 10^5). For each test case, output a single integer — the number of brilliant subarrays. In the first test case, the array (a = 2, 2) has (3) subarra |
| Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 278834168 | mban259 | C | Aug. 30, 2024, 4:32 p.m. | OK | C# 10 | TESTS | 26 | 593 | 44236800 | ||
| 278865743 | wcdr | C | Aug. 30, 2024, 10:09 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 124 | 6656000 | ||
| 278860100 | Sorting | C | Aug. 30, 2024, 8:27 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 140 | 10035200 | ||
| 278858204 | Sorting | C | Aug. 30, 2024, 8 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 140 | 10035200 | ||
| 278857959 | Sorting | C | Aug. 30, 2024, 7:56 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 155 | 9830400 | ||
| 278858325 | Sorting | C | Aug. 30, 2024, 8:02 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 155 | 9830400 | ||
| 278858969 | Sorting | C | Aug. 30, 2024, 8:11 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 156 | 1126400 | ||
| 278859595 | Sorting | C | Aug. 30, 2024, 8:20 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 156 | 1126400 | ||
| 278859459 | Sorting | C | Aug. 30, 2024, 8:18 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 156 | 1126400 | ||
| 278873760 | czhang2718 | C | Aug. 31, 2024, 2 a.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 156 | 4403200 | ||
| 278858460 | Sorting | C | Aug. 30, 2024, 8:03 p.m. | OK | C++17 (GCC 7-32) | TESTS | 26 | 156 | 9830400 | ||
| 278807042 | maspy | C | Aug. 30, 2024, 3:22 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 108 | 17612800 | ||
| 278876033 | adam01 | C | Aug. 31, 2024, 2:47 a.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 124 | 6451200 | ||
| 278876000 | adam01 | C | Aug. 31, 2024, 2:46 a.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 125 | 6451200 | ||
| 278821189 | BEAR0131 | C | Aug. 30, 2024, 3:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 140 | 3379200 | ||
| 278823751 | yeminghan | C | Aug. 30, 2024, 4 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 140 | 4915200 | ||
| 278840126 | lcaonmst | C | Aug. 30, 2024, 4:55 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 140 | 12390400 | ||
| 278820570 | Forested | C | Aug. 30, 2024, 3:51 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 155 | 409600 | ||
| 278810570 | physics0523 | C | Aug. 30, 2024, 3:28 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 155 | 3379200 | ||
| 278811636 | tfg | C | Aug. 30, 2024, 3:30 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 156 | 102400 | ||
| 278820478 | MridulAhi | C | Aug. 30, 2024, 3:51 p.m. | OK | C++20 (GCC 13-64) | TESTS | 26 | 156 | 6246400 | ||
| 278860086 | Sorting | C | Aug. 30, 2024, 8:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 140 | 11264000 | ||
| 278861964 | neal | C | Aug. 30, 2024, 8:56 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 171 | 29696000 | ||
| 278846942 | ImmortaLimit | C | Aug. 30, 2024, 5:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 171 | 53760000 | ||
| 278818323 | chinerist | C | Aug. 30, 2024, 3:45 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 202 | 20787200 | ||
| 278873905 | ETO_leader | C | Aug. 31, 2024, 2:03 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 202 | 38195200 | ||
| 278818059 | Fido_Puppy | C | Aug. 30, 2024, 3:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 234 | 4915200 | ||
| 278847427 | zfs732 | C | Aug. 30, 2024, 6:03 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 249 | 32153600 | ||
| 278804202 | neal | C | Aug. 30, 2024, 3:16 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 265 | 29593600 | ||
| 278839635 | DerekYeh | C | Aug. 30, 2024, 4:53 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 280 | 31744000 | ||
| 278833056 | khuepr123 | C | Aug. 30, 2024, 4:29 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 26 | 280 | 116428800 | ||
| 278826105 | KumaTachiRen | C | Aug. 30, 2024, 4:07 p.m. | OK | C# 8 | TESTS | 26 | 1015 | 34918400 | ||
| 278835616 | Gassa | C | Aug. 30, 2024, 4:38 p.m. | OK | D | TESTS | 26 | 358 | 28364800 | ||
| 278837471 | ghj1222 | C | Aug. 30, 2024, 4:44 p.m. | OK | GNU C11 | TESTS | 26 | 187 | 3276800 | ||
| 278857973 | -dub-otrezkov- | C | Aug. 30, 2024, 7:56 p.m. | OK | Go | TESTS | 26 | 624 | 75161600 | ||
| 278869430 | rowechen | C | Aug. 30, 2024, 11:59 p.m. | OK | Java 8 | TESTS | 26 | 718 | 26828800 | ||
| 278814610 | MagentaCobra | C | Aug. 30, 2024, 3:37 p.m. | OK | Java 8 | TESTS | 26 | 1156 | 14540800 | ||
| 278786903 | Tlatoani | C | Aug. 30, 2024, 2:52 p.m. | OK | Kotlin 1.9 | TESTS | 26 | 702 | 41676800 | ||
| 278840144 | bcollet | C | Aug. 30, 2024, 4:55 p.m. | OK | PyPy 2 | TESTS | 26 | 436 | 35123200 | ||
| 278820490 | eepsilon | C | Aug. 30, 2024, 3:51 p.m. | OK | PyPy 3-64 | TESTS | 26 | 499 | 71065600 | ||
| 278804586 | Alex239 | C | Aug. 30, 2024, 3:17 p.m. | OK | PyPy 3-64 | TESTS | 26 | 546 | 102809600 | ||
| 278870117 | Little_Sheep_Yawn | C | Aug. 31, 2024, 12:23 a.m. | OK | PyPy 3-64 | TESTS | 26 | 562 | 55603200 | ||
| 278820948 | toam | C | Aug. 30, 2024, 3:52 p.m. | OK | PyPy 3-64 | TESTS | 26 | 593 | 55808000 | ||
| 278850346 | misorin | C | Aug. 30, 2024, 6:29 p.m. | OK | PyPy 3-64 | TESTS | 26 | 624 | 110182400 | ||
| 278848838 | hxu10 | C | Aug. 30, 2024, 6:15 p.m. | OK | PyPy 3-64 | TESTS | 26 | 687 | 53862400 | ||
| 278835578 | tassei903 | C | Aug. 30, 2024, 4:38 p.m. | OK | PyPy 3-64 | TESTS | 26 | 764 | 55193600 | ||
| 278855492 | Vladislav_Gnatuk | C | Aug. 30, 2024, 7:24 p.m. | OK | PyPy 3-64 | TESTS | 26 | 1311 | 56729600 | ||
| 278819912 | bronze_coder | C | Aug. 30, 2024, 3:49 p.m. | OK | PyPy 3-64 | TESTS | 26 | 1311 | 56729600 | ||
| 278836494 | mees | C | Aug. 30, 2024, 4:41 p.m. | OK | PyPy 3-64 | TESTS | 26 | 1499 | 38297600 | ||
| 278852187 | toor | C | Aug. 30, 2024, 6:47 p.m. | OK | Rust 2021 | TESTS | 26 | 124 | 4710400 |
Back to search problems