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.
Problems
B"Suppose you are living with two cats: A and B. There are n napping spots where both cats usually sleep. Your cats like to sleep and also like all these spots, so they change napping spot each hour cyclically: The cat B is much younger, so they have a strict hierarchy: A and B don't lie together. In other words, if both cats'd like to go in spot x then the A takes this place and B moves to the next place in its order (if x < n then to x + 1 , but if x = n then to 1 ). Cat B follows his order, so it won't return to the skipped spot x after A frees it, but will move to the spot x + 2 and so on. Calculate, where cat B will be at hour k ? The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first and only line of each test case contains two integers n and k ( 2 <= n <= 10^9 ; 1 <= k <= 10^9 ) -- the number of spots and hour k . For each test case, print one integer -- the index of the spot where cat B will sleep at hour k . In the first and second test cases n = 2 , so: In the sixth test case: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
107501065 |
cedretaber |
B |
Feb. 16, 2021, 4:52 a.m. |
OK |
D |
TESTS |
6 |
46 |
1945600 |
|
|
107503698 |
CastleBravo |
B |
Feb. 16, 2021, 5:46 a.m. |
OK |
GNU C11 |
TESTS |
6 |
46 |
0 |
|
|
107497130 |
Grider |
B |
Feb. 16, 2021, 3:03 a.m. |
OK |
GNU C11 |
TESTS |
6 |
46 |
0 |
|
|
107477402 |
Viv1_01 |
B |
Feb. 15, 2021, 5:26 p.m. |
OK |
GNU C11 |
TESTS |
3 |
46 |
0 |
|
|
107484022 |
Iizshit |
B |
Feb. 15, 2021, 7:03 p.m. |
OK |
GNU C11 |
TESTS |
3 |
61 |
0 |
|
|
107468414 |
apsinghnsa |
B |
Feb. 15, 2021, 4:32 p.m. |
OK |
GNU C11 |
TESTS |
3 |
61 |
0 |
|
|
107500256 |
linpawsivsasay |
B |
Feb. 16, 2021, 4:34 a.m. |
OK |
GNU C11 |
TESTS |
6 |
62 |
0 |
|
|
107503651 |
CastleBravo |
B |
Feb. 16, 2021, 5:45 a.m. |
OK |
GNU C11 |
TESTS |
6 |
62 |
0 |
|
|
107495822 |
Orz_Sponge_Bob |
B |
Feb. 16, 2021, 2:15 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107495618 |
Spectre2017 |
B |
Feb. 16, 2021, 2:07 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107495410 |
kmyiu |
B |
Feb. 16, 2021, 1:56 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107494621 |
xcatf |
B |
Feb. 16, 2021, 1:15 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107493792 |
qiuzx |
B |
Feb. 16, 2021, 12:27 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107483332 |
Codestiny |
B |
Feb. 15, 2021, 6:52 p.m. |
OK |
GNU C++11 |
TESTS |
3 |
15 |
0 |
|
|
107503330 |
BYvinci |
B |
Feb. 16, 2021, 5:39 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107498947 |
pbrinotwyh |
B |
Feb. 16, 2021, 4 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107496273 |
kyriezzx |
B |
Feb. 16, 2021, 2:32 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107495952 |
luyiming123 |
B |
Feb. 16, 2021, 2:20 a.m. |
OK |
GNU C++11 |
TESTS |
6 |
15 |
0 |
|
|
107492560 |
Chaves |
B |
Feb. 15, 2021, 11:09 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
107492326 |
Chaves |
B |
Feb. 15, 2021, 10:57 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
107491529 |
Zombiehead |
B |
Feb. 15, 2021, 10:21 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
107490659 |
amrfahmy_ |
B |
Feb. 15, 2021, 9:47 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
107502691 |
gibberish |
B |
Feb. 16, 2021, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
6 |
15 |
0 |
|
|
107503424 |
tm_professor20 |
B |
Feb. 16, 2021, 5:41 a.m. |
OK |
GNU C++14 |
TESTS |
6 |
15 |
0 |
|
|
107499003 |
prabhav_ |
B |
Feb. 16, 2021, 4:02 a.m. |
OK |
GNU C++14 |
TESTS |
6 |
15 |
0 |
|
|
107496161 |
YIEC2538 |
B |
Feb. 16, 2021, 2:27 a.m. |
OK |
GNU C++14 |
TESTS |
6 |
15 |
0 |
|
|
107495422 |
hdilantha |
B |
Feb. 16, 2021, 1:57 a.m. |
OK |
GNU C++14 |
TESTS |
6 |
15 |
0 |
|
|
107492596 |
Uchiha.Itachi |
B |
Feb. 15, 2021, 11:11 p.m. |
OK |
GNU C++14 |
TESTS |
3 |
15 |
0 |
|
|
107499846 |
peterlee |
B |
Feb. 16, 2021, 4:23 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107502696 |
vgarg_2.0 |
B |
Feb. 16, 2021, 5:26 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107502567 |
Saaransh_Agarwal |
B |
Feb. 16, 2021, 5:24 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107500919 |
Yash_mittal2409 |
B |
Feb. 16, 2021, 4:49 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107500860 |
dimasidorenko |
B |
Feb. 16, 2021, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107499773 |
LaZY_LaD_69 |
B |
Feb. 16, 2021, 4:22 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107496937 |
la_la_wanf |
B |
Feb. 16, 2021, 2:56 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107495462 |
manav_06 |
B |
Feb. 16, 2021, 1:59 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107495376 |
Aayush_Kansara |
B |
Feb. 16, 2021, 1:55 a.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107493059 |
tmstrixx |
B |
Feb. 15, 2021, 11:38 p.m. |
OK |
GNU C++17 |
TESTS |
6 |
15 |
0 |
|
|
107493577 |
haruki_K |
B |
Feb. 16, 2021, 12:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107491728 |
yspm |
B |
Feb. 15, 2021, 10:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
15 |
0 |
|
|
107490750 |
T_Nady |
B |
Feb. 15, 2021, 9:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
15 |
0 |
|
|
107489192 |
Klaus_Salvatore_786 |
B |
Feb. 15, 2021, 8:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
3 |
15 |
0 |
|
|
107494266 |
7oSkaaa |
B |
Feb. 16, 2021, 12:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107495343 |
Fantasy_T |
B |
Feb. 16, 2021, 1:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107499175 |
Prakhar6969 |
B |
Feb. 16, 2021, 4:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107500511 |
Prakhar6969 |
B |
Feb. 16, 2021, 4:39 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107501905 |
anil_111 |
B |
Feb. 16, 2021, 5:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107504438 |
Naruto_cm |
B |
Feb. 16, 2021, 5:58 a.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
15 |
0 |
|
|
107494087 |
0x3F |
B |
Feb. 16, 2021, 12:44 a.m. |
OK |
Go |
TESTS |
6 |
31 |
0 |
|
|
107494069 |
0x3F |
B |
Feb. 16, 2021, 12:43 a.m. |
OK |
Go |
TESTS |
6 |
31 |
0 |
|
|
107497698 |
87ouo |
B |
Feb. 16, 2021, 3:24 a.m. |
OK |
Go |
TESTS |
6 |
608 |
102400 |
|
|
107487470 |
rafee69029 |
B |
Feb. 15, 2021, 8:13 p.m. |
OK |
Java 11 |
TESTS |
3 |
171 |
0 |
|
|
107479601 |
Akram-Adel |
B |
Feb. 15, 2021, 5:53 p.m. |
OK |
Java 11 |
TESTS |
3 |
186 |
0 |
|
|
107499102 |
namitnayan |
B |
Feb. 16, 2021, 4:05 a.m. |
OK |
Java 11 |
TESTS |
6 |
187 |
0 |
|
|
107482043 |
guru1603 |
B |
Feb. 15, 2021, 6:30 p.m. |
OK |
Java 11 |
TESTS |
3 |
187 |
0 |
|
|
107466190 |
5612 |
B |
Feb. 15, 2021, 4:28 p.m. |
OK |
Java 11 |
TESTS |
3 |
187 |
0 |
|
|
107501482 |
devesh08 |
B |
Feb. 16, 2021, 5:02 a.m. |
OK |
Java 11 |
TESTS |
6 |
202 |
0 |
|
|
107483504 |
KGECian_23 |
B |
Feb. 15, 2021, 6:54 p.m. |
OK |
Java 11 |
TESTS |
3 |
202 |
0 |
|
|
107482796 |
guru1603 |
B |
Feb. 15, 2021, 6:42 p.m. |
OK |
Java 11 |
TESTS |
3 |
217 |
0 |
|
|
107475485 |
kumarsaksham54 |
B |
Feb. 15, 2021, 5:06 p.m. |
OK |
Java 11 |
TESTS |
3 |
233 |
0 |
|
|
107499335 |
Prateek_Jakhar |
B |
Feb. 16, 2021, 4:11 a.m. |
OK |
Java 11 |
TESTS |
6 |
249 |
0 |
|
|
107474631 |
onlytrall |
B |
Feb. 15, 2021, 4:59 p.m. |
OK |
Java 8 |
TESTS |
3 |
108 |
0 |
|
|
107503484 |
dante1 |
B |
Feb. 16, 2021, 5:42 a.m. |
OK |
Java 8 |
TESTS |
6 |
108 |
0 |
|
|
107475279 |
YashSaxena |
B |
Feb. 15, 2021, 5:04 p.m. |
OK |
Java 8 |
TESTS |
3 |
109 |
0 |
|
|
107497573 |
Dhananjay.07 |
B |
Feb. 16, 2021, 3:19 a.m. |
OK |
Java 8 |
TESTS |
6 |
109 |
0 |
|
|
107485747 |
singhdhanwant |
B |
Feb. 15, 2021, 7:35 p.m. |
OK |
Java 8 |
TESTS |
3 |
109 |
0 |
|
|
107482847 |
This_is_the_one |
B |
Feb. 15, 2021, 6:43 p.m. |
OK |
Java 8 |
TESTS |
3 |
109 |
0 |
|
|
107484248 |
AayushICS |
B |
Feb. 15, 2021, 7:07 p.m. |
OK |
Java 8 |
TESTS |
3 |
124 |
0 |
|
|
107483555 |
coolManit |
B |
Feb. 15, 2021, 6:55 p.m. |
OK |
Java 8 |
TESTS |
3 |
124 |
0 |
|
|
107481095 |
DemonSlayer18 |
B |
Feb. 15, 2021, 6:15 p.m. |
OK |
Java 8 |
TESTS |
3 |
124 |
0 |
|
|
107478363 |
RonWonWon |
B |
Feb. 15, 2021, 5:37 p.m. |
OK |
Java 8 |
TESTS |
3 |
124 |
0 |
|
|
107494300 |
Spheniscine |
B |
Feb. 16, 2021, 12:55 a.m. |
OK |
Kotlin |
TESTS |
6 |
155 |
0 |
|
|
107480217 |
Bolota |
B |
Feb. 15, 2021, 6:02 p.m. |
OK |
Mono C# |
TESTS |
3 |
124 |
6553600 |
|
|
107465111 |
ishnehaaa |
B |
Feb. 15, 2021, 4:26 p.m. |
OK |
MS C++ |
TESTS |
3 |
62 |
0 |
|
|
107500990 |
_wsb_ |
B |
Feb. 16, 2021, 4:51 a.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
30 |
0 |
|
|
107474270 |
Agumon |
B |
Feb. 15, 2021, 4:56 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
31 |
3993600 |
|
|
107502594 |
dear-john |
B |
Feb. 16, 2021, 5:24 a.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
46 |
0 |
|
|
107475031 |
gaserashraf |
B |
Feb. 15, 2021, 5:02 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
46 |
0 |
|
|
107492978 |
MONK_KEY |
B |
Feb. 15, 2021, 11:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
61 |
0 |
|
|
107478918 |
mary.avetisyan |
B |
Feb. 15, 2021, 5:44 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
62 |
0 |
|
|
107502898 |
WCmidschool |
B |
Feb. 16, 2021, 5:31 a.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
62 |
0 |
|
|
107500342 |
Terry55 |
B |
Feb. 16, 2021, 4:36 a.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
62 |
0 |
|
|
107494921 |
_Rimjhim_36 |
B |
Feb. 16, 2021, 1:30 a.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
62 |
0 |
|
|
107477839 |
mnrmustafa |
B |
Feb. 15, 2021, 5:31 p.m. |
OK |
MS C++ 2017 |
TESTS |
3 |
62 |
0 |
|
|
107500598 |
HaibaraAi |
B |
Feb. 16, 2021, 4:41 a.m. |
OK |
.NET Core C# |
TESTS |
6 |
155 |
3072000 |
|
|
107479752 |
aayush_1607 |
B |
Feb. 15, 2021, 5:55 p.m. |
OK |
PyPy 2 |
TESTS |
3 |
93 |
1126400 |
|
|
107477458 |
alterego_14 |
B |
Feb. 15, 2021, 5:27 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
124 |
3174400 |
|
|
107496259 |
rivnam |
B |
Feb. 16, 2021, 2:31 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
124 |
4096000 |
|
|
107472534 |
reddevil100 |
B |
Feb. 15, 2021, 4:45 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
155 |
4505600 |
|
|
107502644 |
akifpathan |
B |
Feb. 16, 2021, 5:25 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
155 |
5017600 |
|
|
107485449 |
evoxtorm |
B |
Feb. 15, 2021, 7:29 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
155 |
5017600 |
|
|
107504505 |
skhan_org |
B |
Feb. 16, 2021, 5:59 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
155 |
5120000 |
|
|
107499417 |
srijan.sarkar |
B |
Feb. 16, 2021, 4:13 a.m. |
OK |
PyPy 3 |
TESTS |
6 |
156 |
4505600 |
|
|
107468141 |
AMBIGUOSJEON |
B |
Feb. 15, 2021, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
156 |
6348800 |
|
|
107472067 |
deepanshu_pali |
B |
Feb. 15, 2021, 4:42 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
170 |
4915200 |
|
|
107480367 |
Naughty_Tactician |
B |
Feb. 15, 2021, 6:04 p.m. |
OK |
PyPy 3 |
TESTS |
3 |
171 |
6246400 |
|
|
107487660 |
shikhabhat16 |
B |
Feb. 15, 2021, 8:17 p.m. |
OK |
Python 3 |
TESTS |
3 |
62 |
307200 |
|
|
107475429 |
jinsong |
B |
Feb. 15, 2021, 5:06 p.m. |
OK |
Python 3 |
TESTS |
3 |
77 |
307200 |
|
|
107476274 |
motivation_1997 |
B |
Feb. 15, 2021, 5:14 p.m. |
OK |
Python 3 |
TESTS |
3 |
77 |
614400 |
|
|
107483030 |
abhisheka950 |
B |
Feb. 15, 2021, 6:46 p.m. |
OK |
Python 3 |
TESTS |
3 |
93 |
819200 |
|
|
107502600 |
bookpen |
B |
Feb. 16, 2021, 5:24 a.m. |
OK |
Python 3 |
TESTS |
6 |
108 |
409600 |
|
|
107484114 |
dear_mr_het |
B |
Feb. 15, 2021, 7:05 p.m. |
OK |
Python 3 |
TESTS |
3 |
124 |
2252800 |
|
|
107483901 |
dear_mr_het |
B |
Feb. 15, 2021, 7:01 p.m. |
OK |
Python 3 |
TESTS |
3 |
124 |
2252800 |
|
|
107497520 |
sh1194 |
B |
Feb. 16, 2021, 3:17 a.m. |
OK |
Python 3 |
TESTS |
6 |
139 |
0 |
|
|
107480805 |
SauraBh0373 |
B |
Feb. 15, 2021, 6:11 p.m. |
OK |
Python 3 |
TESTS |
3 |
139 |
0 |
|
|
107480095 |
nabovtl |
B |
Feb. 15, 2021, 6 p.m. |
OK |
Python 3 |
TESTS |
3 |
139 |
0 |
|
|
107469305 |
gazaan |
B |
Feb. 15, 2021, 4:33 p.m. |
OK |
Scala |
TESTS |
3 |
498 |
0 |
|
|
107483163 |
igor.v.karp |
B |
Feb. 15, 2021, 6:48 p.m. |
OK |
Scala |
TESTS |
3 |
592 |
0 |
|
|
remove filters
Back to search problems