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'This is an interactive problem. n people sitting in a circle are trying to shuffle a deck of cards. The players are numbered from 1 to n , so that players i and i+1 are neighbours (as well as players 1 and n ). Each of them has exactly k cards, where k is even. The left neighbour of a player i is player i - 1 , and their right neighbour is player i + 1 (except for players 1 and n , who are respective neighbours of each other). Each turn the following happens: if a player has x cards, they give lfloor x / 2 rfloor to their neighbour on the left and lceil x / 2 rceil cards to their neighbour on the right. This happens for all players simultaneously. However, one player p is the impostor and they just give all their cards to their neighbour on the right. You know the number of players n and the number of cards k each player has initially, but p is unknown to you. Your task is to determine the value of p , by asking questions like "how many cards does player q have?" for an index q of your choice. After each question all players will make exactly one move and give their cards to their neighbours. You need to find the impostor by asking no more than 1000 questions. The first line contains two integers n and k ( 4 <= n <= 10^5 , 2 <= k <= 10^9 , k is even) -- the number of players and the number of cards. You can ask questions by printing "? q ". The answer to this question is the number of cards player q has now ( 1 <= q <= n ). The shuffling process starts immediately after your first question, so the answer to the first one is always equal to k . Once you have identified the impostor, you can output the answer by printing "! p ", where p is the player who is the impostor ( 1 <= p <= n ). Then you have to terminate your program. You have to fi'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
103475462 |
Gassa |
C |
Jan. 5, 2021, 7:17 p.m. |
OK |
D |
TESTS |
78 |
46 |
0 |
|
|
103473420 |
physics0523 |
C |
Jan. 5, 2021, 6:55 p.m. |
OK |
GNU C11 |
TESTS |
78 |
46 |
0 |
|
|
103492304 |
yuzhechuan |
C |
Jan. 6, 2021, 1:37 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
0 |
|
|
103473155 |
fishcathu. |
C |
Jan. 5, 2021, 6:52 p.m. |
OK |
GNU C++11 |
TESTS |
77 |
31 |
0 |
|
|
103502038 |
mrsrz |
C |
Jan. 6, 2021, 4:57 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
102400 |
|
|
103501274 |
little_brush |
C |
Jan. 6, 2021, 4:45 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
31 |
819200 |
|
|
103457021 |
nwi |
C |
Jan. 5, 2021, 4:26 p.m. |
OK |
GNU C++11 |
TESTS |
77 |
31 |
1433600 |
|
|
103501062 |
Arya_Erin |
C |
Jan. 6, 2021, 4:42 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
0 |
|
|
103496987 |
smarthehe |
C |
Jan. 6, 2021, 3:28 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
0 |
|
|
103492403 |
SevenDawns |
C |
Jan. 6, 2021, 1:40 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
0 |
|
|
103491210 |
qinzhaoyang |
C |
Jan. 6, 2021, 1:10 a.m. |
OK |
GNU C++11 |
TESTS |
78 |
46 |
0 |
|
|
103461496 |
OOmega |
C |
Jan. 5, 2021, 4:34 p.m. |
OK |
GNU C++11 |
TESTS |
77 |
46 |
0 |
|
|
103498585 |
QAQmika |
C |
Jan. 6, 2021, 4 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103499140 |
ZXyang |
C |
Jan. 6, 2021, 4:10 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103499107 |
farmerboy |
C |
Jan. 6, 2021, 4:09 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103498506 |
farmerboy |
C |
Jan. 6, 2021, 3:58 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103496876 |
crasysky |
C |
Jan. 6, 2021, 3:25 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103496831 |
heyuhhh |
C |
Jan. 6, 2021, 3:24 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103496789 |
crasysky |
C |
Jan. 6, 2021, 3:23 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103490357 |
Potassium |
C |
Jan. 6, 2021, 12:43 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103482827 |
awoo |
C |
Jan. 5, 2021, 9:11 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103475138 |
fcw |
C |
Jan. 5, 2021, 7:13 p.m. |
OK |
GNU C++14 |
TESTS |
78 |
46 |
0 |
|
|
103495033 |
FuruyaRei |
C |
Jan. 6, 2021, 2:45 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
0 |
|
|
103475235 |
RCG |
C |
Jan. 5, 2021, 7:14 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
0 |
|
|
103473920 |
cerberus97 |
C |
Jan. 5, 2021, 7 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
0 |
|
|
103473372 |
vito1036 |
C |
Jan. 5, 2021, 6:54 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
31 |
0 |
|
|
103431844 |
atomicenergy |
C |
Jan. 5, 2021, 3:34 p.m. |
OK |
GNU C++17 |
TESTS |
77 |
31 |
0 |
|
|
103429394 |
Errichto |
C |
Jan. 5, 2021, 3:29 p.m. |
OK |
GNU C++17 |
TESTS |
77 |
31 |
0 |
|
|
103506427 |
Kerim.K |
C |
Jan. 6, 2021, 5:59 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
0 |
|
|
103506553 |
Kerim.K |
C |
Jan. 6, 2021, 6 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
0 |
|
|
103506496 |
Kerim.K |
C |
Jan. 6, 2021, 6 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
0 |
|
|
103506439 |
Kerim.K |
C |
Jan. 6, 2021, 5:59 a.m. |
OK |
GNU C++17 |
TESTS |
78 |
46 |
0 |
|
|
103498101 |
qdd |
C |
Jan. 6, 2021, 3:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103497946 |
Evil__Coder |
C |
Jan. 6, 2021, 3:47 a.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103495741 |
suncongbo |
C |
Jan. 6, 2021, 3:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103485276 |
3ijk2ikj1kij |
C |
Jan. 5, 2021, 10:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103481802 |
brunomont |
C |
Jan. 5, 2021, 8:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103478341 |
DreamingLeaf |
C |
Jan. 5, 2021, 7:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103475246 |
MarcosK |
C |
Jan. 5, 2021, 7:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103475215 |
MarcosK |
C |
Jan. 5, 2021, 7:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
31 |
0 |
|
|
103454930 |
Honey_Badger |
C |
Jan. 5, 2021, 4:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
77 |
31 |
0 |
|
|
103452107 |
minato |
C |
Jan. 5, 2021, 4:15 p.m. |
OK |
GNU C++17 (64) |
TESTS |
77 |
31 |
0 |
|
|
103490322 |
Agnimandur |
C |
Jan. 6, 2021, 12:42 a.m. |
OK |
Java 11 |
TESTS |
78 |
233 |
0 |
|
|
103435147 |
uwi |
C |
Jan. 5, 2021, 3:40 p.m. |
OK |
Java 11 |
TESTS |
77 |
233 |
0 |
|
|
103490527 |
Agnimandur |
C |
Jan. 6, 2021, 12:49 a.m. |
OK |
Java 11 |
TESTS |
78 |
264 |
0 |
|
|
103452285 |
mikit |
C |
Jan. 5, 2021, 4:16 p.m. |
OK |
Java 11 |
TESTS |
77 |
389 |
614400 |
|
|
103496565 |
dalt |
C |
Jan. 6, 2021, 3:19 a.m. |
OK |
Java 8 |
TESTS |
78 |
155 |
0 |
|
|
103473204 |
fetetriste |
C |
Jan. 5, 2021, 6:53 p.m. |
OK |
Java 8 |
TESTS |
78 |
171 |
0 |
|
|
103446831 |
Tlatoani |
C |
Jan. 5, 2021, 4:03 p.m. |
OK |
Kotlin |
TESTS |
77 |
187 |
204800 |
|
|
103445073 |
pichulia |
C |
Jan. 5, 2021, 4 p.m. |
OK |
MS C++ 2017 |
TESTS |
77 |
46 |
1638400 |
|
|
103459835 |
tarattata1 |
C |
Jan. 5, 2021, 4:32 p.m. |
OK |
MS C++ 2017 |
TESTS |
77 |
61 |
0 |
|
|
103449810 |
Yupiteru |
C |
Jan. 5, 2021, 4:10 p.m. |
OK |
.NET Core C# |
TESTS |
77 |
124 |
0 |
|
|
103482099 |
TheVan |
C |
Jan. 5, 2021, 8:56 p.m. |
OK |
PyPy 3 |
TESTS |
78 |
186 |
1433600 |
|
|
103473718 |
titia |
C |
Jan. 5, 2021, 6:58 p.m. |
OK |
PyPy 3 |
TESTS |
78 |
187 |
0 |
|
|
103459389 |
TheVan |
C |
Jan. 5, 2021, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
187 |
1433600 |
|
|
103473547 |
titia |
C |
Jan. 5, 2021, 6:56 p.m. |
OK |
PyPy 3 |
TESTS |
78 |
187 |
1536000 |
|
|
103458488 |
asdsasd |
C |
Jan. 5, 2021, 4:29 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
187 |
2048000 |
|
|
103437536 |
yuusanlondon |
C |
Jan. 5, 2021, 3:44 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
202 |
2252800 |
|
|
103448358 |
conqueror_of_tourist |
C |
Jan. 5, 2021, 4:07 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
561 |
11468800 |
|
|
103442538 |
tobias.glimmerfors |
C |
Jan. 5, 2021, 3:54 p.m. |
OK |
PyPy 3 |
TESTS |
77 |
561 |
11571200 |
|
|
103457341 |
Kiri8128 |
C |
Jan. 5, 2021, 4:27 p.m. |
OK |
Python 3 |
TESTS |
77 |
139 |
307200 |
|
|
103458234 |
mkawa2 |
C |
Jan. 5, 2021, 4:29 p.m. |
OK |
Python 3 |
TESTS |
77 |
140 |
409600 |
|
|
103458305 |
sansen |
C |
Jan. 5, 2021, 4:29 p.m. |
OK |
Rust |
TESTS |
77 |
61 |
0 |
|
|
remove filters
Back to search problems