Kotlin Heroes: Episode 8

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
1571 Kotlin Heroes: Episode 8 FINISHED False 9900 103562663 Oct. 7, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 78 ) G A Battle Against a Dragon PROGRAMMING *special data structures dp

B"A squad of n warriors is defending a castle from a dragon attack. There are m barricades between the castle and the dragon. The warriors are numbered from 1 to n . The i -th warrior knows k_i attacks: the j -th of them deals a_{i,j} damage to the dragon and can only be applied if there are exactly b_{i,j} barricades between the castle and the dragon. The warriors make turns one after another, starting from warrior 1 . After warrior n makes his turn, the total damage to the dragon is calculated. The i -th warrior performs exactly one of three possible moves in his turn: The total damage is the sum of damages dealt by the warriors who chose to deploy their attacks in their turn. What is the maximum total damage the warriors can deal to the dragon? The first line contains two integers n and m ( 1 <= n, m <= 3 cdot 10^5 ) -- the number of warriors and the initial number of barricades. Then the descriptions of attacks for each warrior follow. The i -th description consists of three lines. The first line contains a single integer k_i ( 1 <= k_i <= m + 1 ) -- the number of attacks the i -th warrior knows. The second line contains k_i integers a_{i,1}, a_{i,2}, ... , a_{i,k_i} ( 1 <= a_{i,j} <= 10^9 ) -- the damage of each attack. The third line contains k_i integers b_{i,1}, b_{i,2}, ... , b_{i,k_i} ( 0 <= b_{i,j} <= m ) -- the required number of barricades for each attack. b_{i,j} for the i -th warrior are pairwise distinct. The attacks are listed in the increasing order of the barricades requirement, so b_{i,1} < b_{i,2} < ... < b_{i,k_i} . The sum of k_i over all warriors doesn't exceed 3 cdot 10^5 . Print a single integer -- the maximum total damage the warriors can deal to the dragon. In the first example, the optimal choice is the following: The total damage is 10 . If"...

Tutorials

Kotlin Heroes 8 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
131118499 Spheniscine G Oct. 8, 2021, 5:12 a.m. OK Kotlin 1.4 TESTS 47 374 30412800
131086390 eatmore G Oct. 7, 2021, 3:56 p.m. OK Kotlin 1.4 TESTS 47 405 47411200
131112830 Spheniscine G Oct. 8, 2021, 3 a.m. OK Kotlin 1.4 TESTS 47 420 32153600
131112160 Spheniscine G Oct. 8, 2021, 2:41 a.m. OK Kotlin 1.4 TESTS 47 545 41779200
131089368 wifiiii G Oct. 7, 2021, 4:43 p.m. OK Kotlin 1.4 TESTS 47 545 64102400
131088643 WiwiHo G Oct. 7, 2021, 4:25 p.m. OK Kotlin 1.4 TESTS 47 623 61030400
131119431 elManco G Oct. 8, 2021, 5:29 a.m. OK Kotlin 1.4 TESTS 47 686 56217600
131089558 RSBat G Oct. 7, 2021, 4:50 p.m. OK Kotlin 1.4 TESTS 47 779 60518400
131088335 bicsi G Oct. 7, 2021, 4:17 p.m. OK Kotlin 1.4 TESTS 47 795 60518400
131088700 timmyfeng G Oct. 7, 2021, 4:26 p.m. OK Kotlin 1.4 TESTS 47 826 69529600
131090282 darnley G Oct. 7, 2021, 5:04 p.m. OK Kotlin 1.5 TESTS 47 857 56832000
131084942 Tlatoani G Oct. 7, 2021, 3:42 p.m. OK Kotlin 1.5 TESTS 47 873 54169600
131088859 knightL G Oct. 7, 2021, 4:30 p.m. OK Kotlin 1.5 TESTS 47 935 56832000
131088882 lightseba G Oct. 7, 2021, 4:31 p.m. OK Kotlin 1.5 TESTS 47 935 71782400
131089466 uwi G Oct. 7, 2021, 4:46 p.m. OK Kotlin 1.5 TESTS 47 982 61952000
131091221 darkkcyan G Oct. 7, 2021, 5:15 p.m. OK Kotlin 1.5 TESTS 47 1060 71884800
131105884 darnley G Oct. 7, 2021, 10:12 p.m. OK Kotlin 1.5 TESTS 47 1091 59699200
131089234 arvindf232 G Oct. 7, 2021, 4:39 p.m. OK Kotlin 1.5 TESTS 47 1091 79257600
131088962 Ra16bit G Oct. 7, 2021, 4:33 p.m. OK Kotlin 1.5 TESTS 47 1091 79974400
131089601 freak93 G Oct. 7, 2021, 4:53 p.m. OK Kotlin 1.5 TESTS 47 1231 86630400

remove filters

Back to search problems