Kotlin Heroes: Episode 4

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
1346 Kotlin Heroes: Episode 4 FINISHED False 9000 146417063 May 29, 2020, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 232 ) F Dune II: Battle For Arrakis PROGRAMMING *special data structures greedy math 2000

B"You're at the last mission in one very old and very popular strategy game Dune II: Battle For Arrakis. The map of the mission can be represented as a rectangular matrix of size n x m . Initially, there are a_{i, j} units of your army in the cell (i, j) . You want to prepare for the final battle, so you want to move all your army into exactly one cell of the map (i.e. nm-1 cells should contain 0 units of the army and the remaining cell should contain the entire army). To do this, you can do some (possibly, zero) number of moves. During one move, you can select exactly one unit from some cell and move it to one of the adjacent by side cells. I.e. from the cell (i, j) you can move the unit to cells: Of course, you want to move all your army into exactly one cell as fast as possible. So, you want to know the minimum number of moves you need to do that. And, of course, life goes on, so the situation on the map changes. There are q updates, the i -th update is denoted by three integers x, y, z . This update affects the army in the cell (x, y) : after this update, the number of units in the cell (x, y) becomes z (i.e. you replace a_{x, y} with z ). Also, you want to determine, for each i , the minimum number of moves needed to move your entire army into exactly one cell with the first i updates applied to the initial map. In other words, the map after the i -th update equals the initial map with the first i updates applied to it. The first line of the input contains three integers n, m and q ( 1 <= n, m <= 1000; 1 <= q <= 5000 ) -- the size of the matrix and the number of updates correspondingly. The next n lines contain m integers each, where the j -th integer in the i -th line is a_{i, j} ( 1 <= a_{i, j} <= 10^9 ) -- the number of units in the cell (i, j) . The next q lines contain three in"...

Tutorials

Kotlin Heroes: Episode 4 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
81905541 Egor F May 29, 2020, 3:50 p.m. OK Kotlin TESTS 25 264 0 2000
81930475 Spheniscine F May 30, 2020, 2:55 a.m. OK Kotlin TESTS 25 280 614400 2000
81930597 Spheniscine F May 30, 2020, 3:01 a.m. OK Kotlin TESTS 25 296 716800 2000
82002219 Spheniscine F May 31, 2020, 1:09 a.m. OK Kotlin TESTS 25 312 614400 2000
81900088 eatmore F May 29, 2020, 3:09 p.m. OK Kotlin TESTS 25 358 0 2000
81910773 Spheniscine F May 29, 2020, 4:36 p.m. OK Kotlin TESTS 25 374 614400 2000
81904219 sokian F May 29, 2020, 3:39 p.m. OK Kotlin TESTS 25 389 0 2000
81910000 Taran_1407 F May 29, 2020, 4:29 p.m. OK Kotlin TESTS 25 389 5939200 2000
81905940 timf1089 F May 29, 2020, 3:53 p.m. OK Kotlin TESTS 25 390 0 2000
81905226 Jatana F May 29, 2020, 3:47 p.m. OK Kotlin TESTS 25 405 5632000 2000

remove filters

Back to search problems