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 |
---|---|---|---|---|---|---|
1686 | Codeforces Round 794 (Div. 2) | FINISHED | False | 8100 | 78323099 | May 25, 2022, 5:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 18327 ) | B | Odd Subarrays | PROGRAMMING | dp greedy |
B"For an array [b_1, b_2, ldots, b_m] define its number of inversions as the number of pairs (i, j) of integers such that 1 <= i < j <= m and b_i>b_j . Let's call array b odd if its number of inversions is odd. For example, array [4, 2, 7] is odd, as its number of inversions is 1 , while array [2, 1, 4, 3] isn't, as its number of inversions is 2 . You are given a permutation [p_1, p_2, ldots, p_n] of integers from 1 to n (each of them appears exactly once in the permutation). You want to split it into several consecutive subarrays (maybe just one), so that the number of the odd subarrays among them is as large as possible. What largest number of these subarrays may be odd? The first line of the input contains a single integer t ( 1 <= t <= 10^5 ) -- the number of test cases. The description of the test cases follows. The first line of each test case contains a single integer n ( 1 <= n <= 10^5 ) -- the size of the permutation. The second line of each test case contains n integers p_1, p_2, ldots, p_n ( 1 <= p_i <= n , all p_i are distinct) -- the elements of the permutation. The sum of n over all test cases doesn't exceed 2 cdot 10^5 . For each test case output a single integer -- the largest possible number of odd subarrays that you can get after splitting the permutation into several consecutive subarrays. In the first and third test cases, no matter how we split our permutation, there won't be any odd subarrays. In the second test case, we can split our permutation into subarrays [4, 3], [2, 1] , both of which are odd since their numbers of inversions are 1 . In the fourth test case, we can split our permutation into a single subarray [2, 1] , which is odd. In the fifth test case, we can split our permutation into subarrays [4, 5], [6, 1, 2, 3] . The first subarray has 0 inversions, an"... |
103198 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
158490553 | tabibi | B | May 26, 2022, 4:58 a.m. | OK | C# 8 | TESTS | 8 | 202 | 10854400 | ||
158530742 | fzkhzk | B | May 26, 2022, 1:15 p.m. | OK | Clang++17 Diagnostics | TESTS | 8 | 795 | 512000 | ||
158492604 | Sushanth675 | B | May 26, 2022, 5:31 a.m. | OK | Clang++17 Diagnostics | TESTS | 8 | 811 | 19968000 | ||
158480237 | shaanvg | B | May 26, 2022, 1:08 a.m. | OK | GNU C11 | TESTS | 8 | 46 | 409600 | ||
158510449 | akshat211103 | B | May 26, 2022, 9:24 a.m. | OK | GNU C11 | TESTS | 8 | 61 | 409600 | ||
158517518 | Death_on_2_Legs | B | May 26, 2022, 10:52 a.m. | OK | GNU C11 | TESTS | 8 | 62 | 409600 | ||
158476326 | aanjaimi | B | May 25, 2022, 10:36 p.m. | OK | GNU C11 | TESTS | 8 | 62 | 409600 | ||
158578272 | ahad.cse8.bu | B | May 27, 2022, 4:06 a.m. | OK | GNU C11 | TESTS | 8 | 62 | 409600 | ||
158567608 | hope.s.killed | B | May 26, 2022, 9:38 p.m. | OK | GNU C11 | TESTS | 8 | 62 | 409600 | ||
158564076 | ashu2002anand | B | May 26, 2022, 8:08 p.m. | OK | GNU C11 | TESTS | 8 | 62 | 409600 | ||
158501302 | SP2003 | B | May 26, 2022, 7:25 a.m. | OK | GNU C11 | TESTS | 8 | 77 | 409600 | ||
158485117 | xiaxiakeji | B | May 26, 2022, 3:15 a.m. | OK | GNU C++14 | TESTS | 8 | 15 | 1843200 | ||
158496145 | kritipandey | B | May 26, 2022, 6:19 a.m. | OK | GNU C++14 | TESTS | 8 | 31 | 819200 | ||
158471183 | Sadid_005 | B | May 25, 2022, 8:36 p.m. | OK | GNU C++14 | TESTS | 8 | 46 | 0 | ||
158531222 | p.ferrari | B | May 26, 2022, 1:20 p.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158509425 | duoluoluo | B | May 26, 2022, 9:11 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158527737 | SlayerJ | B | May 26, 2022, 12:44 p.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158583092 | HellPixar | B | May 27, 2022, 5:48 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158580297 | zltzlt | B | May 27, 2022, 4:55 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158545001 | extcfygvuhbjn | B | May 26, 2022, 3:40 p.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158540125 | yungchi | B | May 26, 2022, 2:49 p.m. | OK | GNU C++14 | TESTS | 8 | 46 | 409600 | ||
158541366 | jhc_123 | B | May 26, 2022, 3 p.m. | OK | GNU C++17 | TESTS | 8 | 15 | 17203200 | ||
158498135 | sararRafid | B | May 26, 2022, 6:43 a.m. | OK | GNU C++17 | TESTS | 8 | 31 | 409600 | ||
158484183 | sriramadithya36 | B | May 26, 2022, 2:55 a.m. | OK | GNU C++17 | TESTS | 8 | 31 | 409600 | ||
158480772 | __TheKing | B | May 26, 2022, 1:25 a.m. | OK | GNU C++17 | TESTS | 8 | 31 | 409600 | ||
158525112 | Pikku | B | May 26, 2022, 12:16 p.m. | OK | GNU C++17 | TESTS | 8 | 46 | 0 | ||
158478986 | Jaron-Jiang | B | May 26, 2022, 12:24 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 0 | ||
158492489 | ARJ_coder | B | May 26, 2022, 5:29 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 0 | ||
158510106 | Error_403 | B | May 26, 2022, 9:19 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 0 | ||
158514825 | hksharma | B | May 26, 2022, 10:19 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 0 | ||
158572419 | DapplingDot721 | B | May 27, 2022, 1:05 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 409600 | ||
158507459 | JA2012 | B | May 26, 2022, 8:44 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 15 | 1536000 | ||
158506168 | CartesianTree | B | May 26, 2022, 8:27 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 15 | 26521600 | ||
158486993 | Messywind | B | May 26, 2022, 3:52 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 30 | 1228800 | ||
158525236 | TomiokapEace | B | May 26, 2022, 12:17 p.m. | OK | GNU C++17 (64) | TESTS | 8 | 30 | 3993600 | ||
158473334 | ecnerwala | B | May 25, 2022, 9:13 p.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 0 | ||
158491323 | techie_Lite | B | May 26, 2022, 5:11 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 409600 | ||
158522540 | vjudge1 | B | May 26, 2022, 11:46 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 409600 | ||
158515255 | Rick_GT | B | May 26, 2022, 10:24 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 409600 | ||
158552854 | SorryMateWrongPath | B | May 26, 2022, 5:18 p.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 409600 | ||
158539656 | KumaREBEL | B | May 26, 2022, 2:45 p.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 409600 | ||
158574097 | Conqueror712 | B | May 27, 2022, 2:03 a.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 307200 | ||
158560310 | AbduSaber | B | May 26, 2022, 7 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 409600 | ||
158512884 | Anwar_Rizk | B | May 26, 2022, 9:54 a.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 614400 | ||
158473724 | magnus.hegdahl | B | May 25, 2022, 9:23 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 614400 | ||
158470684 | Pranav.exe | B | May 25, 2022, 8:29 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 614400 | ||
158534482 | Mangooste | B | May 26, 2022, 1:54 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 614400 | ||
158483784 | lucky_333 | B | May 26, 2022, 2:45 a.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 819200 | ||
158519896 | Prgl2001 | B | May 26, 2022, 11:18 a.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 819200 | ||
158547247 | YassineBY | B | May 26, 2022, 4:08 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 819200 | ||
158556662 | Ahmed7ossam | B | May 26, 2022, 6:07 p.m. | OK | GNU C++20 (64) | TESTS | 8 | 15 | 1126400 | ||
158503825 | poopoop | B | May 26, 2022, 7:57 a.m. | OK | Java 11 | TESTS | 8 | 155 | 0 | ||
158517339 | deepaksach | B | May 26, 2022, 10:50 a.m. | OK | Java 11 | TESTS | 8 | 170 | 0 | ||
158514771 | javaking | B | May 26, 2022, 10:18 a.m. | OK | Java 11 | TESTS | 8 | 171 | 0 | ||
158490613 | satyaa_78 | B | May 26, 2022, 4:59 a.m. | OK | Java 11 | TESTS | 8 | 171 | 0 | ||
158495776 | Juhaied_nabid | B | May 26, 2022, 6:14 a.m. | OK | Java 11 | TESTS | 8 | 186 | 0 | ||
158567642 | daftdove | B | May 26, 2022, 9:39 p.m. | OK | Java 11 | TESTS | 8 | 186 | 0 | ||
158579523 | the_unseen | B | May 27, 2022, 4:38 a.m. | OK | Java 11 | TESTS | 8 | 187 | 0 | ||
158493423 | x21svage | B | May 26, 2022, 5:43 a.m. | OK | Java 11 | TESTS | 8 | 187 | 0 | ||
158491956 | parth_13_ | B | May 26, 2022, 5:20 a.m. | OK | Java 11 | TESTS | 8 | 187 | 0 | ||
158485780 | kartikpapney | B | May 26, 2022, 3:27 a.m. | OK | Java 11 | TESTS | 8 | 187 | 0 | ||
158520349 | Koka | B | May 26, 2022, 11:23 a.m. | OK | Java 8 | TESTS | 8 | 109 | 0 | ||
158510761 | 20r11a6729 | B | May 26, 2022, 9:28 a.m. | OK | Java 8 | TESTS | 8 | 109 | 0 | ||
158562421 | param_2001 | B | May 26, 2022, 7:33 p.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158555060 | qlf9 | B | May 26, 2022, 5:45 p.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158527717 | less_ordinary | B | May 26, 2022, 12:44 p.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158519181 | Zicode | B | May 26, 2022, 11:10 a.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158511402 | aryaman_571 | B | May 26, 2022, 9:35 a.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158489693 | Kegure | B | May 26, 2022, 4:43 a.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158487483 | kewosihuzuobudao | B | May 26, 2022, 4:01 a.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158487413 | govindrajput | B | May 26, 2022, 4 a.m. | OK | Java 8 | TESTS | 8 | 124 | 0 | ||
158551575 | Flame239 | B | May 26, 2022, 5:02 p.m. | OK | Kotlin 1.4 | TESTS | 8 | 218 | 3686400 | ||
158528886 | WildTan | B | May 26, 2022, 12:56 p.m. | OK | Kotlin 1.6 | TESTS | 8 | 342 | 12697600 | ||
158523885 | IlyinAD | B | May 26, 2022, 12:01 p.m. | OK | MS C++ 2017 | TESTS | 8 | 170 | 614400 | ||
158558408 | LubaS2003 | B | May 26, 2022, 6:30 p.m. | OK | MS C++ 2017 | TESTS | 8 | 171 | 409600 | ||
158530087 | Lakii | B | May 26, 2022, 1:08 p.m. | OK | MS C++ 2017 | TESTS | 8 | 171 | 614400 | ||
158469827 | KarimShebl003 | B | May 25, 2022, 8:21 p.m. | OK | MS C++ 2017 | TESTS | 8 | 171 | 716800 | ||
158536569 | danthanhhuynhpham | B | May 26, 2022, 2:17 p.m. | OK | MS C++ 2017 | TESTS | 8 | 171 | 819200 | ||
158545572 | Kanata369 | B | May 26, 2022, 3:48 p.m. | OK | MS C++ 2017 | TESTS | 8 | 171 | 4812800 | ||
158540132 | Inspired | B | May 26, 2022, 2:49 p.m. | OK | Node.js | TESTS | 8 | 124 | 13721600 | ||
158489080 | n.n.n.kz | B | May 26, 2022, 4:33 a.m. | OK | PHP | TESTS | 8 | 77 | 14131200 | ||
158488384 | yoralbayev | B | May 26, 2022, 4:19 a.m. | OK | PHP | TESTS | 8 | 93 | 8396800 | ||
158490445 | misorin | B | May 26, 2022, 4:56 a.m. | OK | PyPy 3 | TESTS | 8 | 124 | 12288000 | ||
158470760 | hxu10 | B | May 25, 2022, 8:31 p.m. | OK | PyPy 3 | TESTS | 8 | 124 | 12595200 | ||
158549370 | abhi.ch891 | B | May 26, 2022, 4:34 p.m. | OK | PyPy 3 | TESTS | 8 | 155 | 14233600 | ||
158482113 | husnain | B | May 26, 2022, 2:06 a.m. | OK | PyPy 3 | TESTS | 8 | 202 | 13824000 | ||
158497097 | whatshisbucket | B | May 26, 2022, 6:31 a.m. | OK | PyPy 3 | TESTS | 8 | 217 | 11776000 | ||
158574317 | ON_THE_EDGE | B | May 27, 2022, 2:11 a.m. | OK | PyPy 3 | TESTS | 8 | 233 | 13721600 | ||
158488779 | ambs_ | B | May 26, 2022, 4:27 a.m. | OK | PyPy 3 | TESTS | 8 | 264 | 13619200 | ||
158469946 | tcltk | B | May 25, 2022, 8:22 p.m. | OK | PyPy 3 | TESTS | 8 | 264 | 15769600 | ||
158512290 | mmooyyii | B | May 26, 2022, 9:47 a.m. | OK | PyPy 3 | TESTS | 8 | 312 | 16486400 | ||
158493987 | MohammadsadraSedighin | B | May 26, 2022, 5:51 a.m. | OK | PyPy 3 | TESTS | 8 | 326 | 14028800 | ||
158542355 | s_prateek26 | B | May 26, 2022, 3:10 p.m. | OK | PyPy 3-64 | TESTS | 8 | 93 | 18124800 | ||
158498772 | pxhdg | B | May 26, 2022, 6:52 a.m. | OK | PyPy 3-64 | TESTS | 8 | 93 | 19558400 | ||
158493173 | only_for_kav_tripathi | B | May 26, 2022, 5:39 a.m. | OK | PyPy 3-64 | TESTS | 8 | 108 | 17920000 | ||
158514107 | skp_r | B | May 26, 2022, 10:09 a.m. | OK | PyPy 3-64 | TESTS | 8 | 109 | 22835200 | ||
158511465 | tushar26427 | B | May 26, 2022, 9:36 a.m. | OK | PyPy 3-64 | TESTS | 8 | 124 | 19558400 | ||
158562344 | RANK1ZEN | B | May 26, 2022, 7:32 p.m. | OK | PyPy 3-64 | TESTS | 8 | 124 | 24985600 | ||
158469973 | shobonvip | B | May 25, 2022, 8:22 p.m. | OK | PyPy 3-64 | TESTS | 8 | 140 | 18534400 | ||
158476349 | samchen123 | B | May 25, 2022, 10:37 p.m. | OK | PyPy 3-64 | TESTS | 8 | 155 | 17715200 | ||
158483808 | abhijeet.panihar.cse20 | B | May 26, 2022, 2:46 a.m. | OK | PyPy 3-64 | TESTS | 8 | 155 | 26009600 | ||
158496657 | hvbird | B | May 26, 2022, 6:25 a.m. | OK | PyPy 3-64 | TESTS | 8 | 171 | 16691200 | ||
158575219 | pennymagic156 | B | May 27, 2022, 2:39 a.m. | OK | Python 3 | TESTS | 8 | 124 | 7372800 | ||
158547930 | Harsha3408 | B | May 26, 2022, 4:16 p.m. | OK | Python 3 | TESTS | 8 | 139 | 9932800 | ||
158491092 | Pars03 | B | May 26, 2022, 5:07 a.m. | OK | Python 3 | TESTS | 8 | 156 | 7782400 | ||
158495359 | rex_phalange | B | May 26, 2022, 6:09 a.m. | OK | Python 3 | TESTS | 8 | 186 | 7372800 | ||
158512187 | Jmj13 | B | May 26, 2022, 9:45 a.m. | OK | Python 3 | TESTS | 8 | 186 | 9318400 | ||
158547377 | Nizum | B | May 26, 2022, 4:10 p.m. | OK | Python 3 | TESTS | 8 | 186 | 9420800 | ||
158490314 | NToneE | B | May 26, 2022, 4:54 a.m. | OK | Python 3 | TESTS | 8 | 186 | 9420800 | ||
158474640 | thevaibhavdixit | B | May 25, 2022, 9:46 p.m. | OK | Python 3 | TESTS | 8 | 186 | 9420800 | ||
158496679 | sahilwahi | B | May 26, 2022, 6:25 a.m. | OK | Python 3 | TESTS | 8 | 187 | 9318400 | ||
158574091 | Adityasingh_999 | B | May 27, 2022, 2:03 a.m. | OK | Python 3 | TESTS | 8 | 187 | 9420800 |
Back to search problems