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
This is the hard version of the problem. In this version, you must use the minimum number of queries possible. You can make hacks only if both versions of the problem are solved. This is an interactive problem . It is a tradition in Mexico's national IOI trainings to play the game " Asesino ", which is similar to " Among Us " or " Mafia ". Today, (n) players, numbered from (1) to (n), will play " Asesino " with the following three roles: Knight : a Knight is someone who always tells the truth. Knave : a Knave is someone who always lies. Impostor : an Impostor is someone everybody thinks is a Knight, but is secretly a Knave. Each player will be assigned a role in the game. There will be exactly one Impostor but there can be any (possible zero) number of Knights and Knaves. As the game moderator, you have accidentally forgotten the roles of everyone, but you need to determine the player who is the Impostor. To determine the Impostor, you will ask some questions. In each question, you will pick two players (i) and (j) ((1 \leq i, j \leq n); (i \neq j)) and ask if player (i) thinks that player (j) is a Knight. The results of the question is shown in the table below. Find the Impostor in the minimum number of queries possible. That is, let (f(n)) be the minimum integer such that for (n) players, there exists a strategy that can determine the Impostor using at most (f(n)) questions. Then, you should use at most (f(n)) questions to determine the Impostor. Note: the grader is adaptive: the roles of the players are not fixed in the beginning and may change depending on your questions. However, it is guaranteed that there exists an assignment of roles that is consistent with all previously asked questions under the constraints of this problem. The first line of input contains a single integer (t) ((1 \leq t \leq 10^3)) — the number of test cases. The description of the test cases follows. The first line of |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|
285743659 |
DereFer |
D2 |
Oct. 13, 2024, 10:25 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
593 |
102400 |
|
|
|
285732662 |
jdurie |
D2 |
Oct. 13, 2024, 9:09 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
593 |
102400 |
|
|
|
285767295 |
Waseem-Mustak |
D2 |
Oct. 14, 2024, 5:18 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
608 |
44134400 |
|
|
|
285748189 |
theRealChainman |
D2 |
Oct. 14, 2024, 12:18 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
609 |
102400 |
|
|
|
285744960 |
woruo27 |
D2 |
Oct. 13, 2024, 10:48 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
609 |
102400 |
|
|
|
285751569 |
candy0014 |
D2 |
Oct. 14, 2024, 1:33 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
624 |
102400 |
|
|
|
285744007 |
Kepy |
D2 |
Oct. 13, 2024, 10:30 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
624 |
102400 |
|
|
|
285750330 |
XiaY |
D2 |
Oct. 14, 2024, 1:10 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
640 |
102400 |
|
|
|
285736183 |
VHPro |
D2 |
Oct. 13, 2024, 9:21 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
655 |
102400 |
|
|
|
285745502 |
Sparkle_Twilight |
D2 |
Oct. 13, 2024, 11:01 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
30 |
656 |
102400 |
|
|
|
285750648 |
ifffer_2137 |
D2 |
Oct. 14, 2024, 1:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
468 |
102400 |
|
|
|
285757952 |
Ether13 |
D2 |
Oct. 14, 2024, 3:17 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
499 |
0 |
|
|
|
285757929 |
sdjfgh |
D2 |
Oct. 14, 2024, 3:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
499 |
0 |
|
|
|
285743269 |
RigBuhBuh |
D2 |
Oct. 13, 2024, 10:20 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
515 |
102400 |
|
|
|
285759515 |
jose_vales |
D2 |
Oct. 14, 2024, 3:40 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
562 |
102400 |
|
|
|
285753317 |
DanTheMan. |
D2 |
Oct. 14, 2024, 2:04 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
577 |
102400 |
|
|
|
285748118 |
angryarabianman |
D2 |
Oct. 14, 2024, 12:16 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
577 |
102400 |
|
|
|
285757375 |
Sin_Watt |
D2 |
Oct. 14, 2024, 3:08 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
577 |
409600 |
|
|
|
285745286 |
Lezy233 |
D2 |
Oct. 13, 2024, 10:56 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
577 |
5427200 |
|
|
|
285746887 |
IVO_12 |
D2 |
Oct. 13, 2024, 11:38 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
30 |
578 |
102400 |
|
|
|
285756099 |
FloatingOcean |
D2 |
Oct. 14, 2024, 2:47 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
514 |
102400 |
|
|
|
285726189 |
ecnerwala |
D2 |
Oct. 13, 2024, 8:46 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
546 |
102400 |
|
|
|
285761491 |
am_25 |
D2 |
Oct. 14, 2024, 4:08 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
561 |
102400 |
|
|
|
285742784 |
IWFPG |
D2 |
Oct. 13, 2024, 10:14 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
577 |
102400 |
|
|
|
285738121 |
jeroenodb |
D2 |
Oct. 13, 2024, 9:28 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
578 |
102400 |
|
|
|
285735472 |
sevlll777 |
D2 |
Oct. 13, 2024, 9:19 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
578 |
3993600 |
|
|
|
285754356 |
WRKRW |
D2 |
Oct. 14, 2024, 2:20 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
593 |
512000 |
|
|
|
285746996 |
Dominater069 |
D2 |
Oct. 13, 2024, 11:41 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
608 |
102400 |
|
|
|
285758944 |
N29 |
D2 |
Oct. 14, 2024, 3:32 a.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
624 |
102400 |
|
|
|
285742925 |
parsa333111 |
D2 |
Oct. 13, 2024, 10:15 p.m. |
OK |
C++23 (GCC 14-64, msys2) |
TESTS |
30 |
625 |
5120000 |
|
|
|
285747638 |
DarLam |
D2 |
Oct. 14, 2024, 12:01 a.m. |
OK |
Java 21 |
TESTS |
30 |
1921 |
716800 |
|
|
|
285764332 |
viraj07 |
D2 |
Oct. 14, 2024, 4:45 a.m. |
OK |
Java 21 |
TESTS |
30 |
1999 |
8294400 |
|
|
|
285769099 |
Shri_874 |
D2 |
Oct. 14, 2024, 5:40 a.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1374 |
8806400 |
|
|
|
285742916 |
TheRedstar |
D2 |
Oct. 13, 2024, 10:15 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1437 |
9216000 |
|
|
|
285745108 |
alexwice |
D2 |
Oct. 13, 2024, 10:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1483 |
7987200 |
|
|
|
285739376 |
tassei903 |
D2 |
Oct. 13, 2024, 9:32 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1499 |
9625600 |
|
|
|
285765382 |
vwxyz0 |
D2 |
Oct. 14, 2024, 4:57 a.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1531 |
9523200 |
|
|
|
285734744 |
ohys040411 |
D2 |
Oct. 13, 2024, 9:16 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1640 |
9318400 |
|
|
|
285732650 |
dyppp |
D2 |
Oct. 13, 2024, 9:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
30 |
1656 |
18841600 |
|
|
|
285742171 |
tifv |
D2 |
Oct. 13, 2024, 10:08 p.m. |
OK |
Rust 2021 |
TESTS |
30 |
702 |
102400 |
|
|
remove filters
Back to search problems