Kotlin Heroes: Episode 14

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
2199 Kotlin Heroes: Episode 14 FINISHED False 9000 3943523 March 2, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 830 ) B Two Towers PROGRAMMING *special greedy math

You have two towers made of blocks, standing next to each other. Initially, the height of the first tower is (a), and the height of the second tower is (b). In one action, you can: take one block and place it on one of the towers, increasing its height by (1); or take two blocks and place one on each tower, increasing both heights by (1). However, this can only be done if their heights are equal. Your goal is to make the height of the first tower equal to (c), and the height of the second tower equal to (d). What is the minimum number of actions you need to perform? The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. Each test case consists of one line containing (4) integers (a, b, c, d) ((1 \le a \le c \le 10^8); (1 \le b \le d \le 10^8)). For each test case, output one integer — the minimum number of actions that you have to perform. In the first example, you can first place a block on the first tower, making the heights of both towers equal to (2). Then, you can place one block on each tower, raising their heights to (3). After that, you can place two blocks on the second tower, increasing its height to (5). Thus, in (4) moves, you can make the height of the first tower equal to (3) and the second tower equal to (5).

Tutorials

151783

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
365103003 looY B March 2, 2026, 2:49 p.m. OK Kotlin 1.7 TESTS 5 171 0
365102798 Akshat_Agg. B March 2, 2026, 2:48 p.m. OK Kotlin 1.7 TESTS 5 187 0
365104342 AliHasanli736 B March 2, 2026, 2:56 p.m. OK Kotlin 1.7 TESTS 5 187 102400
365103517 Knull. B March 2, 2026, 2:51 p.m. OK Kotlin 1.7 TESTS 5 187 6963200
365146736 last_theorem B March 2, 2026, 9:17 p.m. OK Kotlin 1.7 TESTS 5 203 0
365103077 kriradhaks B March 2, 2026, 2:49 p.m. OK Kotlin 1.7 TESTS 5 203 0
365101763 khba B March 2, 2026, 2:42 p.m. OK Kotlin 1.7 TESTS 5 203 0
365114111 Koushal_26 B March 2, 2026, 4:03 p.m. OK Kotlin 1.7 TESTS 5 218 0
365104069 yatuoximeng B March 2, 2026, 2:54 p.m. OK Kotlin 1.7 TESTS 5 218 0
365137211 Amogh_Gajera B March 2, 2026, 7:19 p.m. OK Kotlin 1.7 TESTS 5 218 921600
365124875 yuisgame B March 2, 2026, 5:27 p.m. OK Kotlin 1.9 TESTS 5 109 0
365115802 jinxedcat B March 2, 2026, 4:17 p.m. OK Kotlin 1.9 TESTS 5 109 0
365110146 baimukhanov B March 2, 2026, 3:33 p.m. OK Kotlin 1.9 TESTS 5 125 0
365101312 __jk__ B March 2, 2026, 2:39 p.m. OK Kotlin 1.9 TESTS 5 125 0
365113741 Hanlabong B March 2, 2026, 3:59 p.m. OK Kotlin 1.9 TESTS 5 140 102400
365118966 Ashar-Usmani B March 2, 2026, 4:41 p.m. OK Kotlin 1.9 TESTS 5 156 102400
365104676 1435730 B March 2, 2026, 2:58 p.m. OK Kotlin 1.9 TESTS 5 156 204800
365101805 wu_qing B March 2, 2026, 2:42 p.m. OK Kotlin 1.9 TESTS 5 156 204800
365124823 satya.00956 B March 2, 2026, 5:27 p.m. OK Kotlin 1.9 TESTS 5 171 0
365103479 axtr_ B March 2, 2026, 2:51 p.m. OK Kotlin 1.9 TESTS 5 171 0
365102938 NADIDADIT B March 2, 2026, 2:48 p.m. OK Kotlin 2.2 TESTS 5 78 23859200
365102605 E49869826 B March 2, 2026, 2:47 p.m. OK Kotlin 2.2 TESTS 5 78 23859200
365110018 theYogi B March 2, 2026, 3:32 p.m. OK Kotlin 2.2 TESTS 5 93 0
365107310 gaurav_singh88 B March 2, 2026, 3:15 p.m. OK Kotlin 2.2 TESTS 5 93 0
365112937 joyo16 B March 2, 2026, 3:53 p.m. OK Kotlin 2.2 TESTS 5 93 23859200
365101586 yg.margo B March 2, 2026, 2:41 p.m. OK Kotlin 2.2 TESTS 5 93 23859200
365119260 kaoruko_waguri7 B March 2, 2026, 4:43 p.m. OK Kotlin 2.2 TESTS 5 109 0
365107592 Nikrien B March 2, 2026, 3:17 p.m. OK Kotlin 2.2 TESTS 5 109 0
365101923 binminh B March 2, 2026, 2:43 p.m. OK Kotlin 2.2 TESTS 5 109 0
365101675 PelicanPilot B March 2, 2026, 2:41 p.m. OK Kotlin 2.2 TESTS 5 109 23756800

remove filters

Back to search problems