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 |
---|---|---|---|---|---|---|
1905 | Codeforces Round 915 (Div. 2) | FINISHED | False | 7200 | 34442663 | Dec. 16, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 570 ) | F | Field Should Not Be Empty | PROGRAMMING | brute force data structures divide and conquer |
B'You are given a permutation ^{ dagger} p of length n . We call index x good if for all y < x it holds that p_y < p_x and for all y > x it holds that p_y > p_x . We call f(p) the number of good indices in p . You can perform the following operation: pick 2 distinct indices i and j and swap elements p_i and p_j . Find the maximum value of f(p) after applying the aforementioned operation exactly once. ^{ dagger} 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 consists of multiple test cases. The first line of contains a single integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the length of the permutation p . The second line of each test case contain n distinct integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n ) -- the elements of the permutation p . It is guaranteed that sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case, output a single integer -- the maximum value of f(p) after performing the operation exactly once. In the first test case, p = [1,2,3,4,5] and f(p)=5 which is already maximum possible. But must perform the operation anyway. We can get f(p)=3 by choosing i=1 and j=2 which makes p = [2,1,3,4,5] . In the second test case, we can transform p into [1,2,3,4,5] by choosing i=1 and j=2 . Thus f(p)=5 . '... |
Codeforces Round 915 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
237532675 | StarSilk | F | Dec. 16, 2023, 5:21 p.m. | OK | GNU C++14 | TESTS | 27 | 77 | 5939200 | ||
237538731 | qiangbao | F | Dec. 16, 2023, 6:17 p.m. | OK | GNU C++14 | TESTS | 27 | 109 | 4300800 | ||
237526562 | xvzhiming | F | Dec. 16, 2023, 4:34 p.m. | OK | GNU C++14 | TESTS | 27 | 202 | 35225600 | ||
237555415 | piyush_beegala | F | Dec. 16, 2023, 10:48 p.m. | OK | GNU C++14 | TESTS | 27 | 233 | 11468800 | ||
237522477 | rsegvic | F | Dec. 16, 2023, 4:23 p.m. | OK | GNU C++14 | TESTS | 27 | 249 | 6553600 | ||
237555508 | piyush_beegala | F | Dec. 16, 2023, 10:52 p.m. | OK | GNU C++14 | TESTS | 27 | 249 | 11468800 | ||
237546442 | bachawar_ayiitr | F | Dec. 16, 2023, 7:48 p.m. | OK | GNU C++14 | TESTS | 27 | 935 | 14540800 | ||
237551401 | Khaled_k | F | Dec. 16, 2023, 9:10 p.m. | OK | GNU C++17 | TESTS | 27 | 61 | 4096000 | ||
237520131 | potato167 | F | Dec. 16, 2023, 4:16 p.m. | OK | GNU C++17 | TESTS | 27 | 62 | 2662400 | ||
237566830 | cs142857 | F | Dec. 17, 2023, 4:21 a.m. | OK | GNU C++17 | TESTS | 27 | 62 | 3481600 | ||
237547590 | Yzm007 | F | Dec. 16, 2023, 8:05 p.m. | OK | GNU C++17 | TESTS | 27 | 62 | 6758400 | ||
237559593 | ikaurov | F | Dec. 17, 2023, 1:28 a.m. | OK | GNU C++17 | TESTS | 27 | 124 | 7577600 | ||
237519561 | int65536 | F | Dec. 16, 2023, 4:14 p.m. | OK | GNU C++17 | TESTS | 27 | 124 | 12288000 | ||
237549825 | patou | F | Dec. 16, 2023, 8:41 p.m. | OK | GNU C++17 | TESTS | 27 | 140 | 11776000 | ||
237543775 | El3ageed_Abu_Shehab | F | Dec. 16, 2023, 7:13 p.m. | OK | GNU C++17 | TESTS | 27 | 156 | 13004800 | ||
237531355 | D3AD.S0UL | F | Dec. 16, 2023, 5:11 p.m. | OK | GNU C++17 | TESTS | 27 | 186 | 23040000 | ||
237514520 | fractal | F | Dec. 16, 2023, 4 p.m. | OK | GNU C++17 | TESTS | 27 | 264 | 14028800 | ||
237529696 | ALILILILILI-KHAN | F | Dec. 16, 2023, 5 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 77 | 8294400 | ||
237568631 | Enaliy | F | Dec. 17, 2023, 4:58 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 124 | 7168000 | ||
237571596 | xuxuxuxuxu | F | Dec. 17, 2023, 5:47 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 124 | 65536000 | ||
237524992 | natsugiri | F | Dec. 16, 2023, 4:30 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 155 | 43724800 | ||
237558914 | DJ2006 | F | Dec. 17, 2023, 1:05 a.m. | OK | GNU C++17 (64) | TESTS | 27 | 156 | 18534400 | ||
237530349 | rniya | F | Dec. 16, 2023, 5:04 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 186 | 24166400 | ||
237552245 | mcdx9524 | F | Dec. 16, 2023, 9:27 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 202 | 31129600 | ||
237524131 | duanyuu | F | Dec. 16, 2023, 4:28 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 390 | 65740800 | ||
237531839 | Troubadour_Ggmz | F | Dec. 16, 2023, 5:14 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 405 | 17408000 | ||
237533958 | Troubadour_Ggmz | F | Dec. 16, 2023, 5:32 p.m. | OK | GNU C++17 (64) | TESTS | 27 | 436 | 17408000 | ||
237554898 | A_G | F | Dec. 16, 2023, 10:32 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 4300800 | ||
237553294 | Ormlis | F | Dec. 16, 2023, 9:50 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 5120000 | ||
237529753 | -1e11 | F | Dec. 16, 2023, 5:01 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 5529600 | ||
237528785 | Soumya1 | F | Dec. 16, 2023, 4:56 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 5529600 | ||
237561538 | Handsome2004 | F | Dec. 17, 2023, 2:22 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 6144000 | ||
237559607 | nguyenquocthinhhung | F | Dec. 17, 2023, 1:28 a.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 6348800 | ||
237529876 | StarSilk | F | Dec. 16, 2023, 5:01 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 6348800 | ||
237553489 | Top2Greece | F | Dec. 16, 2023, 9:53 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 46 | 6656000 | ||
237524317 | DzadzoD | F | Dec. 16, 2023, 4:28 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 62 | 19660800 | ||
237543213 | makrav | F | Dec. 16, 2023, 7:07 p.m. | OK | GNU C++20 (64) | TESTS | 27 | 93 | 18841600 | ||
237518242 | arvindf232 | F | Dec. 16, 2023, 4:10 p.m. | OK | Kotlin 1.6 | TESTS | 27 | 389 | 25804800 | ||
237530069 | byurak | F | Dec. 16, 2023, 5:02 p.m. | OK | PyPy 3-64 | TESTS | 27 | 436 | 31539200 | ||
237528578 | toor | F | Dec. 16, 2023, 4:56 p.m. | OK | Rust 2021 | TESTS | 27 | 202 | 13414400 |
Back to search problems