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 |
---|---|---|---|---|---|---|
1706 | Codeforces Round 809 (Div. 2) | FINISHED | False | 7200 | 79111463 | July 18, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1743 ) | D2 | Chopping Carrots (Hard Version) | PROGRAMMING | constructive algorithms dp number theory two pointers |
B'This is the hard version of the problem. The only difference between the versions is the constraints on n , k , a_i , and the sum of n over all test cases. You can make hacks only if both versions of the problem are solved. Note the unusual memory limit. You are given an array of integers a_1, a_2, ldots, a_n of length n , and an integer k . The cost of an array of integers p_1, p_2, ldots, p_n of length n is max limits_{1 <= i <= n} <= ft( <= ft lfloor frac{a_i}{p_i} right rfloor right) - min limits_{1 <= i <= n} <= ft( <= ft lfloor frac{a_i}{p_i} right rfloor right). Here, lfloor frac{x}{y} rfloor denotes the integer part of the division of x by y . Find the minimum cost of an array p such that 1 <= p_i <= k for all 1 <= i <= n . The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n, k <= 10^5 ). The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_1 <= a_2 <= ldots <= a_n <= 10^5 ). It is guaranteed that the sum of n over all test cases does not exceed 10^5 . For each test case, print a single integer -- the minimum possible cost of an array p satisfying the condition above. In the first test case, the optimal array is p = [1, 1, 1, 2, 2] . The resulting array of values of lfloor frac{a_i}{p_i} rfloor is [4, 5, 6, 4, 5] . The cost of p is max limits_{1 <= i <= n}( lfloor frac{a_i}{p_i} rfloor) - min limits_{1 <= i <= n}( lfloor frac{a_i}{p_i} rfloor) = 6 - 4 = 2 . We can show that there is no array (satisfying the condition from the statement) with a smaller cost. In the second test case, one of the optimal arrays is p = [12, 12, 12, 12, 12] , which results in all lfloor frac{a_i}{p_i} rfloor be'... |
Codeforces Round #809 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
164800713 | rainboy | D2 | July 18, 2022, 5:43 p.m. | OK | GNU C11 | TESTS | 67 | 1138 | 819200 | ||
164828162 | cyb1010 | D2 | July 19, 2022, 12:27 a.m. | OK | GNU C++14 | TESTS | 67 | 327 | 1228800 | ||
164823202 | egorqwq | D2 | July 18, 2022, 10:21 p.m. | OK | GNU C++14 | TESTS | 67 | 483 | 1433600 | ||
164790768 | PolarAid | D2 | July 18, 2022, 4:28 p.m. | OK | GNU C++14 | TESTS | 67 | 546 | 1228800 | ||
164835172 | 2018ljw | D2 | July 19, 2022, 2:16 a.m. | OK | GNU C++14 | TESTS | 67 | 686 | 2355200 | ||
164789941 | Creamii | D2 | July 18, 2022, 4:26 p.m. | OK | GNU C++14 | TESTS | 67 | 717 | 65945600 | ||
164828341 | wsyear | D2 | July 19, 2022, 12:31 a.m. | OK | GNU C++14 | TESTS | 67 | 733 | 4096000 | ||
164787656 | 2018ljw | D2 | July 18, 2022, 4:21 p.m. | OK | GNU C++14 | TESTS | 67 | 748 | 2355200 | ||
164808672 | got_sphinx | D2 | July 18, 2022, 6:57 p.m. | OK | GNU C++14 | TESTS | 67 | 764 | 3993600 | ||
164830322 | b6e0 | D2 | July 19, 2022, 1:09 a.m. | OK | GNU C++14 | TESTS | 67 | 780 | 65638400 | ||
164834072 | amcones | D2 | July 19, 2022, 2:01 a.m. | OK | GNU C++14 | TESTS | 67 | 826 | 6041600 | ||
164844476 | alek0618 | D2 | July 19, 2022, 4:19 a.m. | OK | GNU C++17 | TESTS | 67 | 140 | 4403200 | ||
164825283 | amitmax123 | D2 | July 18, 2022, 11:11 p.m. | OK | GNU C++17 | TESTS | 67 | 171 | 921600 | ||
164806386 | Carpenters_Cat | D2 | July 18, 2022, 6:32 p.m. | OK | GNU C++17 | TESTS | 67 | 202 | 921600 | ||
164820864 | Bobocan | D2 | July 18, 2022, 9:35 p.m. | OK | GNU C++17 | TESTS | 67 | 327 | 2150400 | ||
164810798 | beemax | D2 | July 18, 2022, 7:21 p.m. | OK | GNU C++17 | TESTS | 67 | 343 | 819200 | ||
164833745 | Marckess | D2 | July 19, 2022, 1:56 a.m. | OK | GNU C++17 | TESTS | 67 | 343 | 1228800 | ||
164836027 | tykkipeli | D2 | July 19, 2022, 2:26 a.m. | OK | GNU C++17 | TESTS | 67 | 358 | 3584000 | ||
164802591 | RandomLB | D2 | July 18, 2022, 5:58 p.m. | OK | GNU C++17 | TESTS | 67 | 373 | 2150400 | ||
164811431 | _Cade_ | D2 | July 18, 2022, 7:28 p.m. | OK | GNU C++17 | TESTS | 67 | 389 | 1228800 | ||
164846734 | X_o_r | D2 | July 19, 2022, 4:56 a.m. | OK | GNU C++17 | TESTS | 67 | 405 | 819200 | ||
164808611 | bashkort | D2 | July 18, 2022, 6:56 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 343 | 819200 | ||
164802493 | Kude | D2 | July 18, 2022, 5:57 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 358 | 921600 | ||
164825478 | Franchesco_virgoliniiii | D2 | July 18, 2022, 11:16 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 373 | 921600 | ||
164828897 | xcyle | D2 | July 19, 2022, 12:43 a.m. | OK | GNU C++17 (64) | TESTS | 67 | 468 | 1638400 | ||
164807259 | kexy | D2 | July 18, 2022, 6:42 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 608 | 5939200 | ||
164800449 | huangxiaohua | D2 | July 18, 2022, 5:41 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 608 | 7577600 | ||
164814746 | Dio707 | D2 | July 18, 2022, 8:04 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 639 | 5632000 | ||
164816556 | Dio707 | D2 | July 18, 2022, 8:27 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 639 | 5632000 | ||
164807329 | kexy | D2 | July 18, 2022, 6:42 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 639 | 5939200 | ||
164800310 | huangxiaohua | D2 | July 18, 2022, 5:40 p.m. | OK | GNU C++17 (64) | TESTS | 67 | 639 | 7577600 | ||
164798257 | Gurban | D2 | July 18, 2022, 5:28 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 234 | 819200 | ||
164789944 | ytkn | D2 | July 18, 2022, 4:26 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 234 | 819200 | ||
164798021 | Prince_Kassad | D2 | July 18, 2022, 5:27 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 234 | 7680000 | ||
164797380 | kshitij_sodani | D2 | July 18, 2022, 5:25 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 265 | 1228800 | ||
164808757 | Alfeh | D2 | July 18, 2022, 6:58 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 373 | 1331200 | ||
164804191 | fvogel | D2 | July 18, 2022, 6:12 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 405 | 409600 | ||
164830606 | ttbaodl | D2 | July 19, 2022, 1:13 a.m. | OK | GNU C++20 (64) | TESTS | 67 | 405 | 819200 | ||
164798685 | _Enigma__ | D2 | July 18, 2022, 5:30 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 420 | 1536000 | ||
164787987 | vipjml | D2 | July 18, 2022, 4:21 p.m. | OK | GNU C++20 (64) | TESTS | 67 | 452 | 1638400 | ||
164843274 | yangster67 | D2 | July 19, 2022, 4:01 a.m. | OK | GNU C++20 (64) | TESTS | 67 | 468 | 716800 | ||
164847413 | dzhi | D2 | July 19, 2022, 5:06 a.m. | OK | Java 11 | TESTS | 67 | 1045 | 7475200 | ||
164803197 | Dukkha | D2 | July 18, 2022, 6:03 p.m. | OK | Java 17 | TESTS | 67 | 1388 | 819200 | ||
164843032 | freehandle | D2 | July 19, 2022, 3:57 a.m. | OK | Java 17 | TESTS | 67 | 3244 | 11468800 | ||
164798103 | machine_solution | D2 | July 18, 2022, 5:27 p.m. | OK | MS C++ 2017 | TESTS | 67 | 2354 | 1740800 | ||
164847210 | CAELO | D2 | July 19, 2022, 5:03 a.m. | OK | PyPy 3-64 | TESTS | 67 | 3072 | 14028800 | ||
164831812 | bjin | D2 | July 19, 2022, 1:31 a.m. | OK | Rust 2021 | TESTS | 67 | 967 | 409600 | ||
164831559 | bjin | D2 | July 19, 2022, 1:27 a.m. | OK | Rust 2021 | TESTS | 67 | 1060 | 819200 |
Back to search problems