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
( 110 ) G Observation Towers PROGRAMMING *special 2400

B'Consider a segment of an OX axis from 1 to n . There are k observation towers on this segment. Each tower has two parameters -- the coordinate x_i and the height h_i . The coordinates of all towers are distinct. From tower i , you can see point j if |x_i - j| <= h_i (where |a| is an absolute value of a ). You can increase the height of any tower by 1 for one coin. The height of each tower can be increased any number of times (including zero). You need to process q independent queries. In the i -th query, two different points l and r are given. You need to calculate the minimum number of coins required to be able to see both of these points (from one tower or from different towers). The first line contains two integers n and k ( 2 <= n <= 2 cdot 10^5 ; 1 <= k <= n ) -- the length of the segment of an OX axis and the number of observation towers. The second line contains k integers x_1, x_2, ... , x_k ( 1 <= x_i <= n ) -- the coordinates of the observation towers. The coordinates of all towers are distinct. The third line contains k integers h_1, h_2, ... , h_k ( 0 <= h_i <= n ) -- the heights of the observation towers. The fourth line contains a single integer q ( 1 <= q <= 2 cdot 10^5 ) -- the number of queries. Each of the next q lines contains two integers l and r ( 1 <= l < r <= n ) -- the description of the next query. For each query, output a single integer -- the minimum number of coins required to be able to see both points (from one tower or from different towers). '...

Tutorials

129483

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260821607 Yu_212 G May 13, 2024, 3:22 p.m. OK Kotlin 1.7 TESTS 32 765 68505600 2400
260834891 MagentaCobra G May 13, 2024, 5:02 p.m. OK Kotlin 1.7 TESTS 32 999 69939200 2400
260831050 tabr G May 13, 2024, 4:31 p.m. OK Kotlin 1.7 TESTS 32 1155 117350400 2400
260826934 yudedako G May 13, 2024, 4 p.m. OK Kotlin 1.7 TESTS 32 1187 173772800 2400
260919378 Aidos G May 14, 2024, 11:45 a.m. OK Kotlin 1.7 TESTS 32 1265 125952000 2400
260830857 paula G May 13, 2024, 4:29 p.m. OK Kotlin 1.7 TESTS 32 1280 125337600 2400
260942943 Aidos G May 14, 2024, 2:44 p.m. OK Kotlin 1.7 TESTS 32 1327 116838400 2400
260829757 Bedge G May 13, 2024, 4:20 p.m. OK Kotlin 1.7 TESTS 32 1358 181145600 2400
260837959 abcde34534 G May 13, 2024, 5:32 p.m. OK Kotlin 1.7 TESTS 32 1374 120012800 2400
260833976 physics0523 G May 13, 2024, 4:55 p.m. OK Kotlin 1.7 TESTS 32 1405 170905600 2400
260852197 dzhi G May 13, 2024, 8 p.m. OK Kotlin 1.9 TESTS 32 328 10444800 2400
260830310 AkaiLemon G May 13, 2024, 4:25 p.m. OK Kotlin 1.9 TESTS 32 358 10752000 2400
260834093 __jk__ G May 13, 2024, 4:55 p.m. OK Kotlin 1.9 TESTS 32 421 34406400 2400
260825398 thenymphsofdelphi G May 13, 2024, 3:49 p.m. OK Kotlin 1.9 TESTS 32 453 16896000 2400
260846573 dzhi G May 13, 2024, 6:55 p.m. OK Kotlin 1.9 TESTS 32 593 11571200 2400
260900648 cjtoribio G May 14, 2024, 8:57 a.m. OK Kotlin 1.9 TESTS 32 624 6348800 2400
260831616 ikrpprppp G May 13, 2024, 4:35 p.m. OK Kotlin 1.9 TESTS 32 655 17920000 2400
260827548 emthrm G May 13, 2024, 4:05 p.m. OK Kotlin 1.9 TESTS 32 686 18841600 2400
260872999 _Fake4Fun G May 14, 2024, 3:39 a.m. OK Kotlin 1.9 TESTS 32 687 3891200 2400
260837890 _Fake4Fun G May 13, 2024, 5:32 p.m. OK Kotlin 1.9 TESTS 32 702 3891200 2400

remove filters

Back to search problems