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 |
|---|---|---|---|---|---|---|
| 2046 | Codeforces Round 990 (Div. 1) | FINISHED | False | 7200 | 43198523 | Dec. 3, 2024, 6:25 a.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 16746 ) | A | Swap Columns and Find a Path | PROGRAMMING | greedy sortings |
There is a matrix consisting of (2) rows and (n) columns. The rows are numbered from (1) to (2) from top to bottom; the columns are numbered from (1) to (n) from left to right. Let's denote the cell on the intersection of the (i)-th row and the (j)-th column as ((i,j)). Each cell contains an integer; initially, the integer in the cell ((i,j)) is (a_{i,j}). You can perform the following operation any number of times (possibly zero): choose two columns and swap them (i. e. choose two integers (x) and (y) such that (1 \le x < y \le n), then swap (a_{1,x}) with (a_{1,y}), and then swap (a_{2,x}) with (a_{2,y})). After performing the operations, you have to choose a path from the cell ((1,1)) to the cell ((2,n)). For every cell ((i,j)) in the path except for the last, the next cell should be either ((i+1,j)) or ((i,j+1)). Obviously, the path cannot go outside the matrix. The cost of the path is the sum of all integers in all ((n+1)) cells belonging to the path. You have to perform the operations and choose a path so that its cost is maximum possible. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 5000)). The description of the test cases follows. Each test case consists of three lines: the first line contains one integer (n) ((1 \le n \le 5000)) — the number of columns in the matrix; the second line contains (n) integers (a_{1,1}, a_{1,2}, \ldots, a_{1,n}) ((-10^5 \le a_{i,j} \le 10^5)) — the first row of the matrix; the third line contains (n) integers (a_{2,1}, a_{2,2}, \ldots, a_{2,n}) ((-10^5 \le a_{i,j} \le 10^5)) — the second row of the matrix. It is guaranteed that the sum of (n) over all test cases does not exceed (5000). For each test case, print one integer — the maximum cost of a path you can obtain. Here are the explanations of the first three test |
| Разбор Codeforces Round 990 (Div. 2 + Div. 1) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 294534357 | mban259 | A | Dec. 3, 2024, 6:30 a.m. | OK | C# 10 | TESTS | 15 | 233 | 4096000 | ||
| 294534310 | zrnstnsr | A | Dec. 3, 2024, 6:30 a.m. | OK | C# 10 | TESTS | 15 | 233 | 5836800 | ||
| 294533865 | alexlikemath007 | A | Dec. 3, 2024, 6:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 0 | ||
| 294539467 | Sir-Ahmed-Imran | A | Dec. 3, 2024, 6:38 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 102400 | ||
| 294720603 | usnabi | A | Dec. 4, 2024, 5:58 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 102400 | ||
| 294639469 | Ngunguoi45 | A | Dec. 3, 2024, 2:41 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 102400 | ||
| 294550290 | lopzith | A | Dec. 3, 2024, 6:56 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 204800 | ||
| 294694239 | regain0002 | A | Dec. 3, 2024, 10:14 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 46 | 48128000 | ||
| 294640174 | donghuyhoang | A | Dec. 3, 2024, 2:45 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 61 | 0 | ||
| 294533794 | Sofapuden | A | Dec. 3, 2024, 6:29 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 61 | 0 | ||
| 294711397 | AsukaSaito | A | Dec. 4, 2024, 3:50 a.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 61 | 102400 | ||
| 294637293 | AlRntn | A | Dec. 3, 2024, 2:29 p.m. | OK | C++17 (GCC 7-32) | TESTS | 15 | 61 | 102400 | ||
| 294612754 | angry_r101 | A | Dec. 3, 2024, 12:15 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294716330 | Kotaro_chan | A | Dec. 4, 2024, 5:06 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294714621 | anirudhmittal21k12k | A | Dec. 4, 2024, 4:41 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294711364 | AHappyPotato | A | Dec. 4, 2024, 3:50 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294647755 | PassionFruitEnjoyer | A | Dec. 3, 2024, 3:32 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294626388 | Ichinoseyang | A | Dec. 3, 2024, 1:29 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294532927 | Hamed_Ghaffari | A | Dec. 3, 2024, 6:27 a.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 0 | ||
| 294663941 | Chef_OMF | A | Dec. 3, 2024, 5:16 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 102400 | ||
| 294673231 | kumarangel427 | A | Dec. 3, 2024, 6:19 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 102400 | ||
| 294662587 | jqdai0815 | A | Dec. 3, 2024, 5:07 p.m. | OK | C++20 (GCC 13-64) | TESTS | 15 | 46 | 102400 | ||
| 294685517 | konakarthik12 | A | Dec. 3, 2024, 8:18 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 0 | ||
| 294533343 | iakovlev.zakhar | A | Dec. 3, 2024, 6:28 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 0 | ||
| 294634833 | himanusia | A | Dec. 3, 2024, 2:16 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 102400 | ||
| 294708058 | Zihad_Hossain | A | Dec. 4, 2024, 2:47 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 102400 | ||
| 294616674 | ya_mewok | A | Dec. 3, 2024, 12:36 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 46 | 102400 | ||
| 294650455 | ayushmittal007 | A | Dec. 3, 2024, 3:49 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 61 | 0 | ||
| 294537609 | RaresFelix | A | Dec. 3, 2024, 6:35 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 61 | 0 | ||
| 294622987 | prajwalpatgar0 | A | Dec. 3, 2024, 1:11 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 61 | 102400 | ||
| 294689470 | madhavG | A | Dec. 3, 2024, 8:59 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 61 | 102400 | ||
| 294645161 | _isomorphism | A | Dec. 3, 2024, 3:15 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 15 | 61 | 102400 | ||
| 294533621 | KumaTachiRen | A | Dec. 3, 2024, 6:28 a.m. | OK | C# 8 | TESTS | 15 | 155 | 307200 | ||
| 294701469 | thecandle | A | Dec. 4, 2024, 1:16 a.m. | OK | GNU C11 | TESTS | 15 | 46 | 102400 | ||
| 294631329 | arpit45_8 | A | Dec. 3, 2024, 1:56 p.m. | OK | GNU C11 | TESTS | 15 | 78 | 204800 | ||
| 294708282 | 0x3F | A | Dec. 4, 2024, 2:52 a.m. | OK | Go | TESTS | 15 | 46 | 102400 | ||
| 294535007 | nguyenquocthao00 | A | Dec. 3, 2024, 6:31 a.m. | OK | Go | TESTS | 15 | 77 | 409600 | ||
| 294533743 | Quasicoherent | A | Dec. 3, 2024, 6:29 a.m. | OK | Java 21 | TESTS | 15 | 296 | 512000 | ||
| 294607041 | BalaramanM | A | Dec. 3, 2024, 11:42 a.m. | OK | Java 21 | TESTS | 15 | 343 | 716800 | ||
| 294712890 | ankushtyagi | A | Dec. 4, 2024, 4:13 a.m. | OK | Java 21 | TESTS | 15 | 358 | 1024000 | ||
| 294537094 | dusty.and.rusty | A | Dec. 3, 2024, 6:34 a.m. | OK | Java 21 | TESTS | 15 | 359 | 1433600 | ||
| 294626652 | vaibhav1701 | A | Dec. 3, 2024, 1:30 p.m. | OK | Java 8 | TESTS | 15 | 171 | 0 | ||
| 294543637 | fetetriste | A | Dec. 3, 2024, 6:44 a.m. | OK | Java 8 | TESTS | 15 | 186 | 0 | ||
| 294624959 | jzz2.0 | A | Dec. 3, 2024, 1:22 p.m. | OK | PyPy 3 | TESTS | 15 | 202 | 6656000 | ||
| 294537305 | hxu10 | A | Dec. 3, 2024, 6:35 a.m. | OK | PyPy 3-64 | TESTS | 15 | 109 | 3379200 | ||
| 294534841 | LMeyling | A | Dec. 3, 2024, 6:31 a.m. | OK | PyPy 3-64 | TESTS | 15 | 109 | 3788800 | ||
| 294553494 | 34z12000 | A | Dec. 3, 2024, 7:02 a.m. | OK | PyPy 3-64 | TESTS | 15 | 124 | 3686400 | ||
| 294534585 | Mukundan314 | A | Dec. 3, 2024, 6:30 a.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 3686400 | ||
| 294533788 | Haksell | A | Dec. 3, 2024, 6:29 a.m. | OK | PyPy 3-64 | TESTS | 15 | 140 | 3788800 | ||
| 294534336 | Alex239 | A | Dec. 3, 2024, 6:30 a.m. | OK | PyPy 3-64 | TESTS | 15 | 155 | 5427200 | ||
| 294533763 | PNJ0714 | A | Dec. 3, 2024, 6:29 a.m. | OK | PyPy 3-64 | TESTS | 15 | 155 | 5939200 | ||
| 294532730 | anango | A | Dec. 3, 2024, 6:26 a.m. | OK | PyPy 3-64 | TESTS | 15 | 156 | 5120000 | ||
| 294534259 | Navier_boltzmann | A | Dec. 3, 2024, 6:30 a.m. | OK | PyPy 3-64 | TESTS | 15 | 171 | 4198400 | ||
| 294716439 | hsn8086 | A | Dec. 4, 2024, 5:08 a.m. | OK | PyPy 3-64 | TESTS | 15 | 171 | 4403200 | ||
| 294623391 | kl_31363 | A | Dec. 3, 2024, 1:14 p.m. | OK | Python 3 | TESTS | 15 | 109 | 0 | ||
| 294680028 | eugalt | A | Dec. 3, 2024, 7:21 p.m. | OK | Python 3 | TESTS | 15 | 140 | 35430400 | ||
| 294534273 | PaciukZvichainyi | A | Dec. 3, 2024, 6:30 a.m. | OK | Rust 2021 | TESTS | 15 | 62 | 102400 |
Back to search problems