Codeforces Round 1021 (Div. 1)

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.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2097 Codeforces Round 1021 (Div. 1) FINISHED False 10800 30749123 April 26, 2025, 8:35 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1886 ) B Baggage Claim PROGRAMMING combinatorics dsu graphs math trees

Every airport has a baggage claim area, and Balbesovo Airport is no exception. At some point, one of the administrators at Sheremetyevo came up with an unusual idea: to change the traditional shape of the baggage claim conveyor from a carousel to a more complex form. Suppose that the baggage claim area is represented as a rectangular grid of size (n \times m). The administration proposed that the path of the conveyor should pass through the cells (p_1, p_2, \ldots, p_{2k+1}), where (p_i = (x_i, y_i)). For each cell (p_i) and the next cell (p_{i+1}) (where (1 \leq i \leq 2k)), these cells must share a common side. Additionally, the path must be simple, meaning that for no pair of indices (i \neq j) should the cells (p_i) and (p_j) coincide. Unfortunately, the route plan was accidentally spoiled by spilled coffee, and only the cells with odd indices of the path were preserved: (p_1, p_3, p_5, \ldots, p_{2k+1}). Your task is to determine the number of ways to restore the original complete path (p_1, p_2, \ldots, p_{2k+1}) given these (k+1) cells. Since the answer can be very large, output it modulo (10^9+7). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 3 \cdot 10^4)). The description of the test cases follows. The first line of each test case contains three integers (n), (m), and (k) ((1 \le n, m \le 1000), (n \cdot m \ge 3), (1 \le k \le \left\lfloor \frac12 (n m - 1) \right\rfloor)) — the dimensions of the grid and a parameter defining the length of the path. Next, there are (k+1) lines, the (i)-th of which contains two integers (x_{2i-1}) and (y_{2i-1}) ((1 \le x_{2i-1} \le n), (1 \le y_{2i-1} \le m)) — the coordinates of the cell (p_{2i-1}) that lies on the path. It is guaranteed that all pairs ((x_{2i-1}, y_{2i-1})) are distinct. It is guaranteed that the sum (n \cdot m) over

Tutorials

