Codeforces Round 972 (Div. 2)

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
2005 Codeforces Round 972 (Div. 2) FINISHED False 7200 50081123 Sept. 14, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1056 ) E2 Subtangle Game (Hard Version) PROGRAMMING dp games greedy implementation

This is the hard version of the problem. The differences between the two versions are the constraints on all the variables. You can make hacks only if both versions of the problem are solved. Tsovak and Narek are playing a game. They have an array (a) and a matrix (b) of integers with (n) rows and (m) columns, numbered from (1). The cell in the (i)-th row and the (j)-th column is ((i, j)). They are looking for the elements of (a) in turns; Tsovak starts first. Each time a player looks for a cell in the matrix containing the current element of (a) (Tsovak looks for the first, then Narek looks for the second, etc.). Let's say a player has chosen the cell ((r, c)). The next player has to choose his cell in the submatrix starting at ((r + 1, c + 1)) and ending in ((n, m)) (the submatrix can be empty if (r=n) or (c=m)). If a player cannot find such a cell (or the remaining submatrix is empty) or the array ends (the previous player has chosen the last element), then he loses. Your task is to determine the winner if the players play optimally. Note: since the input is large, you may need to optimize input/output for this problem. For example, in C++, it is enough to use the following lines at the start of the main() function: The first line of the input contains (t) ((1 \le t \le 1500)) – the number of test cases. The first line of each test case contains three integers (l), (n), and (m) ((1 \le l, n, m \le 1500)) – the size of the array and the sizes of the matrix. The second line contains (l) integers (a_1, a_2, a_3, \ldots a_l) ((1 \le a_i \le n \cdot m)) – the elements of the array (a). The (i)-th of the last (n) lines contains (m) integers (b_{i,1}, b_{i,2}, b_{i,3}, \ldots b_{i,m}) ((1 \le b_{i,j} \le n \cdot m)) – representing the (i)-th row of the matrix. It is guaranteed that the sum of (n \cdot m) over all test cases does not e

Tutorials

Discussion stream (With Hints)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
281285603 harsh_8484 E2 Sept. 14, 2024, 10:32 p.m. OK C++17 (GCC 7-32) TESTS 66 624 36352000
281285035 zeta_quark E2 Sept. 14, 2024, 10:19 p.m. OK C++17 (GCC 7-32) TESTS 66 624 36352000
281274923 rob00 E2 Sept. 14, 2024, 7:51 p.m. OK C++17 (GCC 7-32) TESTS 66 640 24473600
281274777 rob00 E2 Sept. 14, 2024, 7:50 p.m. OK C++17 (GCC 7-32) TESTS 66 640 28160000
281287984 m7a1g5i8k8a1r4p0 E2 Sept. 14, 2024, 11:33 p.m. OK C++17 (GCC 7-32) TESTS 66 671 39321600
281261479 enceladus_ E2 Sept. 14, 2024, 5:56 p.m. OK C++17 (GCC 7-32) TESTS 60 687 9728000
281254900 icosahedron E2 Sept. 14, 2024, 5:23 p.m. OK C++17 (GCC 7-32) TESTS 60 749 27852800
281295636 wenqizhi E2 Sept. 15, 2024, 2:28 a.m. OK C++17 (GCC 7-32) TESTS 66 812 36352000
281297932 Chenly E2 Sept. 15, 2024, 3:07 a.m. OK C++17 (GCC 7-32) TESTS 69 905 38707200
281270056 flyingkite E2 Sept. 14, 2024, 7:02 p.m. OK C++17 (GCC 7-32) TESTS 66 1015 122982400
281259504 415411 E2 Sept. 14, 2024, 5:45 p.m. OK C++20 (GCC 13-64) TESTS 60 156 18739200
281261257 marvinthang E2 Sept. 14, 2024, 5:55 p.m. OK C++20 (GCC 13-64) TESTS 60 327 19251200
281255013 Marckess E2 Sept. 14, 2024, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 60 437 27340800
281260448 VahanAbraham E2 Sept. 14, 2024, 5:50 p.m. OK C++20 (GCC 13-64) TESTS 60 437 36352000
281260032 VahanAbraham E2 Sept. 14, 2024, 5:48 p.m. OK C++20 (GCC 13-64) TESTS 60 452 36352000
281258330 415411 E2 Sept. 14, 2024, 5:39 p.m. OK C++20 (GCC 13-64) TESTS 60 483 16588800
281296440 adam01 E2 Sept. 15, 2024, 2:42 a.m. OK C++20 (GCC 13-64) TESTS 68 483 252006400
281298472 TomHUang E2 Sept. 15, 2024, 3:17 a.m. OK C++20 (GCC 13-64) TESTS 69 484 21196800
281302922 fishcathu. E2 Sept. 15, 2024, 4:29 a.m. OK C++20 (GCC 13-64) TESTS 72 499 18227200
281295775 Tx_Lcy E2 Sept. 15, 2024, 2:30 a.m. OK C++20 (GCC 13-64) TESTS 66 499 36352000
281262892 neal E2 Sept. 14, 2024, 6:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 421 80076800
281263801 a-c E2 Sept. 14, 2024, 6:11 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 468 36147200
281287841 Cypherknnows E2 Sept. 14, 2024, 11:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 66 499 36352000
281295471 SSL_TJH E2 Sept. 15, 2024, 2:25 a.m. OK C++23 (GCC 14-64, msys2) TESTS 66 499 65126400
281292819 anthonyaaab123 E2 Sept. 15, 2024, 1:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 66 546 74956800
281262891 neal E2 Sept. 14, 2024, 6:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 655 104857600
281299128 GoogleBot E2 Sept. 15, 2024, 3:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 71 781 25395200
281256322 sputn1k E2 Sept. 14, 2024, 5:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 1218 152985600
281256034 pashkinpeter E2 Sept. 14, 2024, 5:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 1265 194355200
281255433 sputn1k E2 Sept. 14, 2024, 5:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 60 1359 192716800
281261999 misorin E2 Sept. 14, 2024, 6 p.m. OK PyPy 3-64 TESTS 60 327 92160000
281262743 misorin E2 Sept. 14, 2024, 6:05 p.m. OK PyPy 3-64 TESTS 60 358 125235200
281266343 misorin E2 Sept. 14, 2024, 6:29 p.m. OK PyPy 3-64 TESTS 64 374 102297600
281257733 misorin E2 Sept. 14, 2024, 5:36 p.m. OK PyPy 3-64 TESTS 60 1139 55398400

remove filters

Back to search problems