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

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 780 ) C Firewood PROGRAMMING *special 1500

B"It's pretty cold in Berland (yes, even in May). So Monocarp has to light his fireplace. Monocarp has a big log of wood, which weighs 2^n grams. Monocarp has watched the weather forecast and decided that he has to burn k grams of wood in the fireplace today, and the remaining 2^n-k grams of wood will be used tomorrow. In one minute, Monocarp can use his saw to split one of his logs in half. Initially he has only one log, but of course, after splitting a log, he gets two new logs. If the weight of the log is x , then each of the resulting logs has weight equal to frac{x}{2} . Monocarp can't split logs of weight 1 gram. Monocarp has to cut his log in such a way that some of the resulting logs weigh exactly k grams in total (and since the total weight of wood doesn't change, the remaining logs will have a total weight equal to exactly 2^n-k ). Help him to calculate the minimum number of minutes he has to spend cutting the logs. The first line contains one integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Each test case consists of one line containing two integers n and k ( 1 <= n <= 60 ; 1 <= k <= 2^n-1 ). For each test case, print one integer -- the minimum number of minutes Monocarp has to spend splitting the wood. In the first test case, Monocarp has to cut his log exactly once. Then he will have two logs weighing 2 grams each. In the second test case, Monocarp has to cut his log of 4 grams once, then cut one of the resulting logs. He will have one log of weight 2 and two logs of weight 1 , so he can use two logs to get exactly 3 grams. "...

Tutorials

129483

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
261093064 rajharshsingh2003 C May 15, 2024, 6:25 p.m. OK Kotlin 1.7 TESTS 8 296 0 1500
260818005 amustafali C May 13, 2024, 2:58 p.m. OK Kotlin 1.7 TESTS 8 311 6553600 1500
260816833 AHappyPotato C May 13, 2024, 2:51 p.m. OK Kotlin 1.7 TESTS 8 312 3276800 1500
260815943 pashka C May 13, 2024, 2:46 p.m. OK Kotlin 1.7 TESTS 8 327 13209600 1500
260921013 Sumitsingh7 C May 14, 2024, 11:56 a.m. OK Kotlin 1.7 TESTS 8 343 4198400 1500
260817941 MagentaCobra C May 13, 2024, 2:57 p.m. OK Kotlin 1.7 TESTS 8 358 4300800 1500
260820979 debug_maina C May 13, 2024, 3:17 p.m. OK Kotlin 1.7 TESTS 8 358 6553600 1500
260818004 AyuAnchor C May 13, 2024, 2:58 p.m. OK Kotlin 1.7 TESTS 8 358 8908800 1500
260817394 ScarletS C May 13, 2024, 2:54 p.m. OK Kotlin 1.7 TESTS 8 358 9932800 1500
260815471 Fortin C May 13, 2024, 2:43 p.m. OK Kotlin 1.7 TESTS 8 358 10240000 1500
260816103 thenymphsofdelphi C May 13, 2024, 2:47 p.m. OK Kotlin 1.9 TESTS 8 140 0 1500
260815513 knightL C May 13, 2024, 2:43 p.m. OK Kotlin 1.9 TESTS 8 140 0 1500
260834797 ramil.agger C May 13, 2024, 5:01 p.m. OK Kotlin 1.9 TESTS 8 155 0 1500
260816768 KerakTelor C May 13, 2024, 2:50 p.m. OK Kotlin 1.9 TESTS 8 155 0 1500
260820904 jvmusin C May 13, 2024, 3:17 p.m. OK Kotlin 1.9 TESTS 8 156 0 1500
260823442 vv005 C May 13, 2024, 3:35 p.m. OK Kotlin 1.9 TESTS 8 171 0 1500
260820560 T_PAVAN_NAGARAJU C May 13, 2024, 3:14 p.m. OK Kotlin 1.9 TESTS 8 171 0 1500
260817651 _Fake4Fun C May 13, 2024, 2:56 p.m. OK Kotlin 1.9 TESTS 8 171 0 1500
260815661 armoking C May 13, 2024, 2:44 p.m. OK Kotlin 1.9 TESTS 8 171 0 1500
260814602 arvindf232 C May 13, 2024, 2:39 p.m. OK Kotlin 1.9 TESTS 8 171 0 1500

remove filters

Back to search problems