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 |
---|---|---|---|---|---|---|
1982 | Codeforces Round 955 (Div. 2, with prizes from NEAR!) | FINISHED | False | 7200 | 17853863 | June 25, 2024, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1648 ) | E | Number of k-good subarrays | PROGRAMMING | bitmasks combinatorics divide and conquer dp math meet-in-the-middle |
B"Let bit(x) denote the number of ones in the binary representation of a non-negative integer x . A subarray of an array is called k -good if it consists only of numbers with no more than k ones in their binary representation, i.e., a subarray (l, r) of array a is good if for any i such that l <= i <= r condition bit(a_{i}) <= k is satisfied. You are given an array a of length n , consisting of consecutive non-negative integers starting from 0 , i.e., a_{i} = i for 0 <= i <= n - 1 (in 0 -based indexing). You need to count the number of k -good subarrays in this array. As the answer can be very large, output it modulo 10^{9} + 7 . Each test consists of multiple test cases. The first line contains an integer t ( 1 <= t <= 10^{4} ) -- the number of test cases. The following lines describe the test cases. The single line of each test case contains two integers n , k ( 1 <= n <= 10^{18}, 1 <= k <= 60 ). For each test case, output a single integer -- the number of k -good subarrays modulo 10^{9} + 7 . For the first test case a = [0, 1, 2, 3, 4, 5] , k = 1 . To find the answer, let's write all the numbers in binary representation: a = [ color{green}{000}, color{green}{001}, color{green}{010}, color{red}{011}, color{green}{100}, color{red}{101}] From this, it can be seen that the numbers 3 and 5 have 2 ge (k = 1) ones in their binary representation, so the answer should include all subarrays that do not contain either 3 or 5 , which are the subarrays (in 0 -based indexing): ( 0 , 0 ), ( 0 , 1 ), ( 0 , 2 ), ( 1 , 1 ), ( 1 , 2 ), ( 2 , 2 ), ( 4 , 4 ). "... |
130839 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
267424525 | spacedate_xacs | E | June 25, 2024, 7:10 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 77 | 0 | ||
267409754 | a5a7 | E | June 25, 2024, 5:21 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 77 | 0 | ||
267409922 | phuocson | E | June 25, 2024, 5:22 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 77 | 102400 | ||
267405212 | wu_sir | E | June 25, 2024, 4:34 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 77 | 102400 | ||
267403879 | HNBlackHorse | E | June 25, 2024, 4:33 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 77 | 307200 | ||
267427867 | myst-6 | E | June 25, 2024, 7:46 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 93 | 0 | ||
267403568 | LarrixAntofanin | E | June 25, 2024, 4:32 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 108 | 102400 | ||
267412884 | Mashirost | E | June 25, 2024, 5:39 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 124 | 102400 | ||
267437790 | myheartwaing | E | June 25, 2024, 10:06 p.m. | OK | C++14 (GCC 6-32) | TESTS | 25 | 124 | 204800 | ||
267408990 | Rex_Lapis | E | June 25, 2024, 5:17 p.m. | OK | C++14 (GCC 6-32) | TESTS | 20 | 156 | 0 | ||
267429986 | aggkash | E | June 25, 2024, 8:12 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 62 | 0 | ||
267460849 | shrimpballs | E | June 26, 2024, 4:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 62 | 102400 | ||
267443523 | cutx86 | E | June 26, 2024, 12:17 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 62 | 204800 | ||
267466443 | Ghulam_Junaid | E | June 26, 2024, 5:51 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 77 | 0 | ||
267450988 | _bqn | E | June 26, 2024, 2:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 77 | 0 | ||
267448897 | GStnt | E | June 26, 2024, 2:13 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 77 | 0 | ||
267443399 | CoderAbhi27 | E | June 26, 2024, 12:14 a.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 77 | 0 | ||
267430347 | Valters07 | E | June 25, 2024, 8:16 p.m. | OK | C++17 (GCC 7-32) | TESTS | 25 | 77 | 0 | ||
267422176 | fox_cat | E | June 25, 2024, 6:49 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 77 | 0 | ||
267422031 | fox_cat | E | June 25, 2024, 6:48 p.m. | OK | C++17 (GCC 7-32) | TESTS | 20 | 77 | 0 | ||
267453906 | yyyz04 | E | June 26, 2024, 3:34 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 46 | 102400 | ||
267449341 | rulerofcakes | E | June 26, 2024, 2:22 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 46 | 204800 | ||
267440616 | The_Lion_King_4210 | E | June 25, 2024, 11:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 61 | 0 | ||
267416495 | 415411 | E | June 25, 2024, 6:03 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 61 | 0 | ||
267449026 | kimmoqt | E | June 26, 2024, 2:16 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 61 | 102400 | ||
267421166 | zhenja | E | June 25, 2024, 6:40 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 61 | 102400 | ||
267410461 | FlowRays | E | June 25, 2024, 5:25 p.m. | OK | C++20 (GCC 13-64) | TESTS | 20 | 61 | 2252800 | ||
267458675 | AIF_is_carving | E | June 26, 2024, 4:32 a.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 62 | 0 | ||
267437432 | erbt | E | June 25, 2024, 10 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 62 | 0 | ||
267430596 | sysia | E | June 25, 2024, 8:20 p.m. | OK | C++20 (GCC 13-64) | TESTS | 25 | 62 | 0 | ||
267409612 | Gassa | E | June 25, 2024, 5:20 p.m. | OK | D | TESTS | 20 | 234 | 52838400 | ||
267408313 | Gassa | E | June 25, 2024, 5:15 p.m. | OK | D | TESTS | 20 | 250 | 52838400 | ||
267450860 | nguyenquocthao00 | E | June 26, 2024, 2:47 a.m. | OK | Go | TESTS | 25 | 1843 | 46694400 | ||
267455585 | nguyenquocthao00 | E | June 26, 2024, 3:57 a.m. | OK | Go | TESTS | 25 | 1906 | 49356800 | ||
267439671 | dzhi | E | June 25, 2024, 10:45 p.m. | OK | Java 21 | TESTS | 25 | 359 | 921600 | ||
267440824 | dzhi | E | June 25, 2024, 11:10 p.m. | OK | Java 21 | TESTS | 25 | 374 | 819200 | ||
267402205 | Dukkha | E | June 25, 2024, 4:30 p.m. | OK | Java 21 | TESTS | 20 | 374 | 1024000 | ||
267447371 | lyongwolf | E | June 26, 2024, 1:44 a.m. | OK | Java 21 | TESTS | 25 | 467 | 614400 | ||
267446672 | lyongwolf | E | June 26, 2024, 1:28 a.m. | OK | Java 21 | TESTS | 25 | 484 | 1024000 | ||
267447381 | cc4414 | E | June 26, 2024, 1:44 a.m. | OK | Java 21 | TESTS | 25 | 1171 | 819200 | ||
267408916 | yvbf | E | June 25, 2024, 5:17 p.m. | OK | Java 8 | TESTS | 20 | 234 | 0 | ||
267438702 | RandyG | E | June 25, 2024, 10:24 p.m. | OK | Java 8 | TESTS | 25 | 374 | 0 | ||
267403576 | profchi | E | June 25, 2024, 4:32 p.m. | OK | Java 8 | TESTS | 20 | 1124 | 28262400 | ||
267409132 | wangchaohui | E | June 25, 2024, 5:18 p.m. | OK | Kotlin 1.9 | TESTS | 20 | 1140 | 32972800 | ||
267436812 | ahtoh_ | E | June 25, 2024, 9:49 p.m. | OK | Node.js | TESTS | 25 | 546 | 6860800 | ||
267434260 | Krispy | E | June 25, 2024, 9:09 p.m. | OK | PyPy 3 | TESTS | 25 | 1530 | 13414400 | ||
267442284 | siuhou | E | June 25, 2024, 11:46 p.m. | OK | PyPy 3-64 | TESTS | 25 | 296 | 10342400 | ||
267448554 | PROELECTRO444 | E | June 26, 2024, 2:07 a.m. | OK | PyPy 3-64 | TESTS | 25 | 468 | 42291200 | ||
267448229 | phungthienphuoc | E | June 26, 2024, 2 a.m. | OK | PyPy 3-64 | TESTS | 25 | 499 | 9420800 | ||
267429441 | citrinitas | E | June 25, 2024, 8:04 p.m. | OK | PyPy 3-64 | TESTS | 25 | 514 | 9318400 | ||
267448324 | phungthienphuoc | E | June 26, 2024, 2:02 a.m. | OK | PyPy 3-64 | TESTS | 25 | 515 | 9216000 | ||
267447821 | smilences | E | June 26, 2024, 1:53 a.m. | OK | PyPy 3-64 | TESTS | 25 | 515 | 71372800 | ||
267448315 | smilences | E | June 26, 2024, 2:02 a.m. | OK | PyPy 3-64 | TESTS | 25 | 515 | 71884800 | ||
267449927 | smilences | E | June 26, 2024, 2:32 a.m. | OK | PyPy 3-64 | TESTS | 25 | 546 | 71475200 | ||
267415525 | samoylovboris | E | June 25, 2024, 5:56 p.m. | OK | PyPy 3-64 | TESTS | 20 | 546 | 82841600 | ||
267460969 | Gardenia625 | E | June 26, 2024, 4:58 a.m. | OK | PyPy 3-64 | TESTS | 25 | 577 | 9728000 | ||
267431498 | MehraSaurav | E | June 25, 2024, 8:31 p.m. | OK | Python 3 | TESTS | 25 | 1593 | 0 |
Back to search problems