Kotlin Heroes: Episode 12

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
2087 Kotlin Heroes: Episode 12 FINISHED False 9000 32369123 April 7, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 70 ) F Weapon Upgrade PROGRAMMING *special *special dp dp

Monocarp is playing a game. The game is divided into stages, and there are a total of (1337) stages. The game character uses a weapon with two attack modes: physical and elemental. Initially, the weapon's physical attack power is (1), and its elemental attack power is also (1). During the (i)-th stage of the game, the following events occur in order: If (i \le n), a monster with a physical defense (a_i) and elemental defense (b_i) appears. Otherwise, nothing happens. Monocarp can shoot at exactly one of the remaining monsters. If the monster's physical defense is at most the character's physical attack power or the monster's elemental defense is at most the character's elemental attack power, the monster will be killed. Otherwise, nothing happens. Each surviving monster deals (1) damage to the game character. After each kill, Monocarp can upgrade one of the attacks of the weapon by (1). Your task is to calculate the minimum damage that Monocarp can get in order to kill all the monsters in the game (or report that it is impossible to kill all the monsters). The first line contains a single integer (n) ((1 \le n \le 500)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 500)). The third line contains (n) integers (b_1, b_2, \dots, b_n) ((1 \le b_i \le 500)). Print a single integer — the minimum damage that Monocarp can get in order to kill all the monsters in the game; if it is impossible to kill all the monsters, print -1 . In the first example, Monocarp can proceed as follows: (1)-st stage: (1)-st monster appears; Monocarp cannot kill any monster; (1) alive monster deals (1) damage, so the total damage Monocarp got is (1). (2)-nd monster appears; Monocarp kills (2)-nd monster (using elemental attack) and upgrades physical damage; (1) alive monster deals (1) damage, so the total damage Monocarp got is (2). (3)-rd monst

Tutorials

141608

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
314394836 Ra16bit F April 7, 2025, 4:25 p.m. OK Kotlin 1.7 TESTS 20 874 25804800
314433629 DeanMenezes93 F April 8, 2025, 1:19 a.m. OK Kotlin 1.7 TESTS 20 1280 10240000
314440027 Gabituss F April 8, 2025, 3:42 a.m. OK Kotlin 1.7 TESTS 20 2093 185753600
314394346 baluteshih F April 7, 2025, 4:22 p.m. OK Kotlin 1.7 TESTS 20 2421 244121600
314396197 ajinkya1p3 F April 7, 2025, 4:34 p.m. OK Kotlin 1.7 TESTS 20 2702 13619200
314396269 andreyDagger F April 7, 2025, 4:34 p.m. OK Kotlin 1.7 TESTS 20 2937 293683200
314403540 ikrpprppp F April 7, 2025, 5:24 p.m. OK Kotlin 1.7 TESTS 20 3046 16179200
314403465 ahmedafeef F April 7, 2025, 5:23 p.m. OK Kotlin 1.7 TESTS 20 3061 309248000
314389023 cmk666 F April 7, 2025, 3:47 p.m. OK Kotlin 1.7 TESTS 20 3265 288256000
314389667 zjy2008 F April 7, 2025, 3:51 p.m. OK Kotlin 1.7 TESTS 20 3593 332595200
314438935 maspy F April 8, 2025, 3:21 a.m. OK Kotlin 1.9 TESTS 20 468 102400
314395150 crystal_castles F April 7, 2025, 4:27 p.m. OK Kotlin 1.9 TESTS 20 1374 102400
314401659 yudedako F April 7, 2025, 5:10 p.m. OK Kotlin 1.9 TESTS 20 1421 102400
314401903 furry F April 7, 2025, 5:11 p.m. OK Kotlin 1.9 TESTS 20 1453 102400
314384352 arvindf232 F April 7, 2025, 3:20 p.m. OK Kotlin 1.9 TESTS 20 1890 1126400
314392726 Andreasyan F April 7, 2025, 4:11 p.m. OK Kotlin 1.9 TESTS 20 2077 0
314392151 Kude F April 7, 2025, 4:07 p.m. OK Kotlin 1.9 TESTS 20 2109 102400
314397743 wxhtzdy F April 7, 2025, 4:44 p.m. OK Kotlin 1.9 TESTS 20 2265 102400
314392702 emthrm F April 7, 2025, 4:11 p.m. OK Kotlin 1.9 TESTS 20 2280 204800
314389763 huansir F April 7, 2025, 3:52 p.m. OK Kotlin 1.9 TESTS 20 2374 0

remove filters

Back to search problems