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 93897899 Nov. 26, 2021, 11:15 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 19613 ) B Divan and a New Project PROGRAMMING constructive algorithms sortings 1000

B'The company "Divan 's Sofas" is planning to build n + 1 different buildings on a coordinate line so that: Let x_i be the coordinate of the i -th building. To get from the building i to the building j , Divan spends |x_i - x_j| minutes, where |y| is the absolute value of y . All buildings that Divan is going to build can be numbered from 0 to n . The businessman will live in the building 0 , the new headquarters of "Divan 's Sofas". In the first ten years after construction Divan will visit the i -th building a_i times, each time spending 2 cdot |x_0-x_i| minutes for walking. Divan asks you to choose the coordinates for all n + 1 buildings so that over the next ten years the businessman will spend as little time for walking as possible. Each test contains several test cases. The first line contains one integer number t ( 1 <= t <= 10^3 ) -- the number of test cases. The first line of each case contains an integer n ( 1 <= n <= 2 cdot 10^5 ) -- the number of buildings that "Divan 's Sofas" is going to build, apart from the headquarters. The second line contains the sequence a_1, a_2, ldots, a_n ( 0 <= a_i <= 10^6 ), where a_i is the number of visits to the i -th building. It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, on the first line print the number T -- the minimum time Divan will spend walking. On the second line print the sequence x_0, x_1, ldots, x_n of n + 1 integers, where x_i ( -10^6 <= x_i <= 10^6 ) is the selected coordinate of the i -th building. It can be shown that an optimal answer exists with coordinates not exceeding 10^6 . If there are multiple answers, print any of them. Let 's look at the first example. Divan will visit the first building a_1 = 1 times, the second a_2 = 2 times and th'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
137072815 gxlois B Nov. 26, 2021, 9:48 p.m. OK D TESTS 11 140 6144000 1000
137064538 Aditi_ag B Nov. 26, 2021, 6:34 p.m. OK GNU C11 TESTS 11 857 7987200 1000
137067375 Iizshit B Nov. 26, 2021, 7:26 p.m. OK GNU C11 TESTS 11 919 4812800 1000
137029712 Lao_Nan_Ren B Nov. 26, 2021, 12:50 p.m. OK GNU C11 TESTS 11 951 4812800 1000
137080475 XyzL B Nov. 27, 2021, 2:53 a.m. OK GNU C++14 TESTS 11 46 13209600 1000
137079636 ticmis B Nov. 27, 2021, 2:34 a.m. OK GNU C++14 TESTS 11 61 5324800 1000
137029266 ClCN B Nov. 26, 2021, 12:48 p.m. OK GNU C++14 TESTS 11 62 5324800 1000
137050785 Lev2131 B Nov. 26, 2021, 3:18 p.m. OK GNU C++14 TESTS 11 78 5017600 1000
137075456 linlc B Nov. 27, 2021, 12:03 a.m. OK GNU C++14 TESTS 11 78 11980800 1000
137048473 r_aj1_23 B Nov. 26, 2021, 2:53 p.m. OK GNU C++14 TESTS 11 93 2355200 1000
137045344 Abdelrahman_Etman B Nov. 26, 2021, 2:22 p.m. OK GNU C++14 TESTS 11 93 2355200 1000
137060332 yhhuang B Nov. 26, 2021, 5:28 p.m. OK GNU C++14 TESTS 11 93 2355200 1000
137085583 gagan_ B Nov. 27, 2021, 4:38 a.m. OK GNU C++14 TESTS 11 93 2457600 1000
137079772 XueYJ B Nov. 27, 2021, 2:37 a.m. OK GNU C++14 TESTS 11 93 2457600 1000
137053110 UltraInstinct2355 B Nov. 26, 2021, 3:49 p.m. OK GNU C++17 TESTS 11 78 3174400 1000
137059941 Arthur_Lobo B Nov. 26, 2021, 5:23 p.m. OK GNU C++17 TESTS 11 78 3788800 1000
137060289 penguinhacker B Nov. 26, 2021, 5:27 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137053244 p0BEDA B Nov. 26, 2021, 3:51 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137050013 sahil16082001 B Nov. 26, 2021, 3:10 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137046868 mo3amed_Alaa B Nov. 26, 2021, 2:36 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137045102 b4nd1t.exe B Nov. 26, 2021, 2:20 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137061370 gauss2718281 B Nov. 26, 2021, 5:43 p.m. OK GNU C++17 TESTS 11 93 2355200 1000
137076251 loymyppm B Nov. 27, 2021, 12:44 a.m. OK GNU C++17 TESTS 11 93 2355200 1000
137078212 Alexandria B Nov. 27, 2021, 1:57 a.m. OK GNU C++17 TESTS 11 93 2355200 1000
137085908 no_words_to_sky B Nov. 27, 2021, 4:43 a.m. OK GNU C++17 (64) TESTS 11 62 2457600 1000
137073029 Mostafa_Moharram B Nov. 26, 2021, 9:56 p.m. OK GNU C++17 (64) TESTS 11 62 2457600 1000
137036944 akshatbhutra B Nov. 26, 2021, 1:11 p.m. OK GNU C++17 (64) TESTS 11 62 2457600 1000
137090805 harshavardhan0512 B Nov. 27, 2021, 5:48 a.m. OK GNU C++17 (64) TESTS 11 62 4300800 1000
137064174 i_love_vanshita B Nov. 26, 2021, 6:27 p.m. OK GNU C++17 (64) TESTS 11 62 4812800 1000
137081197 surya_kant B Nov. 27, 2021, 3:09 a.m. OK GNU C++17 (64) TESTS 11 62 6451200 1000
137056569 binary1011 B Nov. 26, 2021, 4:34 p.m. OK GNU C++17 (64) TESTS 11 62 7372800 1000
137031438 Spartanlord B Nov. 26, 2021, 12:55 p.m. OK GNU C++17 (64) TESTS 11 77 2355200 1000
137087609 Akib_12 B Nov. 27, 2021, 5:08 a.m. OK GNU C++17 (64) TESTS 11 77 2457600 1000
137089739 AFOier B Nov. 27, 2021, 5:35 a.m. OK GNU C++17 (64) TESTS 11 77 2457600 1000
137048916 Demotivated B Nov. 26, 2021, 2:57 p.m. OK GNU C++20 (64) TESTS 11 46 2457600 1000
137043294 Isshiki_Iroha_ B Nov. 26, 2021, 2:03 p.m. OK GNU C++20 (64) TESTS 11 46 2867200 1000
137045309 _ifahim1000_ B Nov. 26, 2021, 2:22 p.m. OK GNU C++20 (64) TESTS 11 46 4198400 1000
137041269 present_sir B Nov. 26, 2021, 1:52 p.m. OK GNU C++20 (64) TESTS 11 46 4812800 1000
137063355 Sprdalo B Nov. 26, 2021, 6:13 p.m. OK GNU C++20 (64) TESTS 11 46 4812800 1000
137068161 Bench0310 B Nov. 26, 2021, 7:43 p.m. OK GNU C++20 (64) TESTS 11 61 2457600 1000
137088570 sjc061031 B Nov. 27, 2021, 5:21 a.m. OK GNU C++20 (64) TESTS 11 61 2457600 1000
137086271 StRabbit B Nov. 27, 2021, 4:49 a.m. OK GNU C++20 (64) TESTS 11 61 3993600 1000
137076681 Nea1 B Nov. 27, 2021, 1:02 a.m. OK GNU C++20 (64) TESTS 11 61 3993600 1000
137043777 smrandom B Nov. 26, 2021, 2:07 p.m. OK GNU C++20 (64) TESTS 11 61 4198400 1000
137080008 graceoflives B Nov. 27, 2021, 2:42 a.m. OK Go TESTS 11 296 11571200 1000
137091143 souvik2000 B Nov. 27, 2021, 5:52 a.m. OK Java 11 TESTS 11 202 0 1000
137090039 SavageClown007 B Nov. 27, 2021, 5:38 a.m. OK Java 11 TESTS 11 280 0 1000
137046634 ayush__1411 B Nov. 26, 2021, 2:34 p.m. OK Java 11 TESTS 11 296 1228800 1000
137045393 dheerajchhatanidc B Nov. 26, 2021, 2:23 p.m. OK Java 11 TESTS 11 311 102400 1000
137091723 solo07 B Nov. 27, 2021, 5:59 a.m. OK Java 11 TESTS 11 311 3276800 1000
137090124 Toinfinity B Nov. 27, 2021, 5:39 a.m. OK Java 11 TESTS 11 326 4812800 1000
137034270 future_me B Nov. 26, 2021, 1:04 p.m. OK Java 11 TESTS 11 327 102400 1000
137042600 cavadM B Nov. 26, 2021, 1:59 p.m. OK Java 11 TESTS 11 327 204800 1000
137045231 MrBruh420 B Nov. 26, 2021, 2:21 p.m. OK Java 11 TESTS 11 327 4505600 1000
137043189 dark_rays B Nov. 26, 2021, 2:02 p.m. OK Java 11 TESTS 11 342 716800 1000
137055351 Embrion_top B Nov. 26, 2021, 4:18 p.m. OK Java 8 TESTS 11 218 2764800 1000
137081274 Tourist_ka_baap777 B Nov. 27, 2021, 3:11 a.m. OK Java 8 TESTS 11 248 2764800 1000
137060528 twoBit B Nov. 26, 2021, 5:31 p.m. OK Java 8 TESTS 11 249 3788800 1000
137061600 akshaygupta26 B Nov. 26, 2021, 5:46 p.m. OK Java 8 TESTS 11 249 4608000 1000
137056900 smahajan54842 B Nov. 26, 2021, 4:39 p.m. OK Java 8 TESTS 11 280 3379200 1000
137062135 g906360 B Nov. 26, 2021, 5:54 p.m. OK Java 8 TESTS 11 295 3379200 1000
137066692 gagan_6730 B Nov. 26, 2021, 7:12 p.m. OK Java 8 TESTS 11 295 11468800 1000
137055162 akshit09 B Nov. 26, 2021, 4:16 p.m. OK Java 8 TESTS 11 296 8704000 1000
137041890 Hasib_Ullah B Nov. 26, 2021, 1:55 p.m. OK Java 8 TESTS 11 311 3276800 1000
137041570 Hasib_Ullah B Nov. 26, 2021, 1:53 p.m. OK Java 8 TESTS 11 311 15257600 1000
137066362 abdelrahman_rashed B Nov. 26, 2021, 7:06 p.m. OK MS C++ 2017 TESTS 11 155 2457600 1000
137030674 Iorz B Nov. 26, 2021, 12:53 p.m. OK MS C++ 2017 TESTS 11 156 3174400 1000
137069710 dino_merlin B Nov. 26, 2021, 8:18 p.m. OK MS C++ 2017 TESTS 11 295 3993600 1000
137035115 Rivennnnnnnnn B Nov. 26, 2021, 1:06 p.m. OK MS C++ 2017 TESTS 11 311 4812800 1000
137030894 Kevin_niuniu B Nov. 26, 2021, 12:53 p.m. OK MS C++ 2017 TESTS 11 311 7168000 1000
137048841 FLself B Nov. 26, 2021, 2:57 p.m. OK MS C++ 2017 TESTS 11 312 4812800 1000
137047587 okuri B Nov. 26, 2021, 2:44 p.m. OK MS C++ 2017 TESTS 11 312 5939200 1000
137052346 HBLAI B Nov. 26, 2021, 3:38 p.m. OK MS C++ 2017 TESTS 11 327 2457600 1000
137033863 2052036376 B Nov. 26, 2021, 1:03 p.m. OK MS C++ 2017 TESTS 11 327 9625600 1000
137080179 weisengeng B Nov. 27, 2021, 2:47 a.m. OK MS C++ 2017 TESTS 11 327 33075200 1000
137074616 TribalGolem B Nov. 26, 2021, 11:15 p.m. OK PyPy 2 TESTS 11 717 18329600 1000
137068638 xyxoro B Nov. 26, 2021, 7:53 p.m. OK PyPy 3 TESTS 11 483 31539200 1000
137061115 hxu10 B Nov. 26, 2021, 5:40 p.m. OK PyPy 3 TESTS 11 654 47104000 1000
137046536 hxu10 B Nov. 26, 2021, 2:33 p.m. OK PyPy 3 TESTS 11 701 46182400 1000
137048901 isshiki_ot B Nov. 26, 2021, 2:57 p.m. OK PyPy 3 TESTS 11 732 33792000 1000
137032813 yashwanthreddy909 B Nov. 26, 2021, 12:59 p.m. OK PyPy 3 TESTS 11 764 34099200 1000
137036673 midsho B Nov. 26, 2021, 1:10 p.m. OK PyPy 3 TESTS 11 779 28057600 1000
137032395 Aragorn8037 B Nov. 26, 2021, 12:58 p.m. OK PyPy 3 TESTS 11 795 38502400 1000
137083453 xqc0w B Nov. 27, 2021, 3:58 a.m. OK PyPy 3 TESTS 11 811 28262400 1000
137030323 crvscrx B Nov. 26, 2021, 12:52 p.m. OK PyPy 3 TESTS 11 826 26726400 1000
137028707 avkonyahin B Nov. 26, 2021, 12:47 p.m. OK PyPy 3 TESTS 11 826 31027200 1000
137057430 mesa3993 B Nov. 26, 2021, 4:48 p.m. OK PyPy 3-64 TESTS 11 483 25292800 1000
137067322 kl.nei B Nov. 26, 2021, 7:25 p.m. OK PyPy 3-64 TESTS 11 545 28057600 1000
137050131 mesa3993 B Nov. 26, 2021, 3:11 p.m. OK PyPy 3-64 TESTS 11 561 33587200 1000
137050544 mesa3993 B Nov. 26, 2021, 3:16 p.m. OK PyPy 3-64 TESTS 11 592 33587200 1000
137049901 mesa3993 B Nov. 26, 2021, 3:08 p.m. OK PyPy 3-64 TESTS 11 592 33587200 1000
137048153 mesa3993 B Nov. 26, 2021, 2:50 p.m. OK PyPy 3-64 TESTS 11 607 25702400 1000
137069972 freakbuoyancy B Nov. 26, 2021, 8:25 p.m. OK PyPy 3-64 TESTS 11 608 32460800 1000
137048818 mesa3993 B Nov. 26, 2021, 2:57 p.m. OK PyPy 3-64 TESTS 11 623 33587200 1000
137048373 mesa3993 B Nov. 26, 2021, 2:52 p.m. OK PyPy 3-64 TESTS 11 624 35020800 1000
137047994 mesa3993 B Nov. 26, 2021, 2:48 p.m. OK PyPy 3-64 TESTS 11 639 35123200 1000
137068692 xyxoro B Nov. 26, 2021, 7:55 p.m. OK Python 3 TESTS 11 358 30822400 1000
137081273 ssstier B Nov. 27, 2021, 3:11 a.m. OK Python 3 TESTS 11 514 32256000 1000
137029486 Dethada B Nov. 26, 2021, 12:49 p.m. OK Python 3 TESTS 11 576 34201600 1000
137084346 eugalt B Nov. 27, 2021, 4:17 a.m. OK Python 3 TESTS 11 639 28876800 1000
137084839 eugalt B Nov. 27, 2021, 4:26 a.m. OK Python 3 TESTS 11 655 28876800 1000
137054893 achrafb.s2015 B Nov. 26, 2021, 4:13 p.m. OK Python 3 TESTS 11 670 17817600 1000
137032019 Yusif B Nov. 26, 2021, 12:57 p.m. OK Python 3 TESTS 11 701 29798400 1000
137085215 Tanish08 B Nov. 27, 2021, 4:32 a.m. OK Python 3 TESTS 11 717 32358400 1000
137042799 eugalt B Nov. 26, 2021, 2 p.m. OK Python 3 TESTS 11 732 28876800 1000
137084640 eugalt B Nov. 27, 2021, 4:22 a.m. OK Python 3 TESTS 11 763 28876800 1000
137049068 Spheniscine B Nov. 26, 2021, 2:59 p.m. OK Rust TESTS 11 46 9113600 1000

remove filters

Back to search problems