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. There are n^2 pepes labeled 1, 2, ldots, n^2 with pairwise distinct speeds. You would like to set up some races to find out the relative speed of these pepes. In one race, you can choose exactly n distinct pepes and make them race against each other. After each race, you will only know the fastest pepe of these n pepes. Can you order the n^2-n+1 fastest pepes in at most 2n^2 - 2n + 1 races? Note that the slowest n - 1 pepes are indistinguishable from each other. Note that the interactor is adaptive. That is, the relative speeds of the pepes are not fixed in the beginning and may depend on your queries. But it is guaranteed that at any moment there is at least one initial configuration of pepes such that all the answers to the queries are consistent. Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= t <= 10^4 ). The description of the test cases follows. The only line of each test case contains a single integer n ( 2 <= n <= 20 ) -- the number of pepes in one race. After reading the integer n for each test case, you should begin the interaction. It is guaranteed that the sum of n^3 over all test cases does not exceed 3 cdot 10^5 . To set up a race, print a line with the following format: After each race, you should read a line containing a single integer p ( 1 <= p <= n^2 ) -- the label of the fastest pepe in the race. When you know the n^2-n+1 fastest pepes, print one line in the following format: After that, move on to the next test case, or terminate the program if no more test cases are remaining. If your program performs more than 2n^2 - 2n + 1 races for one test case or makes an invalid race, you may receive a Wrong Answer verdict. After printing a query do not forget to output the end of the line and flush the output. Otherwise, you will get Idleness limit excee'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
234326406 |
rainboy |
G |
Nov. 25, 2023, 8 p.m. |
OK |
GNU C11 |
TESTS |
42 |
3696 |
0 |
|
|
234345230 |
_Guoyh_ |
G |
Nov. 26, 2023, 2:16 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
1200 |
307200 |
|
|
234295328 |
zh0ukangyang |
G |
Nov. 25, 2023, 4:33 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
967 |
40550400 |
|
|
234334311 |
Ant_Man |
G |
Nov. 25, 2023, 9:55 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
1045 |
512000 |
|
|
234302897 |
alireza_kaviani |
G |
Nov. 25, 2023, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
1060 |
204800 |
|
|
234333832 |
Ant_Man |
G |
Nov. 25, 2023, 9:46 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
1092 |
614400 |
|
|
234338334 |
Jasonwei08 |
G |
Nov. 25, 2023, 11:20 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
1106 |
204800 |
|
|
234334453 |
Ant_Man |
G |
Nov. 25, 2023, 9:57 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
1169 |
204800 |
|
|
234326443 |
rainboy |
G |
Nov. 25, 2023, 8 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
889 |
0 |
|
|
234316656 |
Geothermal |
G |
Nov. 25, 2023, 6:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
982 |
0 |
|
|
234344994 |
stkwill |
G |
Nov. 26, 2023, 2:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
997 |
0 |
|
|
234306994 |
353cerega |
G |
Nov. 25, 2023, 5:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
1029 |
0 |
|
|
234298164 |
xyz2606 |
G |
Nov. 25, 2023, 4:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
1076 |
204800 |
|
|
234353139 |
grass8sheep |
G |
Nov. 26, 2023, 4:41 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
1200 |
0 |
|
|
234315318 |
apoorv_me |
G |
Nov. 25, 2023, 6:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
1201 |
102400 |
|
|
234304455 |
liympanda |
G |
Nov. 25, 2023, 5:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
1247 |
102400 |
|
|
234306875 |
Vladithur |
G |
Nov. 25, 2023, 5:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
873 |
0 |
|
|
234296507 |
36champ |
G |
Nov. 25, 2023, 4:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
888 |
0 |
|
|
234339354 |
islingr |
G |
Nov. 25, 2023, 11:46 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
888 |
102400 |
|
|
234312960 |
ecnerwala |
G |
Nov. 25, 2023, 5:51 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
935 |
0 |
|
|
234339228 |
Sparkle_Twilight |
G |
Nov. 25, 2023, 11:44 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
951 |
0 |
|
|
234321800 |
gamegame |
G |
Nov. 25, 2023, 7:06 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
951 |
0 |
|
|
234313105 |
fallleaves07 |
G |
Nov. 25, 2023, 5:52 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
966 |
0 |
|
|
234344999 |
A_G |
G |
Nov. 26, 2023, 2:11 a.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
967 |
0 |
|
|
234333502 |
Benq |
G |
Nov. 25, 2023, 9:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
982 |
204800 |
|
|
234341497 |
TheScrasse |
G |
Nov. 26, 2023, 12:53 a.m. |
OK |
GNU C++20 (64) |
TESTS |
42 |
998 |
102400 |
|
|
234325300 |
arvindf232 |
G |
Nov. 25, 2023, 7:47 p.m. |
OK |
Kotlin 1.6 |
TESTS |
42 |
1778 |
1638400 |
|
|
234299745 |
Tlatoani |
G |
Nov. 25, 2023, 4:48 p.m. |
OK |
Kotlin 1.6 |
TESTS |
42 |
2167 |
1024000 |
|
|
234304068 |
robostac |
G |
Nov. 25, 2023, 5:03 p.m. |
OK |
Rust 2021 |
TESTS |
42 |
2012 |
819200 |
|
|
remove filters
Back to search problems