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. You are given a grid with n rows and m columns. You need to fill each cell with a unique integer from 1 to n cdot m . After filling the grid, you will play a game on this grid against the interactor. Players take turns selecting one of the previously unselected cells from the grid, with the interactor going first. On the first turn, the interactor can choose any cell from the grid. After that, any chosen cell must be orthogonally adjacent to at least one previously selected cell. Two cells are considered orthogonally adjacent if they share an edge. The game continues until all cells have been selected. Your goal is to let the sum of numbers in the cells selected by you be strictly less than the sum of numbers in the cells selected by the interactor. Each test contains multiple test cases. The first line contains a single integer t ( 1 <= t <= 100 ) -- the number of test cases. The description of test cases follows. The only line of each test case contains two integers n and m ( 4 <= n, m <= 10 ) -- the number of rows and columns in the grid. First, output n lines, each containing m integers, representing the integers that you filled in the grid. Each integer from 1 to n cdot m should appear exactly once. Then, the game begins. The interactor and you take turns outputting coordinates to select a cell for n x m turns, with the interactor starting first. On each player 's (either you or the interactor) turn, the player will output two integers i and j ( 1 <= i <= n , 1 <= j <= m ), denoting that the player has selected the cell on the i -th row and j -th column. This cell should not have been selected in a previous round. Additionally, if it is not the first turn, the cell must be orthogonally adjacent to at least one previously selected cell. If any of your outputs are invalid, the jury will output "-'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
273236726 |
Prateek_2005 |
I |
July 28, 2024, 7:07 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
874 |
102400 |
|
|
273263580 |
Sparkle_Twilight |
I |
July 29, 2024, 2:14 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
921 |
0 |
|
|
273238749 |
ksun48 |
I |
July 28, 2024, 7:24 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
100 |
967 |
0 |
|
|
273240614 |
Ashish_Jha_ |
I |
July 28, 2024, 7:44 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
828 |
0 |
|
|
273238963 |
ugly2333 |
I |
July 28, 2024, 7:26 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
890 |
0 |
|
|
273236345 |
bitset |
I |
July 28, 2024, 7:04 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
921 |
0 |
|
|
273266030 |
aklk1ng |
I |
July 29, 2024, 2:43 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
937 |
0 |
|
|
273264715 |
Richard1211 |
I |
July 29, 2024, 2:27 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
984 |
102400 |
|
|
273235275 |
Blue_Asura |
I |
July 28, 2024, 6:58 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
100 |
999 |
0 |
|
|
remove filters
Back to search problems