Codeforces Round 757 (Div. 2)

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
1614 Codeforces Round 757 (Div. 2) FINISHED False 7200 99341063 Nov. 26, 2021, 11:15 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2428 ) D2 Divan and Kostomuksha (hard version) PROGRAMMING dp number theory 2300

B"This is the hard version of the problem. The only difference is maximum value of a_i . Once in Kostomuksha Divan found an array a consisting of positive integers. Now he wants to reorder the elements of a to maximize the value of the following function: sum_{i=1}^n operatorname{gcd}(a_1, , a_2, , ... , , a_i), where operatorname{gcd}(x_1, x_2, ldots, x_k) denotes the greatest common divisor of integers x_1, x_2, ldots, x_k , and operatorname{gcd}(x) = x for any integer x . Reordering elements of an array means changing the order of elements in the array arbitrary, or leaving the initial order. Of course, Divan can solve this problem. However, he found it interesting, so he decided to share it with you. The first line contains a single integer n ( 1 <= q n <= q 10^5 ) -- the size of the array a . The second line contains n integers a_{1}, , a_{2}, , ... , , a_{n} ( 1 <= a_{i} <= 2 cdot 10^7 ) -- the array a . Output the maximum value of the function that you can get by reordering elements of the array a . In the first example, it's optimal to rearrange the elements of the given array in the following order: [6, , 2, , 2, , 2, , 3, , 1] : operatorname{gcd}(a_1) + operatorname{gcd}(a_1, , a_2) + operatorname{gcd}(a_1, , a_2, , a_3) + operatorname{gcd}(a_1, , a_2, , a_3, , a_4) + operatorname{gcd}(a_1, , a_2, , a_3, , a_4, , a_5) + operatorname{gcd}(a_1, , a_2, , a_3, , a_4, , a_5, , a_6) = 6 + 2 + 2 + 2 + 1 + 1 = 14. It can be shown that it is impossible to get a better answer. In the second example, it's optimal to rearrange the elements of a given array in the following order: [100, , 10, , 10, , 5, , 1, , 3, , 3, , 7, , 42, , 54] . "...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
137088684 _Fake4Fun D2 Nov. 27, 2021, 5:22 a.m. OK GNU C++14 TESTS 46 951 333721600 2300
137037068 toilanvd_HUST D2 Nov. 26, 2021, 1:11 p.m. OK GNU C++14 TESTS 43 1138 581939200 2300
137071777 AST_TheCoder D2 Nov. 26, 2021, 9:15 p.m. OK GNU C++14 TESTS 46 1419 652185600 2300
137075501 D_F_S D2 Nov. 27, 2021, 12:06 a.m. OK GNU C++14 TESTS 46 1887 1062092800 2300
137044667 Hoshimi D2 Nov. 26, 2021, 2:16 p.m. OK GNU C++14 TESTS 44 1981 340684800 2300
137029722 KLL D2 Nov. 26, 2021, 12:50 p.m. OK GNU C++14 TESTS 43 2011 341094400 2300
137034606 ykl D2 Nov. 26, 2021, 1:05 p.m. OK GNU C++14 TESTS 43 2012 776294400 2300
137045576 Hoshimi D2 Nov. 26, 2021, 2:24 p.m. OK GNU C++14 TESTS 44 2152 340684800 2300
137049119 Hoshimi D2 Nov. 26, 2021, 3 p.m. OK GNU C++14 TESTS 44 2183 340684800 2300
137086009 Wuyanru D2 Nov. 27, 2021, 4:45 a.m. OK GNU C++14 TESTS 46 2230 340684800 2300
137042489 AvinashKartik D2 Nov. 26, 2021, 1:58 p.m. OK GNU C++17 TESTS 43 717 413491200 2300
137045136 mehtaji D2 Nov. 26, 2021, 2:20 p.m. OK GNU C++17 TESTS 44 842 329728000 2300
137051584 SOSCHINA D2 Nov. 26, 2021, 3:28 p.m. OK GNU C++17 TESTS 44 920 421888000 2300
137033667 NTU_God_Bo D2 Nov. 26, 2021, 1:02 p.m. OK GNU C++17 TESTS 43 935 581939200 2300
137084900 decsp D2 Nov. 27, 2021, 4:27 a.m. OK GNU C++17 TESTS 46 1044 333312000 2300
137048171 zech D2 Nov. 26, 2021, 2:50 p.m. OK GNU C++17 TESTS 44 1045 902963200 2300
137035298 VLamarca D2 Nov. 26, 2021, 1:07 p.m. OK GNU C++17 TESTS 43 1107 576409600 2300
137038292 __Shioko D2 Nov. 26, 2021, 1:14 p.m. OK GNU C++17 TESTS 43 1122 333312000 2300
137074047 tloinuy D2 Nov. 26, 2021, 10:43 p.m. OK GNU C++17 TESTS 46 1263 273510400 2300
137050682 Linqi05 D2 Nov. 26, 2021, 3:17 p.m. OK GNU C++17 TESTS 44 1279 321024000 2300
137042114 LipArcanjo D2 Nov. 26, 2021, 1:56 p.m. OK GNU C++17 (64) TESTS 43 1076 721817600 2300
137042373 Malheiros D2 Nov. 26, 2021, 1:57 p.m. OK GNU C++17 (64) TESTS 43 1091 899788800 2300
137043022 LipArcanjo D2 Nov. 26, 2021, 2:01 p.m. OK GNU C++17 (64) TESTS 43 1263 721817600 2300
137034888 jkjung D2 Nov. 26, 2021, 1:05 p.m. OK GNU C++17 (64) TESTS 43 1340 400896000 2300
137048283 DeepJay D2 Nov. 26, 2021, 2:51 p.m. OK GNU C++17 (64) TESTS 44 1637 561049600 2300
137046805 He_Ren D2 Nov. 26, 2021, 2:36 p.m. OK GNU C++17 (64) TESTS 44 1653 266137600 2300
137049113 DeepJay D2 Nov. 26, 2021, 3 p.m. OK GNU C++17 (64) TESTS 44 1653 561049600 2300
137040749 czswez D2 Nov. 26, 2021, 1:50 p.m. OK GNU C++17 (64) TESTS 43 1684 481382400 2300
137032609 qxforever D2 Nov. 26, 2021, 12:59 p.m. OK GNU C++17 (64) TESTS 43 1747 928972800 2300
137043847 magnified D2 Nov. 26, 2021, 2:07 p.m. OK GNU C++17 (64) TESTS 44 1794 334336000 2300
137048449 PigeonG D2 Nov. 26, 2021, 2:53 p.m. OK GNU C++20 (64) TESTS 44 1325 257536000 2300
137049214 fishcathu. D2 Nov. 26, 2021, 3:01 p.m. OK GNU C++20 (64) TESTS 44 1403 325734400 2300
137051285 Roll_Num_56 D2 Nov. 26, 2021, 3:24 p.m. OK GNU C++20 (64) TESTS 44 1434 849920000 2300
137052319 Frank_ddx D2 Nov. 26, 2021, 3:38 p.m. OK GNU C++20 (64) TESTS 44 1513 354713600 2300
137070934 __Tomek__ D2 Nov. 26, 2021, 8:50 p.m. OK GNU C++20 (64) TESTS 46 1559 401612800 2300
137059008 ftiasch D2 Nov. 26, 2021, 5:10 p.m. OK GNU C++20 (64) TESTS 46 1575 334745600 2300
137038427 NTU_Rev D2 Nov. 26, 2021, 1:14 p.m. OK GNU C++20 (64) TESTS 43 1622 668876800 2300
137077385 4Ever11Prime D2 Nov. 27, 2021, 1:29 a.m. OK GNU C++20 (64) TESTS 46 1668 250675200 2300
137046803 fishcathu. D2 Nov. 26, 2021, 2:36 p.m. OK GNU C++20 (64) TESTS 44 1669 325734400 2300
137059791 fishcathu. D2 Nov. 26, 2021, 5:21 p.m. OK GNU C++20 (64) TESTS 46 1684 274227200 2300
137082215 0x3F D2 Nov. 27, 2021, 3:31 a.m. OK Go TESTS 46 1310 346214400 2300
137082315 0x3F D2 Nov. 27, 2021, 3:33 a.m. OK Go TESTS 46 1403 346316800 2300
137090247 0x3F D2 Nov. 27, 2021, 5:41 a.m. OK Go TESTS 46 1465 346316800 2300
137082143 0x3F D2 Nov. 27, 2021, 3:29 a.m. OK Go TESTS 46 2027 669081600 2300
137081882 0x3F D2 Nov. 27, 2021, 3:24 a.m. OK Go TESTS 46 2058 669081600 2300
137037859 LXl491214 D2 Nov. 26, 2021, 1:13 p.m. OK MS C++ 2017 TESTS 43 3385 324608000 2300
137077121 OLOGY D2 Nov. 27, 2021, 1:20 a.m. OK PyPy 2 TESTS 46 1965 656076800 2300
137069524 OLOGY D2 Nov. 26, 2021, 8:13 p.m. OK PyPy 2 TESTS 46 2293 656076800 2300
137067870 OLOGY D2 Nov. 26, 2021, 7:37 p.m. OK PyPy 2 TESTS 46 2433 656076800 2300
137077197 OLOGY D2 Nov. 27, 2021, 1:23 a.m. OK PyPy 2 TESTS 46 2448 655769600 2300
137068617 OLOGY D2 Nov. 26, 2021, 7:53 p.m. OK PyPy 2 TESTS 46 2448 656076800 2300
137073195 OLOGY D2 Nov. 26, 2021, 10:03 p.m. OK PyPy 2 TESTS 46 2464 656076800 2300
137069490 OLOGY D2 Nov. 26, 2021, 8:12 p.m. OK PyPy 2 TESTS 46 2464 656076800 2300
137068643 OLOGY D2 Nov. 26, 2021, 7:53 p.m. OK PyPy 2 TESTS 46 2464 656076800 2300
137067920 OLOGY D2 Nov. 26, 2021, 7:38 p.m. OK PyPy 2 TESTS 46 2667 549683200 2300
137066101 OLOGY D2 Nov. 26, 2021, 7:01 p.m. OK PyPy 2 TESTS 46 2729 326041600 2300
137042603 toam D2 Nov. 26, 2021, 1:59 p.m. OK PyPy 3 TESTS 43 2121 651161600 2300
137048969 toam D2 Nov. 26, 2021, 2:58 p.m. OK PyPy 3 TESTS 44 2339 651161600 2300
137075151 hxu10 D2 Nov. 26, 2021, 11:46 p.m. OK PyPy 3 TESTS 46 3119 651059200 2300
137076529 whatshisbucket D2 Nov. 27, 2021, 12:56 a.m. OK PyPy 3 TESTS 46 3244 660172800 2300
137077240 whatshisbucket D2 Nov. 27, 2021, 1:24 a.m. OK PyPy 3 TESTS 46 3463 656691200 2300
137077612 whatshisbucket D2 Nov. 27, 2021, 1:37 a.m. OK PyPy 3 TESTS 46 3509 656588800 2300
137077532 whatshisbucket D2 Nov. 27, 2021, 1:35 a.m. OK PyPy 3 TESTS 46 3681 656691200 2300
137076885 whatshisbucket D2 Nov. 27, 2021, 1:11 a.m. OK PyPy 3 TESTS 46 3743 660172800 2300
137076900 whatshisbucket D2 Nov. 27, 2021, 1:12 a.m. OK PyPy 3 TESTS 46 3775 660377600 2300
137076794 whatshisbucket D2 Nov. 27, 2021, 1:08 a.m. OK PyPy 3 TESTS 46 3899 660070400 2300
137066838 OLOGY D2 Nov. 26, 2021, 7:15 p.m. OK PyPy 3-64 TESTS 46 3135 525209600 2300
137065903 titia D2 Nov. 26, 2021, 6:58 p.m. OK PyPy 3-64 TESTS 46 3790 525414400 2300
137078757 coolstreaming D2 Nov. 27, 2021, 2:11 a.m. OK PyPy 3-64 TESTS 46 3837 498073600 2300
137072604 sansen D2 Nov. 26, 2021, 9:42 p.m. OK Rust TESTS 46 1326 260198400 2300
137072717 sansen D2 Nov. 26, 2021, 9:46 p.m. OK Rust TESTS 46 1419 243404800 2300
137090035 Spheniscine D2 Nov. 27, 2021, 5:38 a.m. OK Rust TESTS 46 1871 419737600 2300
137085675 Spheniscine D2 Nov. 27, 2021, 4:39 a.m. OK Rust TESTS 46 1918 419737600 2300
137085015 Spheniscine D2 Nov. 27, 2021, 4:28 a.m. OK Rust TESTS 46 1996 419737600 2300
137072526 sansen D2 Nov. 26, 2021, 9:39 p.m. OK Rust TESTS 46 2215 260198400 2300

remove filters

Back to search problems