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 |
|---|---|---|---|---|---|---|
| 2044 | Codeforces Round 993 (Div. 4) | FINISHED | False | 8100 | 42132323 | Dec. 15, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 2571 ) | H | Hard Demon Problem | PROGRAMMING | data structures dp implementation math |
Swing is opening a pancake factory! A good pancake factory must be good at flattening things, so Swing is going to test his new equipment on 2D matrices. Swing is given an (n \times n) matrix (M) containing positive integers. He has (q) queries to ask you. For each query, he gives you four integers (x_1), (y_1), (x_2), (y_2) and asks you to flatten the submatrix bounded by ((x_1, y_1)) and ((x_2, y_2)) into an array (A). Formally, (A = M_{(x1,y1)}, M_{(x1,y1+1)}, \ldots, M_{(x1,y2)}, M_{(x1+1,y1)}, M_{(x1+1,y1+1)}, \ldots, M_{(x2,y2)}). The following image depicts the flattening of a submatrix bounded by the red dotted lines. The orange arrows denote the direction that the elements of the submatrix are appended to the back of (A), and (A) is shown at the bottom of the image. Afterwards, he asks you for the value of (\sum_{i=1}^{|A|} A_i \cdot i) (sum of (A_i \cdot i) over all (i)). The first line contains an integer (t) ((1 \leq t \leq 10^3)) — the number of test cases. The first line of each test contains two integers (n) and (q) ((1 \leq n \leq 2000, 1 \leq q \leq 10^6)) — the length of (M) and the number of queries. The following (n) lines contain (n) integers each, the (i)'th of which contains (M_{(i,1)}, M_{(i,2)}, \ldots, M_{(i,n)}) ((1 \leq M_{(i, j)} \leq 10^6)). The following (q) lines contain four integers (x_1), (y_1), (x_2), and (y_2) ((1 \leq x_1 \leq x_2 \leq n, 1 \leq y_1 \leq y_2 \leq n)) — the bounds of the query. It is guaranteed that the sum of (n) over all test cases does not exceed (2000) and the sum of (q) over all test cases does not exceed (10^6). For each test case, output the results of the (q) queries on a new line. In the second query of the first test case, (A = 9, 5, 5, 2). Therefore, the sum is (1 \cdot 9 + 2 \cdot 5 + 3 \cdot 5 + 4 \cdot 2 = 42). |
| Codeforces Round 993 (Div. 4) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 296783824 | fisher199 | H | Dec. 16, 2024, 2:49 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 780 | 104755200 | ||
| 296777158 | fbabic ToniB vito1036 | H | Dec. 15, 2024, 11:10 p.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2031 | 112844800 | ||
| 296792137 | Mimiron | H | Dec. 16, 2024, 5:10 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2077 | 96358400 | ||
| 296772369 | DOOMJUICE | H | Dec. 15, 2024, 9:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2077 | 112435200 | ||
| 296785698 | 201716080213 | H | Dec. 16, 2024, 3:26 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2093 | 97177600 | ||
| 296778887 | Huygd | H | Dec. 16, 2024, 12:16 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2108 | 96358400 | ||
| 296782679 | complexorigin | H | Dec. 16, 2024, 2:22 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2140 | 116531200 | ||
| 296782935 | hxano | H | Dec. 16, 2024, 2:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2140 | 129433600 | ||
| 296781220 | Kener_Castillo | H | Dec. 16, 2024, 1:39 a.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2156 | 99532800 | ||
| 296769207 | DeadlyCritic | H | Dec. 15, 2024, 8:21 p.m. | OK | C++17 (GCC 7-32) | TESTS | 7 | 2156 | 125235200 | ||
| 296783898 | fisher199 | H | Dec. 16, 2024, 2:51 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 421 | 104755200 | ||
| 296783097 | fisher199 | H | Dec. 16, 2024, 2:33 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 437 | 104755200 | ||
| 296787330 | fisher199 | H | Dec. 16, 2024, 3:56 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 452 | 104755200 | ||
| 296783807 | fisher199 | H | Dec. 16, 2024, 2:49 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 468 | 104755200 | ||
| 296787415 | fisher199 | H | Dec. 16, 2024, 3:57 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 483 | 104755200 | ||
| 296779536 | fisher199 | H | Dec. 16, 2024, 12:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 546 | 124518400 | ||
| 296782895 | fisher199 | H | Dec. 16, 2024, 2:28 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 546 | 142233600 | ||
| 296781847 | fisher199 | H | Dec. 16, 2024, 2 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 577 | 138137600 | ||
| 296782547 | fisher199 | H | Dec. 16, 2024, 2:19 a.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 593 | 142540800 | ||
| 296755501 | MattTheNub | H | Dec. 15, 2024, 5:53 p.m. | OK | C++20 (GCC 13-64) | TESTS | 7 | 640 | 117862400 | ||
| 296783833 | fisher199 | H | Dec. 16, 2024, 2:50 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 467 | 104755200 | ||
| 296788119 | m7a1g5i8k8a1r4p0 | H | Dec. 16, 2024, 4:10 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 640 | 129024000 | ||
| 296759657 | d5vdas | H | Dec. 15, 2024, 6:27 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1453 | 112435200 | ||
| 296769108 | IsacBieber | H | Dec. 15, 2024, 8:19 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1467 | 128921600 | ||
| 296762067 | xyktyjayket | H | Dec. 15, 2024, 6:50 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1515 | 117043200 | ||
| 296795255 | HugeMouse | H | Dec. 16, 2024, 5:47 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1530 | 116736000 | ||
| 296787710 | m7a1g5i8k8a1r4p0 | H | Dec. 16, 2024, 4:02 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1530 | 128921600 | ||
| 296755295 | rgnerdplayer | H | Dec. 15, 2024, 5:52 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1531 | 116940800 | ||
| 296783398 | fanhuaxingyu | H | Dec. 16, 2024, 2:39 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1546 | 134041600 | ||
| 296774808 | Leadd | H | Dec. 15, 2024, 10:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 7 | 1546 | 134246400 | ||
| 296783792 | fisher199 | H | Dec. 16, 2024, 2:49 a.m. | OK | GNU C11 | TESTS | 7 | 765 | 104755200 | ||
| 296751106 | pengin_2000 | H | Dec. 15, 2024, 5:20 p.m. | OK | GNU C11 | TESTS | 7 | 1827 | 128614400 | ||
| 296750370 | pengin_2000 | H | Dec. 15, 2024, 5:15 p.m. | OK | GNU C11 | TESTS | 7 | 2374 | 228966400 | ||
| 296796959 | achyut88 | H | Dec. 16, 2024, 6:04 a.m. | OK | Java 8 | TESTS | 7 | 3468 | 143462400 | ||
| 296756078 | Sandeep_P | H | Dec. 15, 2024, 5:58 p.m. | OK | PyPy 3-64 | TESTS | 7 | 1625 | 341708800 | ||
| 296779685 | PyIsTheBestLang | H | Dec. 16, 2024, 12:46 a.m. | OK | PyPy 3-64 | TESTS | 7 | 1640 | 339558400 | ||
| 296768806 | x3mka | H | Dec. 15, 2024, 8:15 p.m. | OK | PyPy 3-64 | TESTS | 7 | 1843 | 389120000 | ||
| 296745303 | harurun4635 | H | Dec. 15, 2024, 4:49 p.m. | OK | PyPy 3-64 | TESTS | 7 | 2453 | 315699200 | ||
| 296780091 | Leo25Darklight | H | Dec. 16, 2024, 12:58 a.m. | OK | PyPy 3-64 | TESTS | 7 | 2812 | 313446400 | ||
| 296771024 | Andrezu | H | Dec. 15, 2024, 8:50 p.m. | OK | PyPy 3-64 | TESTS | 7 | 2905 | 247091200 |
Back to search problems