Kotlin Heroes: Episode 11

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
2011 Kotlin Heroes: Episode 11 FINISHED False 9000 48698723 Sept. 30, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 283 ) D Among Wolves PROGRAMMING *special

In a game you started playing recently, there is a field that can be represented as a rectangular grid. The field has (2) rows and (n) columns — (2n) cells in total. Some cells are empty, but some are occupied by wolves. In the beginning of the game, you have one sheep in some cell, and you'd like to save it from wolves. Wolves will attack you at night, so you still have some time for preparation. You have two ways to deal with wolves: You pay (h) coins to hunters and choose a cell occupied by a wolf. Hunters will clear the cell, eradicating the wolf in it. You pay (b) coins to builders and choose an empty cell. Builders will dig a trench in the chosen cell that wolves can't cross. Let's say that a wolf can reach the sheep if there is a path that starts at the wolf's cell and finishes at the sheep's cell. This path shouldn't contain any cells with trenches, and each two consecutive cells in the path should be neighbors (share a side). What is the minimum total amount of money you should pay to ensure that none of the wolves can reach the sheep? The first line contains a single integer (t) ((1 \le t \le 1200)) — the number of test cases. Next, (t) independent cases follow. The first line of each test case contains three integers (n), (h), and (b) ((2 \le n \le 2 \cdot 10^5); (1 \le h, b \le 10^9)) — the size of the grid and corresponding costs. The next two lines contain a description of the grid. The (j)-th character in the (i)-th line is either ' . ', ' S ' or ' W ': ' . ' means that the cell is empty; ' S ' means that the cell is occupied by the sheep; there is exactly one such cell on the grid; ' W ' means that the cell is occupied by a wolf. Additional constraints: there are no wolves in cells neighboring the sheep cell ; the sum of (n) over all test cases doesn't exceed (2 \cdot 10^5). For each test case, print a single integer — the minimum total amount of money you should pay to sav

Tutorials

Kotlin Heroes 11 — Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
283780516 __jk__ D Sept. 30, 2024, 3:05 p.m. OK Kotlin 1.7 TESTS 52 343 2150400
283779402 ttamx D Sept. 30, 2024, 2:59 p.m. OK Kotlin 1.7 TESTS 52 359 3379200
283785773 YhuanDebeste D Sept. 30, 2024, 3:36 p.m. OK Kotlin 1.7 TESTS 52 359 4812800
283780488 Ra16bit D Sept. 30, 2024, 3:05 p.m. OK Kotlin 1.7 TESTS 52 374 7680000
283782864 abusaeed2433 D Sept. 30, 2024, 3:19 p.m. OK Kotlin 1.7 TESTS 52 390 21606400
283785399 Kway88 D Sept. 30, 2024, 3:34 p.m. OK Kotlin 1.7 TESTS 52 405 12595200
283780804 marvinthang D Sept. 30, 2024, 3:07 p.m. OK Kotlin 1.7 TESTS 52 406 11878400
283783546 ConjectureGuy D Sept. 30, 2024, 3:23 p.m. OK Kotlin 1.7 TESTS 52 421 10854400
283788500 ss_loves_AC D Sept. 30, 2024, 3:53 p.m. OK Kotlin 1.7 TESTS 52 421 10956800
283781559 ryucc D Sept. 30, 2024, 3:11 p.m. OK Kotlin 1.7 TESTS 52 421 11366400
283789432 Momoi-chan D Sept. 30, 2024, 3:58 p.m. OK Kotlin 1.9 TESTS 52 171 0
283783920 Togi D Sept. 30, 2024, 3:25 p.m. OK Kotlin 1.9 TESTS 52 171 0
283787381 caustique D Sept. 30, 2024, 3:46 p.m. OK Kotlin 1.9 TESTS 52 186 0
283782631 satyam343 D Sept. 30, 2024, 3:17 p.m. OK Kotlin 1.9 TESTS 52 187 0
283782539 Slamur D Sept. 30, 2024, 3:17 p.m. OK Kotlin 1.9 TESTS 52 202 0
283781449 binminh01 D Sept. 30, 2024, 3:10 p.m. OK Kotlin 1.9 TESTS 52 202 0
283780531 sd0061 D Sept. 30, 2024, 3:05 p.m. OK Kotlin 1.9 TESTS 52 202 0
283786592 T0uRistq D Sept. 30, 2024, 3:41 p.m. OK Kotlin 1.9 TESTS 52 202 102400
283784725 TecTrixer D Sept. 30, 2024, 3:30 p.m. OK Kotlin 1.9 TESTS 52 202 102400
283835801 Sparkle_Twilight D Oct. 1, 2024, 1:29 a.m. OK Kotlin 1.9 TESTS 52 202 204800

remove filters

Back to search problems