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 |
---|---|---|---|---|---|---|
1699 | Codeforces Round 804 (Div. 2) | FINISHED | False | 7200 | 80321062 | July 4, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1236 ) | E | Three Days Grace | PROGRAMMING | dp math two pointers |
B'Ibti was thinking about a good title for this problem that would fit the round theme (numerus ternarium). He immediately thought about the third derivative, but that was pretty lame so he decided to include the best band in the world -- Three Days Grace. You are given a multiset A with initial size n , whose elements are integers between 1 and m . In one operation, do the following: Note that the size of the multiset A increases by 1 after each operation. We define the balance of the multiset A as max(a_i) - min(a_i) . Find the minimum possible balance after performing any number (possible zero) of operations. The first line of the input contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The second line of each test case contains two integers n and m ( 1 <= n <= 10^6 , 1 <= m <= 5 cdot 10^6 ) -- the initial size of the multiset, and the maximum value of an element. The third line of each test case contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= m ) -- the elements in the initial multiset. It is guaranteed that the sum of n across all test cases does not exceed 10^6 and the sum of m across all test cases does not exceed 5 cdot 10^6 . For each test case, print a single integer -- the minimum possible balance. In the first test case, we can apply the operation on each of the 4 s with (p,q) = (2,2) and make the multiset {2,2,2,2,2,2,2 } with balance max( {2,2,2,2,2,2,2 }) - min( {2,2,2,2,2,2,2 }) = 0 . It is obvious we cannot make this balance less than 0 . In the second test case, we can apply an operation on 12 with (p,q) = (3,4) . After this our multiset will be {3,4,2,3 } . We can make one more operation on 4 with (p,q) = (2,2) , making the multiset {3,2,2,2,3 } with balance equal to 1 . In the third test case, we can a'... |
Codeforces Round #804 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
162804273 | VieisdradMiacul | E | July 4, 2022, 4:23 p.m. | OK | FPC | TESTS | 62 | 2917 | 45158400 | ||
162819595 | Buzhibujue | E | July 4, 2022, 6:44 p.m. | OK | GNU C++14 | TESTS | 64 | 717 | 45056000 | ||
162810850 | CK2021 | E | July 4, 2022, 5:03 p.m. | OK | GNU C++14 | TESTS | 62 | 1092 | 85196800 | ||
162809953 | cunzai_zsy0531 | E | July 4, 2022, 4:57 p.m. | OK | GNU C++14 | TESTS | 62 | 1310 | 47616000 | ||
162844428 | xianggl | E | July 5, 2022, 3:09 a.m. | OK | GNU C++14 | TESTS | 65 | 1325 | 45056000 | ||
162841314 | CrazyTeaMajor | E | July 5, 2022, 2:16 a.m. | OK | GNU C++14 | TESTS | 64 | 1388 | 45056000 | ||
162841967 | liuyaningqwq | E | July 5, 2022, 2:28 a.m. | OK | GNU C++14 | TESTS | 64 | 1482 | 45056000 | ||
162844228 | cryozwq | E | July 5, 2022, 3:06 a.m. | OK | GNU C++14 | TESTS | 65 | 1528 | 130252800 | ||
162842185 | Leasier | E | July 5, 2022, 2:32 a.m. | OK | GNU C++14 | TESTS | 65 | 1559 | 45056000 | ||
162847187 | mananghetia | E | July 5, 2022, 3:52 a.m. | OK | GNU C++14 | TESTS | 65 | 1715 | 60108800 | ||
162823012 | Social_Pointer | E | July 4, 2022, 7:33 p.m. | OK | GNU C++14 | TESTS | 64 | 1793 | 60108800 | ||
162852754 | Bobocan | E | July 5, 2022, 5:28 a.m. | OK | GNU C++17 | TESTS | 65 | 577 | 60518400 | ||
162813450 | fallleaves01 | E | July 4, 2022, 5:30 p.m. | OK | GNU C++17 | TESTS | 63 | 889 | 40755200 | ||
162809769 | whker_kzc | E | July 4, 2022, 4:55 p.m. | OK | GNU C++17 | TESTS | 62 | 889 | 45056000 | ||
162849265 | Awcotn_tct | E | July 5, 2022, 4:31 a.m. | OK | GNU C++17 | TESTS | 65 | 1185 | 40755200 | ||
162813089 | lunchbox | E | July 4, 2022, 5:25 p.m. | OK | GNU C++17 | TESTS | 63 | 1185 | 49561600 | ||
162849153 | Awcotn_tct | E | July 5, 2022, 4:29 a.m. | OK | GNU C++17 | TESTS | 65 | 1232 | 40755200 | ||
162829391 | Milktea6 | E | July 4, 2022, 9:18 p.m. | OK | GNU C++17 | TESTS | 64 | 1341 | 45056000 | ||
162822352 | Ant_Man | E | July 4, 2022, 7:23 p.m. | OK | GNU C++17 | TESTS | 64 | 1388 | 44748800 | ||
162821907 | w-- | E | July 4, 2022, 7:17 p.m. | OK | GNU C++17 | TESTS | 64 | 1434 | 72192000 | ||
162826455 | YaoBIG | E | July 4, 2022, 8:25 p.m. | OK | GNU C++17 | TESTS | 64 | 1481 | 64102400 | ||
162813700 | noimi | E | July 4, 2022, 5:33 p.m. | OK | GNU C++17 (64) | TESTS | 63 | 608 | 60416000 | ||
162835323 | sweetpotato2 | E | July 4, 2022, 11:57 p.m. | OK | GNU C++17 (64) | TESTS | 64 | 654 | 60108800 | ||
162853010 | qxj8k | E | July 5, 2022, 5:32 a.m. | OK | GNU C++17 (64) | TESTS | 65 | 701 | 48742400 | ||
162831086 | Kude | E | July 4, 2022, 9:54 p.m. | OK | GNU C++17 (64) | TESTS | 64 | 717 | 29081600 | ||
162836331 | orzdevinwang | E | July 5, 2022, 12:28 a.m. | OK | GNU C++17 (64) | TESTS | 64 | 748 | 49152000 | ||
162830333 | Kude | E | July 4, 2022, 9:39 p.m. | OK | GNU C++17 (64) | TESTS | 64 | 795 | 178995200 | ||
162813529 | noimi | E | July 4, 2022, 5:31 p.m. | OK | GNU C++17 (64) | TESTS | 63 | 842 | 64102400 | ||
162814572 | neal | E | July 4, 2022, 5:42 p.m. | OK | GNU C++17 (64) | TESTS | 63 | 873 | 40755200 | ||
162814725 | neal | E | July 4, 2022, 5:44 p.m. | OK | GNU C++17 (64) | TESTS | 63 | 982 | 40755200 | ||
162818638 | lunchbox | E | July 4, 2022, 6:31 p.m. | OK | GNU C++17 (64) | TESTS | 64 | 1060 | 60108800 | ||
162820732 | islingr | E | July 4, 2022, 7:02 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 529 | 40755200 | ||
162809445 | SSerxhs | E | July 4, 2022, 4:54 p.m. | OK | GNU C++20 (64) | TESTS | 62 | 560 | 80179200 | ||
162852751 | ftiasch | E | July 5, 2022, 5:28 a.m. | OK | GNU C++20 (64) | TESTS | 65 | 576 | 40755200 | ||
162852253 | ftiasch | E | July 5, 2022, 5:21 a.m. | OK | GNU C++20 (64) | TESTS | 65 | 607 | 40755200 | ||
162832806 | A_G | E | July 4, 2022, 10:39 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 639 | 45056000 | ||
162817184 | Heltion | E | July 4, 2022, 6:14 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 811 | 80179200 | ||
162852065 | ftiasch | E | July 5, 2022, 5:18 a.m. | OK | GNU C++20 (64) | TESTS | 65 | 873 | 40755200 | ||
162816007 | brunovsky | E | July 4, 2022, 5:59 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 873 | 45056000 | ||
162818861 | Tutis | E | July 4, 2022, 6:34 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 935 | 44646400 | ||
162816345 | brunovsky | E | July 4, 2022, 6:04 p.m. | OK | GNU C++20 (64) | TESTS | 64 | 951 | 45056000 | ||
162805926 | SecondThread | E | July 4, 2022, 4:29 p.m. | OK | Java 8 | TESTS | 62 | 2698 | 258867200 | ||
162804059 | 1_2_3_4_5_9 | E | July 4, 2022, 4:22 p.m. | OK | PyPy 2 | TESTS | 62 | 3914 | 149708800 | ||
162821159 | gotcoding124 | E | July 4, 2022, 7:07 p.m. | OK | PyPy 3 | TESTS | 64 | 3540 | 149504000 |
Back to search problems