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 16212299 May 13, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 32 ) J Necromancer PROGRAMMING *special 3200

B"Monocarp is playing a computer game. In this game, his character is a necromancer. He is fighting n monsters numbered from 1 to n . Each monster has two parameters: health and strength. Monocarp considers q scenarios of the battle. In each scenario, he chooses some segment [l, r] of monsters and calculates the number of moves it takes to defeat all these monsters. Each scenario proceeds as follows. First, Monocarp kills monster l and revives it as a zombie (this does not count as a move). Then each move the following happens: let i be the index of the first monster in the segment [l, r] that is still alive. All zombies attack monster i , reducing its health by their total strength. After that, if monster i has 0 or less health, it dies and Monocarp revives it as a zombie. When the monster is revived, the zombie's strength is equal to the monster's strength. Help Monocarp for each scenario to calculate how many moves it will take to kill all the monsters in the segment. The first line contains two integers n and q ( 1 <= n, q <= 2 cdot 10^5 ) -- the number of monsters and the number of scenarios, respectively. The second line contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= 10^4 ), where a_i is the number of health points of the i -th monster. The third line contains n integers b_1, b_2, ... , b_n ( 1 <= b_i <= 10^4 ), where b_i is the strength of the i -th monster. Then q lines follow. The j -th of them contains two integers l_j and r_j ( 1 <= l_j <= r_j <= n ) -- the boundaries of the j -th scenario. For each scenario, print a single integer -- the number of moves it will take to kill all the monsters in the segment. "...

Tutorials

129483

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260833572 LeoPro J May 13, 2024, 4:51 p.m. OK Kotlin 1.7 TESTS 51 2905 322662400 3200
260834243 tourist J May 13, 2024, 4:57 p.m. OK Kotlin 1.7 TESTS 51 3124 262246400 3200
262311727 annak_s J May 23, 2024, 8:48 p.m. OK Kotlin 1.7 TESTS 51 3984 338022400 3200
262311008 YuriyKap J May 23, 2024, 8:35 p.m. OK Kotlin 1.7 TESTS 51 3984 338022400 3200
262305179 _Robin_Hood_ J May 23, 2024, 7:14 p.m. OK Kotlin 1.7 TESTS 51 3984 338022400 3200
262975360 Engineer J May 28, 2024, 7:37 a.m. OK Kotlin 1.7 TESTS 51 4156 378163200 3200
262021780 Slata J May 21, 2024, 1:06 p.m. OK Kotlin 1.7 TESTS 51 4421 389529600 3200
261292479 Hamza_Refai J May 17, 2024, 7:24 a.m. OK Kotlin 1.7 TESTS 51 4514 353792000 3200
261319656 chappy1 J May 17, 2024, 11:20 a.m. OK Kotlin 1.7 TESTS 51 4624 536883200 3200
260830903 arvindf232 J May 13, 2024, 4:30 p.m. OK Kotlin 1.7 TESTS 51 4718 536883200 3200
261208951 nguyenquocthao00 J May 16, 2024, 2:12 p.m. OK Kotlin 1.9 TESTS 51 2484 121139200 3200
261109102 dzhi J May 15, 2024, 10:43 p.m. OK Kotlin 1.9 TESTS 51 2640 136089600 3200
261194762 nguyenquocthao00 J May 16, 2024, 12:30 p.m. OK Kotlin 1.9 TESTS 51 2703 120627200 3200
262686687 nguyenquocthao00 J May 26, 2024, 10:10 a.m. OK Kotlin 1.9 TESTS 51 3421 118579200 3200
261172152 Yuvraj_2004 J May 16, 2024, 9:26 a.m. OK Kotlin 1.9 TESTS 51 5171 119603200 3200
261118601 nguyenquocthao00 J May 16, 2024, 2:50 a.m. OK Kotlin 1.9 TESTS 51 5171 119603200 3200

remove filters

Back to search problems