142316

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317357691 og.kostya B April 26, 2025, 3:57 p.m. OK C# 10 TESTS 13 124 16896000
317292124 while_zeze B April 26, 2025, 9:09 a.m. OK C++17 (GCC 7-32) TESTS 12 109 71065600
317406319 KSCD B April 27, 2025, 3:07 a.m. OK C++17 (GCC 7-32) TESTS 13 171 22118400
317293243 PengAo B April 26, 2025, 9:13 a.m. OK C++17 (GCC 7-32) TESTS 12 186 20070400
317294564 _luqyou_ B April 26, 2025, 9:18 a.m. OK C++17 (GCC 7-32) TESTS 12 187 30720000
317296907 SpinSpen B April 26, 2025, 9:26 a.m. OK C++17 (GCC 7-32) TESTS 12 202 10649600
317302705 Celebrate B April 26, 2025, 9:48 a.m. OK C++17 (GCC 7-32) TESTS 12 202 20480000
317291055 Potassium B April 26, 2025, 9:05 a.m. OK C++17 (GCC 7-32) TESTS 12 218 12288000
317288156 leinad2 B April 26, 2025, 8:56 a.m. OK C++17 (GCC 7-32) TESTS 12 218 30720000
317289258 zjy2008 B April 26, 2025, 8:59 a.m. OK C++17 (GCC 7-32) TESTS 12 233 24371200
317322767 madtreap B April 26, 2025, 11:17 a.m. OK C++17 (GCC 7-32) TESTS 12 249 31744000
317406790 www_bilibili_com B April 27, 2025, 3:18 a.m. OK C++20 (GCC 13-64) TESTS 13 92 43212800
317351791 vietnamchess69 B April 26, 2025, 2:58 p.m. OK C++20 (GCC 13-64) TESTS 13 93 43212800
317290863 xuanxuan001 B April 26, 2025, 9:04 a.m. OK C++20 (GCC 13-64) TESTS 12 108 16076800
317319124 Neil_Qian B April 26, 2025, 11 a.m. OK C++20 (GCC 13-64) TESTS 12 124 23142400
317334416 JDScript0117 B April 26, 2025, 12:38 p.m. OK C++20 (GCC 13-64) TESTS 13 140 43929600
317297066 kilomiles B April 26, 2025, 9:27 a.m. OK C++20 (GCC 13-64) TESTS 12 155 23859200
317294873 RanRankeainie B April 26, 2025, 9:19 a.m. OK C++20 (GCC 13-64) TESTS 12 155 34508800
317291592 20333333333 B April 26, 2025, 9:07 a.m. OK C++20 (GCC 13-64) TESTS 12 155 58265600
317290947 kotatsugame B April 26, 2025, 9:05 a.m. OK C++20 (GCC 13-64) TESTS 12 156 13414400
317293298 hirayuu_cf B April 26, 2025, 9:13 a.m. OK C++20 (GCC 13-64) TESTS 12 156 20377600
317333263 N_z__ B April 26, 2025, 12:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 93 21708800
317292550 w2y51c318 B April 26, 2025, 9:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 140 51200000
317299437 Xiaohuba B April 26, 2025, 9:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 155 19046400
317288061 Nyaan B April 26, 2025, 8:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 12492800
317287207 jiangly B April 26, 2025, 8:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 16486400
317288249 potato167 B April 26, 2025, 8:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 16691200
317348102 ttamx B April 26, 2025, 2:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 13 171 21708800
317306113 iridescent_1024 B April 26, 2025, 10:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 28569600
317294145 installb B April 26, 2025, 9:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 40038400
317287516 maspy B April 26, 2025, 8:54 a.m. OK C++23 (GCC 14-64, msys2) TESTS 12 171 42188800
317283509 hos.lyric B April 26, 2025, 8:44 a.m. OK D TESTS 12 515 20889600
317300531 Gassa B April 26, 2025, 9:40 a.m. OK D TESTS 12 593 57958400
317367058 ahmedafeef B April 26, 2025, 5:31 p.m. OK GNU C11 TESTS 13 171 24166400
317294912 pengin_2000 B April 26, 2025, 9:19 a.m. OK GNU C11 TESTS 12 1156 82636800
317325783 cyclop5 B April 26, 2025, 11:30 a.m. OK Go TESTS 12 374 96153600
317334392 Transformer911 B April 26, 2025, 12:38 p.m. OK Go TESTS 13 640 126464000
317358780 DarLam B April 26, 2025, 4:10 p.m. OK Java 21 TESTS 13 1327 236339200
317313396 arnabmanna B April 26, 2025, 10:33 a.m. OK Java 8 TESTS 12 1796 184934400
317320350 elizarov B April 26, 2025, 11:05 a.m. OK Kotlin 1.9 TESTS 12 999 118681600
317309073 LMeyling B April 26, 2025, 10:14 a.m. OK PyPy 3 TESTS 12 1264 116224000
317358824 SPD_9X2 B April 26, 2025, 4:10 p.m. OK PyPy 3 TESTS 13 1405 168652800
317341137 kingmoshe B April 26, 2025, 1:29 p.m. OK PyPy 3 TESTS 13 1718 124620800
317307963 Z_actuary B April 26, 2025, 10:10 a.m. OK PyPy 3-64 TESTS 12 593 96768000
317290366 harurun4635 B April 26, 2025, 9:03 a.m. OK PyPy 3-64 TESTS 12 827 169472000
317386195 DarkTemplarDrop B April 26, 2025, 8:10 p.m. OK PyPy 3-64 TESTS 13 1077 146534400
317295381 chinerist B April 26, 2025, 9:20 a.m. OK PyPy 3-64 TESTS 12 1171 158822400
317315232 twosquares B April 26, 2025, 10:42 a.m. OK PyPy 3-64 TESTS 12 1343 120012800
317341723 fisk B April 26, 2025, 1:34 p.m. OK PyPy 3-64 TESTS 13 1343 222720000
317329941 phreshboyswag B April 26, 2025, 12:07 p.m. OK PyPy 3-64 TESTS 12 1452 232755200
317291547 golomb B April 26, 2025, 9:07 a.m. OK PyPy 3-64 TESTS 12 1593 137523200
317324765 Bronya_H B April 26, 2025, 11:26 a.m. OK PyPy 3-64 TESTS 12 1765 227840000
317349502 shashanksp851 B April 26, 2025, 2:37 p.m. OK Python 3 TESTS 13 999 56832000
317343194 phreshboyswag B April 26, 2025, 1:45 p.m. OK Python 3 TESTS 13 1937 228659200
317312297 sansen B April 26, 2025, 10:28 a.m. OK Rust 2021 TESTS 12 108 22732800
317301191 null_lambda B April 26, 2025, 9:42 a.m. OK Rust 2021 TESTS 12 264 69222400
317405114 JakeMate14 B April 27, 2025, 2:39 a.m. OK Rust 2021 TESTS 13 296 120012800
317294461 Dpkasd_12 B April 26, 2025, 9:17 a.m. OK Rust 2021 TESTS 12 311 100352000
317408451 darkkcyan B April 27, 2025, 3:56 a.m. OK Rust 2021 TESTS 13 468 140083200
317292905 DanielAnker B April 26, 2025, 9:12 a.m. OK Rust 2021 TESTS 12 1062 240128000

remove filters

Back to search problems