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 |
|---|---|---|---|---|---|---|
| 2165 | Codeforces Round 1064 (Div. 1) | FINISHED | False | 7200 | 13101923 | Nov. 16, 2025, 2:35 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 189 ) | F | Arctic Acquisition | PROGRAMMING | data structures |
You are given a permutation(^{\text{∗}}) (a_1,a_2,\ldots,a_n) of length (n). An interval (l,r) ((1\le l\le r\le n)) is jagged if and only if it contains a 21435-subsequence; that is, there exist integers (i_1,i_2,i_3,i_4,i_5) such that (l\le i_1<i_2<i_3<i_4<i_5\le r), and (a_{i_2}<a_{i_1}<a_{i_4}<a_{i_3}<a_{i_5}). Your task is to calculate how many of the (\frac{n(n+1)}2) intervals are jagged . (^{\text{∗}})A permutation of length (n) is an array consisting of (n) distinct integers from (1) to (n) 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 ((n=3) but there is (4) in the array). 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 a single integer (n) ((1\le n\le10^6)) — the length of the permutation. The second line of each test case contains (n) distinct integers (a_1,a_2,\ldots,a_n) ((1\le a_i\le n)). It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each test case, output the number of jagged subarrays. In the first test case, the only jagged subarray is (1,5), containing (2,1,4,3,5) as a subsequence. In the third test case, the subarray (1,8) is jagged because it contains (9,6,11,10,13) as a subsequence, which is a 21435-subsequence. |
| 148452 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 349322765 | JDScript0117 | F | Nov. 16, 2025, 4:30 p.m. | OK | C++17 (GCC 7-32) | TESTS | 56 | 1328 | 97382400 | ||
| 349363872 | VaHiX | F | Nov. 17, 2025, 2:35 a.m. | OK | C++17 (GCC 7-32) | TESTS | 56 | 1655 | 157491200 | ||
| 349329743 | Crystally | F | Nov. 16, 2025, 5:30 p.m. | OK | C++17 (GCC 7-32) | TESTS | 56 | 1749 | 157696000 | ||
| 349338534 | Ormlis | F | Nov. 16, 2025, 6:48 p.m. | OK | C++20 (GCC 13-64) | TESTS | 56 | 1217 | 69427200 | ||
| 349355806 | maspy | F | Nov. 16, 2025, 11:55 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 874 | 113766400 | ||
| 349326589 | ecnerwala | F | Nov. 16, 2025, 5:09 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 890 | 96460800 | ||
| 349350041 | hungchi17 | F | Nov. 16, 2025, 9:28 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 937 | 96460800 | ||
| 349326582 | Nachia | F | Nov. 16, 2025, 5:08 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1015 | 88780800 | ||
| 349327247 | Benq | F | Nov. 16, 2025, 5:12 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1046 | 100864000 | ||
| 349332220 | vedantkohad | F | Nov. 16, 2025, 5:51 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1062 | 161792000 | ||
| 349311050 | maroonrk | F | Nov. 16, 2025, 3:53 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1139 | 161792000 | ||
| 349328639 | Nachia | F | Nov. 16, 2025, 5:22 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1390 | 55910400 | ||
| 349344773 | namespace_std | F | Nov. 16, 2025, 8:03 p.m. | OK | C++23 (GCC 14-64, msys2) | TESTS | 56 | 1624 | 92467200 | ||
| 349314037 | rainboy | F | Nov. 16, 2025, 4:02 p.m. | OK | GNU C11 | TESTS | 56 | 733 | 40550400 | ||
| 349353142 | gua069 | F | Nov. 16, 2025, 10:33 p.m. | OK | Java 8 | TESTS | 56 | 968 | 64614400 |
Back to search problems