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
( 962 ) B Clock in the Pool PROGRAMMING *special math 1400

B"You are swimming in the pool, and you need to control the time of swimming. The pool has a clock that cycles between three different modes: showing water temperature, showing air temperature, and showing time. At the start of the 0 -th second it starts showing water temperature, at the start of the k -th second it switches to air temperature. At the start of the 2k -th second, it switches to showing time. At the start of the 3k -th second the clock starts showing water temperature again, at the start of the 4k -th second -- air temperature, and so on. You looked at the clock during the m -th second to check the time, but it may be that the clock is not showing time right now. How much time do you have to wait to see the time on the clock? Answer t independent test cases. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Next t cases follow. The first and only line of each test case contains two integers k and m ( 1 <= k <= 10^8; 1 <= m <= 10^9 ) -- the length of the period of the clock and the moment of time you check the clock. For each test case, print a single integer -- the time you have to wait from the moment m until the moment the clock starts showing the time. You can assume that you are able to read the time instantly the moment it displays on the clock. In the first test case, the clock will start showing time during the 2 -nd second, so you have to wait 2 - 1 = 1 second. In the second test case, the clock shows time from the 10 -th until the 15 -th second, so during the 14 -th second it shows time, and you don't have to wait. In the third test case, during the 15 -th second, the clock is already showing water temperature. So you have to wait till the 25 -th second, when the clock starts showing time again. You'll wait 25 - 15 = 10 seconds. In the fourth test case, the clock wil"...

Tutorials

129483

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
260819211 sid9406 B May 13, 2024, 3:05 p.m. OK Kotlin 1.7 TESTS 6 280 0 1400
260817371 MagentaCobra B May 13, 2024, 2:54 p.m. OK Kotlin 1.7 TESTS 6 280 409600 1400
260920002 Sumitsingh7 B May 14, 2024, 11:49 a.m. OK Kotlin 1.7 TESTS 6 280 512000 1400
260815620 Valera_Grinenko B May 13, 2024, 2:44 p.m. OK Kotlin 1.7 TESTS 6 280 7270400 1400
260831748 amustafali B May 13, 2024, 4:36 p.m. OK Kotlin 1.7 TESTS 6 281 921600 1400
260815336 pashka B May 13, 2024, 2:43 p.m. OK Kotlin 1.7 TESTS 6 296 7168000 1400
260815763 Timonnable B May 13, 2024, 2:45 p.m. OK Kotlin 1.7 TESTS 6 312 5734400 1400
260851081 Chocoyuvi B May 13, 2024, 7:47 p.m. OK Kotlin 1.7 TESTS 6 312 5836800 1400
260817410 SajidZakaria B May 13, 2024, 2:54 p.m. OK Kotlin 1.7 TESTS 6 312 6246400 1400
260815730 Fanarill B May 13, 2024, 2:44 p.m. OK Kotlin 1.7 TESTS 6 327 5222400 1400
260814365 arvindf232 B May 13, 2024, 2:38 p.m. OK Kotlin 1.9 TESTS 6 124 0 1400
260818126 T_PAVAN_NAGARAJU B May 13, 2024, 2:58 p.m. OK Kotlin 1.9 TESTS 6 140 0 1400
260816263 _Fake4Fun B May 13, 2024, 2:48 p.m. OK Kotlin 1.9 TESTS 6 140 0 1400
260814674 armoking B May 13, 2024, 2:39 p.m. OK Kotlin 1.9 TESTS 6 140 0 1400
260816344 AkaiLemon B May 13, 2024, 2:48 p.m. OK Kotlin 1.9 TESTS 6 140 102400 1400
260833620 ramil.agger B May 13, 2024, 4:52 p.m. OK Kotlin 1.9 TESTS 6 155 0 1400
260814878 knightL B May 13, 2024, 2:40 p.m. OK Kotlin 1.9 TESTS 6 155 0 1400
260852902 dileepkumar22 B May 13, 2024, 8:09 p.m. OK Kotlin 1.9 TESTS 6 156 0 1400
260822258 vv005 B May 13, 2024, 3:26 p.m. OK Kotlin 1.9 TESTS 6 156 0 1400
260816073 alnmlbch B May 13, 2024, 2:46 p.m. OK Kotlin 1.9 TESTS 6 156 0 1400

remove filters

Back to search problems