Codeforces Round 631 (Div. 1) - Thanks, Denis aramis Shitov!

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
1329 Codeforces Round 631 (Div. 1) - Thanks, Denis aramis Shitov! FINISHED False 7200 151428311 April 3, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1723 ) C Drazil Likes Heap PROGRAMMING constructive algorithms data structures greedy implementation sortings 2400

B"Drazil likes heap very much. So he created a problem with heap: There is a max heap with a height h implemented on the array. The details of this heap are the following: This heap contains exactly 2^h - 1 distinct positive non-zero integers. All integers are distinct. These numbers are stored in the array a indexed from 1 to 2^h-1 . For any 1 < i < 2^h , a[i] < a[ <= ft lfloor{ frac{i}{2}} right rfloor] . Now we want to reduce the height of this heap such that the height becomes g with exactly 2^g-1 numbers in heap. To reduce the height, we should perform the following action 2^h-2^g times: Choose an index i , which contains an element and call the following function f in index i : Note that we suppose that if a[i]=0 , then index i don't contain an element. After all operations, the remaining 2^g-1 element must be located in indices from 1 to 2^g-1 . Now Drazil wonders what's the minimum possible sum of the remaining 2^g-1 elements. Please find this sum and find a sequence of the function calls to achieve this value. The first line of the input contains an integer t ( 1 <= q t <= q 70 ,000 ): the number of test cases. Each test case contain two lines. The first line contains two integers h and g ( 1 <= q g < h <= q 20 ). The second line contains n = 2^h-1 distinct positive integers a[1], a[2], ldots, a[n] ( 1 <= q a[i] < 2^{20} ). For all i from 2 to 2^h - 1 , a[i] < a[ <= ft lfloor{ frac{i}{2}} right rfloor] . The total sum of n is less than 2^{20} . For each test case, print two lines. The first line should contain one integer denoting the minimum sum after reducing the height of heap to g . The second line should contain 2^h - 2^g integers v_1, v_2, ldots, v_{2^h-2^g} . In i -th operation f(v_i) should be called. "...

Tutorials

