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 |
|---|---|---|---|---|---|---|
| 2003 | Codeforces Round 968 (Div. 2) | FINISHED | False | 7200 | 51895484 | Aug. 25, 2024, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 799 ) | F | Turtle and Three Sequences | PROGRAMMING | data structures dp graphs greedy meet-in-the-middle probabilities two pointers |
Piggy gives Turtle three sequences (a_1, a_2, \ldots, a_n), (b_1, b_2, \ldots, b_n), and (c_1, c_2, \ldots, c_n). Turtle will choose a subsequence of (1, 2, \ldots, n) of length (m), let it be (p_1, p_2, \ldots, p_m). The subsequence should satisfy the following conditions: (a_{p_1} \le a_{p_2} \le \cdots \le a_{p_m}); All (b_{p_i}) for all indices (i) are pairwise distinct , i.e., there don't exist two different indices (i), (j) such that (b_{p_i} = b_{p_j}). Help him find the maximum value of (\sum\limits_{i = 1}^m c_{p_i}), or tell him that it is impossible to choose a subsequence of length (m) that satisfies the conditions above. Recall that a sequence (a) is a subsequence of a sequence (b) if (a) can be obtained from (b) by the deletion of several (possibly, zero or all) elements. The first line contains two integers (n) and (m) ((1 \le n \le 3000), (1 \le m \le 5)) — the lengths of the three sequences and the required length of the subsequence. The second line contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le n)) — the elements of the sequence (a). The third line contains (n) integers (b_1, b_2, \ldots, b_n) ((1 \le b_i \le n)) — the elements of the sequence (b). The fourth line contains (n) integers (c_1, c_2, \ldots, c_n) ((1 \le c_i \le 10^4)) — the elements of the sequence (c). Output a single integer — the maximum value of (\sum\limits_{i = 1}^m c_{p_i}). If it is impossible to choose a subsequence of length (m) that satisfies the conditions above, output (-1). In the first example, we can choose (p = 1, 2), then (c_{p_1} + c_{p_2} = 1 + 4 = 5). We can't choose (p = 2, 4) since (a_2 > a_4), violating the first condition. We can't choose (p = 2, 3) either since (b_2 = b_3), violating the second condition. We can choose (p = 1, 4), but (c_1 + c_4 = 4) |
| sol-zh.pdf |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 278198329 | _LSA_ | F | Aug. 26, 2024, 4:44 a.m. | OK | C++14 (GCC 6-32) | TESTS | 67 | 375 | 921600 | ||
| 278194179 | huang123zs | F | Aug. 26, 2024, 3:43 a.m. | OK | C++14 (GCC 6-32) | TESTS | 67 | 390 | 1433600 | ||
| 278200015 | Worldwide_D | F | Aug. 26, 2024, 5:06 a.m. | OK | C++14 (GCC 6-32) | TESTS | 67 | 406 | 512000 | ||
| 278182478 | Hasan0540 | F | Aug. 25, 2024, 11:32 p.m. | OK | C++17 (GCC 7-32) | TESTS | 66 | 171 | 819200 | ||
| 278158301 | saptarshi8103 | F | Aug. 25, 2024, 6:10 p.m. | OK | C++17 (GCC 7-32) | TESTS | 65 | 312 | 2969600 | ||
| 278168966 | Sparkle_Twilight | F | Aug. 25, 2024, 7:50 p.m. | OK | C++17 (GCC 7-32) | TESTS | 66 | 327 | 102400 | ||
| 278199289 | WangTianzhuo | F | Aug. 26, 2024, 4:57 a.m. | OK | C++17 (GCC 7-32) | TESTS | 67 | 328 | 512000 | ||
| 278182428 | Hasan0540 | F | Aug. 25, 2024, 11:31 p.m. | OK | C++17 (GCC 7-32) | TESTS | 66 | 343 | 819200 | ||
| 278205423 | wind_cross | F | Aug. 26, 2024, 6:03 a.m. | OK | C++17 (GCC 7-32) | TESTS | 67 | 453 | 3993600 | ||
| 278182195 | Hasan0540 | F | Aug. 25, 2024, 11:24 p.m. | OK | C++17 (GCC 7-32) | TESTS | 66 | 608 | 819200 | ||
| 278149603 | Hata_no_Kokoro | F | Aug. 25, 2024, 4:34 p.m. | OK | C++17 (GCC 7-32) | TESTS | 65 | 624 | 3993600 | ||
| 278171336 | Hasan0540 | F | Aug. 25, 2024, 8:17 p.m. | OK | C++17 (GCC 7-32) | TESTS | 66 | 1046 | 102400 | ||
| 278155980 | potato167 | F | Aug. 25, 2024, 5:55 p.m. | OK | C++17 (GCC 7-32) | TESTS | 65 | 1374 | 102400 | ||
| 278157821 | abc864197532 | F | Aug. 25, 2024, 6:06 p.m. | OK | C++20 (GCC 13-64) | TESTS | 65 | 171 | 102400 | ||
| 278168645 | _user_ | F | Aug. 25, 2024, 7:47 p.m. | OK | C++20 (GCC 13-64) | TESTS | 66 | 265 | 102400 | ||
| 278173651 | Shantipriya | F | Aug. 25, 2024, 8:46 p.m. | OK | C++20 (GCC 13-64) | TESTS | 66 | 296 | 102400 | ||
| 278153302 | NimaAryan | F | Aug. 25, 2024, 5:41 p.m. | OK | C++20 (GCC 13-64) | TESTS | 65 | 311 | 102400 | ||
| 278189303 | Xiaohuba | F | Aug. 26, 2024, 2:17 a.m. | OK | C++20 (GCC 13-64) | TESTS | 67 | 311 | 921600 | ||
| 278194730 | chengcheng5677 | F | Aug. 26, 2024, 3:50 a.m. | OK | C++20 (GCC 13-64) | TESTS | 67 | 312 | 512000 | ||
| 278193994 | Pemguimn | F | Aug. 26, 2024, 3:40 a.m. | OK | C++20 (GCC 13-64) | TESTS | 67 | 312 | 921600 | ||
| 278198954 | pengyantong | F | Aug. 26, 2024, 4:53 a.m. | OK | C++20 (GCC 13-64) | TESTS | 67 | 327 | 512000 | ||
| 278153862 | StellarSpecter | F | Aug. 25, 2024, 5:44 p.m. | OK | C++20 (GCC 13-64) | TESTS | 65 | 327 | 5427200 | ||
| 278196609 | shengdanbucuo | F | Aug. 26, 2024, 4:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 67 | 343 | 512000 | ||
| 278161193 | neal | F | Aug. 25, 2024, 6:32 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 66 | 155 | 102400 | ||
| 278160944 | neal | F | Aug. 25, 2024, 6:30 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 66 | 186 | 0 | ||
| 278198916 | pengyantong | F | Aug. 26, 2024, 4:52 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 67 | 312 | 512000 | ||
| 278201890 | fireskydd | F | Aug. 26, 2024, 5:26 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 67 | 436 | 512000 | ||
| 278160473 | neal | F | Aug. 25, 2024, 6:26 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 66 | 467 | 0 | ||
| 278197261 | neal | F | Aug. 26, 2024, 4:28 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 67 | 561 | 0 | ||
| 278153948 | Anonyme | F | Aug. 25, 2024, 5:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 65 | 2343 | 204800 | ||
| 278169220 | Dominater069 | F | Aug. 25, 2024, 7:53 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 66 | 2468 | 0 | ||
| 278153963 | Wansur | F | Aug. 25, 2024, 5:44 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 65 | 2874 | 72908800 | ||
| 278168833 | Dominater069 | F | Aug. 25, 2024, 7:49 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 66 | 2984 | 0 | ||
| 278170166 | misorin | F | Aug. 25, 2024, 8:03 p.m. | OK | PyPy 3-64 | TESTS | 66 | 1374 | 8499200 | ||
| 278167521 | misorin | F | Aug. 25, 2024, 7:35 p.m. | OK | PyPy 3-64 | TESTS | 66 | 1921 | 12800000 | ||
| 278166091 | misorin | F | Aug. 25, 2024, 7:19 p.m. | OK | PyPy 3-64 | TESTS | 66 | 2187 | 14540800 | ||
| 278191270 | dona10khoa_nhd | F | Aug. 26, 2024, 2:57 a.m. | OK | PyPy 3-64 | TESTS | 67 | 2203 | 10240000 | ||
| 278170082 | misorin | F | Aug. 25, 2024, 8:03 p.m. | OK | PyPy 3-64 | TESTS | 66 | 2264 | 10342400 |
Back to search problems