Kotlin Heroes: Episode 10

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
1958 Kotlin Heroes: Episode 10 FINISHED False 9000 21569063 May 13, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 81 ) H Composite Spells PROGRAMMING *special dp 2600

B"Monocarp plays a fantasy RPG. His character is a mage, so he casts spells. There are two types of spells he knows -- basic spells and composite spells. There are n basic spells in Monocarp's spell book, numbered from 1 to n . Each basic spell simply changes the health of the target: either decreases it or increases it. The i -th basic spell changes the target's health value by b_i (increases by b_i if b_i is non-negative, or decreases by |b_i| if b_i is negative). If the target's health value goes to 0 or below, it dies, and all next spells cast at it do nothing. There are also m composite spells in the spell book, numbered from n+1 to n+m . Each composite spell is a sequence of other spells, cast in specific order. A composite spell can consist both of basic spells and composite spells; the i -th spell consists of s_i other spells, and each of those spells has index strictly less than i (so there is no situation that composite spells infinitely cast each other). So, actually, each composite spell can be considered a finite sequence of basic spells, although its length might be huge. Note that the same spell can appear in a composite spell multiple times. Monocarp has decided to cast the (n+m) -th spell from his spell book. The target of this spell is a monster with an initial health value of hp . Monocarp wants to know whether the monster will be killed or not, and if it will be killed, which basic spell will kill it. The first line contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. Each test case is given as follows: Additional constraints on the input: For each test case, print one integer: "...

Tutorials

129483

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260835936 WiwiHo H May 13, 2024, 5:12 p.m. OK Kotlin 1.7 TESTS 18 343 1945600 2600
260831063 E869120 H May 13, 2024, 4:31 p.m. OK Kotlin 1.7 TESTS 18 343 7987200 2600
261952428 Au5 H May 21, 2024, 2:35 a.m. OK Kotlin 1.7 TESTS 20 358 22323200 2600
261008149 Aidos H May 15, 2024, 5:56 a.m. OK Kotlin 1.7 TESTS 20 374 5939200 2600
260832133 t0mmyn H May 13, 2024, 4:40 p.m. OK Kotlin 1.7 TESTS 18 374 6246400 2600
260825157 Golovanov399 H May 13, 2024, 3:48 p.m. OK Kotlin 1.7 TESTS 18 374 6246400 2600
260828827 pashka H May 13, 2024, 4:14 p.m. OK Kotlin 1.7 TESTS 18 374 8704000 2600
260834216 Bedge H May 13, 2024, 4:56 p.m. OK Kotlin 1.7 TESTS 18 389 6963200 2600
262021693 Slata H May 21, 2024, 1:06 p.m. OK Kotlin 1.7 TESTS 20 389 7577600 2600
260854175 Nikitosh H May 13, 2024, 8:26 p.m. OK Kotlin 1.7 TESTS 18 390 6144000 2600
260829033 thenymphsofdelphi H May 13, 2024, 4:15 p.m. OK Kotlin 1.9 TESTS 18 156 0 2600
260824985 BucketPotato H May 13, 2024, 3:46 p.m. OK Kotlin 1.9 TESTS 18 171 102400 2600
260980966 dzhi H May 14, 2024, 8:34 p.m. OK Kotlin 1.9 TESTS 20 186 0 2600
260831943 nuip H May 13, 2024, 4:38 p.m. OK Kotlin 1.9 TESTS 18 187 0 2600
260834387 AkaiLemon H May 13, 2024, 4:58 p.m. OK Kotlin 1.9 TESTS 18 187 102400 2600
260827115 Sugar_fan H May 13, 2024, 4:01 p.m. OK Kotlin 1.9 TESTS 18 187 102400 2600
260824420 LeoPro H May 13, 2024, 3:42 p.m. OK Kotlin 1.9 TESTS 18 187 409600 2600
260881092 Sparkle_Twilight H May 14, 2024, 5:41 a.m. OK Kotlin 1.9 TESTS 18 187 512000 2600
260831053 wsyear H May 13, 2024, 4:31 p.m. OK Kotlin 1.9 TESTS 18 187 512000 2600
261939869 annak_s H May 20, 2024, 9:58 p.m. OK Kotlin 1.9 TESTS 20 202 102400 2600

remove filters

Back to search problems