Codeforces Round #631 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
75375276 Gassa C April 3, 2020, 3:12 p.m. OK D TESTS 70 780 19763200 2400
75950920 BF666 C April 9, 2020, 4:55 a.m. OK GNU C++11 TESTS 70 312 16793600 2400
75435894 LJC00118 C April 3, 2020, 8:42 p.m. OK GNU C++11 TESTS 70 327 23142400 2400
75778994 ACMonster C April 7, 2020, 7:06 p.m. OK GNU C++11 TESTS 70 358 14745600 2400
75374787 FizzyDavid C April 3, 2020, 3:11 p.m. OK GNU C++11 TESTS 70 358 14848000 2400
75411322 xgcxgc C April 3, 2020, 4:29 p.m. OK GNU C++11 TESTS 70 373 14745600 2400
75388151 ouuan C April 3, 2020, 3:38 p.m. OK GNU C++11 TESTS 70 374 10547200 2400
76323603 echo7919 C April 12, 2020, 12:20 p.m. OK GNU C++11 TESTS 70 405 38092800 2400
75636532 NewSession C April 6, 2020, 8:11 a.m. OK GNU C++11 TESTS 70 421 8704000 2400
75762085 cmwqf C April 7, 2020, 3:46 p.m. OK GNU C++11 TESTS 70 421 23142400 2400
75637988 caidzh C April 6, 2020, 8:33 a.m. OK GNU C++11 TESTS 70 421 48332800 2400
75558411 txingml C April 5, 2020, 10:36 a.m. OK GNU C++14 TESTS 70 420 10649600 2400
75558575 txingml C April 5, 2020, 10:38 a.m. OK GNU C++14 TESTS 70 421 10649600 2400
75533082 Bekh C April 5, 2020, 4:26 a.m. OK GNU C++14 TESTS 70 467 8396800 2400
75446576 ccf_n0i C April 4, 2020, 1:29 a.m. OK GNU C++14 TESTS 70 467 23142400 2400
75459411 QAQAutoMaton C April 4, 2020, 6:30 a.m. OK GNU C++14 TESTS 70 467 37888000 2400
75387049 yhx-12243 C April 3, 2020, 3:36 p.m. OK GNU C++14 TESTS 70 499 9523200 2400
75422780 Merkurev C April 3, 2020, 6:09 p.m. OK GNU C++14 TESTS 70 499 38400000 2400
75402331 astrom.lars C April 3, 2020, 4:09 p.m. OK GNU C++14 TESTS 70 514 10547200 2400
75378362 tlwpdus C April 3, 2020, 3:18 p.m. OK GNU C++14 TESTS 70 514 21094400 2400
75389593 Nikitosh C April 3, 2020, 3:41 p.m. OK GNU C++14 TESTS 70 514 31539200 2400
75380519 LayCurse C April 3, 2020, 3:22 p.m. OK GNU C++17 TESTS 70 311 22118400 2400
75410471 KADR C April 3, 2020, 4:27 p.m. OK GNU C++17 TESTS 70 358 24678400 2400
75461956 lqs2015 C April 4, 2020, 7:06 a.m. OK GNU C++17 TESTS 70 421 53452800 2400
75668942 Lucina C April 6, 2020, 3:07 p.m. OK GNU C++17 TESTS 70 467 8396800 2400
75399057 saketh C April 3, 2020, 4:02 p.m. OK GNU C++17 TESTS 70 467 10649600 2400
75539433 HNO2 C April 5, 2020, 6:30 a.m. OK GNU C++17 TESTS 70 467 64204800 2400
75404522 Vedensky C April 3, 2020, 4:14 p.m. OK GNU C++17 TESTS 70 483 10547200 2400
75400583 IPL C April 3, 2020, 4:05 p.m. OK GNU C++17 TESTS 70 483 16793600 2400
75447438 Arpa C April 4, 2020, 1:57 a.m. OK GNU C++17 TESTS 70 499 14745600 2400
75527281 Benq C April 5, 2020, 12:58 a.m. OK GNU C++17 TESTS 70 514 14745600 2400
75518998 KADR C April 4, 2020, 8:23 p.m. OK GNU C++17 (64) TESTS 70 280 25702400 2400
75387143 dorijanlendvaj C April 3, 2020, 3:36 p.m. OK GNU C++17 (64) TESTS 70 405 9932800 2400
76431990 tyler C April 12, 2020, 9:39 p.m. OK GNU C++17 (64) TESTS 70 421 17817600 2400
75391273 ksun48 C April 3, 2020, 3:45 p.m. OK GNU C++17 (64) TESTS 70 451 16998400 2400
75381813 ecnerwala C April 3, 2020, 3:25 p.m. OK GNU C++17 (64) TESTS 70 452 131379200 2400
75590492 Furthermost C April 5, 2020, 4:55 p.m. OK GNU C++17 (64) TESTS 70 467 20889600 2400
75591166 Furthermost C April 5, 2020, 5:03 p.m. OK GNU C++17 (64) TESTS 70 483 21094400 2400
76331662 ANAMiya.wanted C April 12, 2020, 1:44 p.m. OK GNU C++17 (64) TESTS 70 499 12697600 2400
76330064 ANAMiya.wanted C April 12, 2020, 1:29 p.m. OK GNU C++17 (64) TESTS 70 514 12697600 2400
76014337 Felerius C April 9, 2020, 4:29 p.m. OK GNU C++17 (64) TESTS 70 514 15872000 2400
75383247 uwi C April 3, 2020, 3:28 p.m. OK Java 11 TESTS 70 686 6041600 2400
75421882 Lewin C April 3, 2020, 6:02 p.m. OK Java 11 TESTS 70 701 10444800 2400
75419418 Musin C April 3, 2020, 5:44 p.m. OK Java 11 TESTS 70 1184 65126400 2400
75421392 Suzukaze C April 3, 2020, 5:58 p.m. OK Java 11 TESTS 70 1247 97894400 2400
75401628 mikit C April 3, 2020, 4:07 p.m. OK Java 11 TESTS 70 1309 78028800 2400
75418035 Suzukaze C April 3, 2020, 5:36 p.m. OK Java 11 TESTS 70 1388 95436800 2400
75401468 Suzukaze C April 3, 2020, 4:07 p.m. OK Java 11 TESTS 70 1450 95436800 2400
75419374 Suzukaze C April 3, 2020, 5:44 p.m. OK Java 11 TESTS 70 1497 97484800 2400
75407626 cwise C April 3, 2020, 4:21 p.m. OK Java 8 TESTS 70 686 80076800 2400
75408773 martins C April 3, 2020, 4:24 p.m. OK Java 8 TESTS 70 763 57344000 2400
75411523 Jeel_Vaishnav C April 3, 2020, 4:30 p.m. OK Java 8 TESTS 70 779 30617600 2400
75432069 danbanica C April 3, 2020, 7:47 p.m. OK Java 8 TESTS 70 779 72294400 2400
75611424 Hemose C April 5, 2020, 10:36 p.m. OK Java 8 TESTS 70 935 74854400 2400
75843206 dg2004 C April 8, 2020, 2:19 p.m. OK Java 8 TESTS 70 1263 41984000 2400
75391925 SecondThread C April 3, 2020, 3:46 p.m. OK Java 8 TESTS 70 1278 83251200 2400
75406194 tomerun C April 3, 2020, 4:18 p.m. OK Java 8 TESTS 70 1356 16384000 2400
75789319 Tomg C April 7, 2020, 10:14 p.m. OK Java 8 TESTS 70 1481 58470400 2400
75444599 darnley C April 4, 2020, 12:18 a.m. OK Kotlin TESTS 70 967 118272000 2400
75444306 darnley C April 4, 2020, 12:09 a.m. OK Kotlin TESTS 70 982 118272000 2400
75444108 darnley C April 4, 2020, 12:02 a.m. OK Kotlin TESTS 70 1341 118272000 2400
75443944 darnley C April 3, 2020, 11:57 p.m. OK Kotlin TESTS 70 1341 118272000 2400
75443536 darnley C April 3, 2020, 11:41 p.m. OK Kotlin TESTS 70 1341 118272000 2400
75443975 darnley C April 3, 2020, 11:58 p.m. OK Kotlin TESTS 70 1356 118272000 2400
75443487 darnley C April 3, 2020, 11:40 p.m. OK Kotlin TESTS 70 1356 118272000 2400
75400771 darnley C April 3, 2020, 4:06 p.m. OK Kotlin TESTS 70 1372 118272000 2400
75444212 darnley C April 4, 2020, 12:06 a.m. OK Kotlin TESTS 70 1372 118886400 2400
75443328 darnley C April 3, 2020, 11:34 p.m. OK Kotlin TESTS 70 1387 118272000 2400
75436101 lxhgww C April 3, 2020, 8:46 p.m. OK MS C++ TESTS 70 546 13619200 2400
75411727 math957963 C April 3, 2020, 4:30 p.m. OK MS C++ TESTS 70 670 199577600 2400
75397377 pichulia C April 3, 2020, 3:58 p.m. OK MS C++ 2017 TESTS 70 1325 33689600 2400
75418122 nagiss C April 3, 2020, 5:36 p.m. OK PyPy 3 TESTS 70 1247 98304000 2400
75792903 sansen C April 8, 2020, 12:16 a.m. OK Rust TESTS 70 686 40550400 2400

remove filters

Back to search problems