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 |
|---|---|---|---|---|---|---|
| 2124 | EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) | FINISHED | False | 10800 | 24593123 | July 6, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 186 ) | H | Longest Good Subsequence | PROGRAMMING | dp math |
Call an array (b) of size (m) good if the following conditions hold: (1 \leq b_i \leq i) for each (1 \leq i \leq m). There exists a permutation(^{\text{∗}}) (p) of size (m) such that for each (1 \leq i \leq m), (b_i) is the smallest integer where (\min(p_{b_i}, p_{b_i+1}, \ldots, p_i)=p_i). For example, the array (1,1,3,3,5) is good (where the permutation (p=2,1,5,3,4) satisfies the second requirement), but the array (1,1,2) isn't. Note the empty array is considered to be good . You are given an array (a) of size (n). Find the length of the longest good subsequence(^{\text{†}}) of (a). (^{\text{∗}})A permutation of length (m) is an array consisting of (m) distinct integers from (1) to (m) in arbitrary order. For example, (2,3,1,5,4) is a permutation, but (1,2,2) is not a permutation ((2) appears twice in the array), and (1,3,4) is also not a permutation ((m=3) but there is (4) in the array). (^{\text{†}})A sequence (c) is a subsequence of a sequence (d) if (c) can be obtained from (d) by the deletion of several (possibly, zero or all) element from arbitrary positions. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains an integer (n) ((1 \leq n \leq 15\,000)) – the length of (a). The second line of each test case contains (n) integers (a_1,a_2,\ldots,a_n) ((1 \leq a_i \leq n)) — denoting the array (a). It is guaranteed that the sum of (n^2) does not exceed (15\,000^2) over all test cases. For each test case, output the length of the longest good subsequence of (a) on a new line. In the first test case, the entire sequence is good . In the second test case, the longest good subsequence is (1,2). |
| EPIC Institute of Technology Round Summer 2025 (Codeforces Round 1036, Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 327846806 | KrishT_52 | H | July 6, 2025, 10:39 p.m. | OK | C++17 (GCC 7-32) | TESTS | 79 | 1124 | 448409600 | ||
| 327876619 | surajbhan99 | H | July 7, 2025, 5:57 a.m. | OK | C++17 (GCC 7-32) | TESTS | 79 | 1874 | 448102400 | ||
| 327815915 | RanRankeainie | H | July 6, 2025, 5:01 p.m. | OK | C++17 (GCC 7-32) | TESTS | 79 | 3546 | 902553600 | ||
| 327855723 | __baozii__ | H | July 7, 2025, 2:13 a.m. | OK | C++20 (GCC 13-64) | TESTS | 79 | 1561 | 448307200 | ||
| 327872165 | SID-211 | H | July 7, 2025, 5:18 a.m. | OK | C++20 (GCC 13-64) | TESTS | 79 | 1859 | 900505600 | ||
| 327873768 | lmh_qwq | H | July 7, 2025, 5:27 a.m. | OK | C++20 (GCC 13-64) | TESTS | 79 | 2125 | 902758400 | ||
| 327811434 | StarSilk | H | July 6, 2025, 4:46 p.m. | OK | C++20 (GCC 13-64) | TESTS | 79 | 2374 | 902348800 | ||
| 327816280 | jeroenodb | H | July 6, 2025, 5:02 p.m. | OK | C++20 (GCC 13-64) | TESTS | 79 | 5530 | 899788800 | ||
| 327843540 | maro_7atem365 | H | July 6, 2025, 9:26 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 984 | 449126400 | ||
| 327816545 | Nachia | H | July 6, 2025, 5:03 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 984 | 449126400 | ||
| 327846649 | Dominater069 | H | July 6, 2025, 10:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 1546 | 448409600 | ||
| 327874939 | nifeshe | H | July 7, 2025, 5:40 a.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 1764 | 902451200 | ||
| 327846615 | Dominater069 | H | July 6, 2025, 10:34 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 1843 | 900608000 | ||
| 327824349 | ecnerwala | H | July 6, 2025, 5:31 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 2249 | 447488000 | ||
| 327834709 | ecnerwala | H | July 6, 2025, 7:22 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 79 | 2327 | 447488000 | ||
| 327843264 | rainboy | H | July 6, 2025, 9:20 p.m. | OK | GNU C11 | TESTS | 79 | 968 | 901939200 |
Back to search problems