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 |
---|---|---|---|---|---|---|
1744 | Codeforces Round 828 (Div. 3) | FINISHED | False | 8100 | 65892299 | Oct. 16, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3142 ) | F | MEX vs MED | PROGRAMMING | brute force math two pointers |
B'You are given a permutation p_1, p_2, ldots, p_n of length n of numbers 0, ldots, n - 1 . Count the number of subsegments 1 <= q l <= q r <= q n of this permutation such that mex(p_l, p_{l+1}, ldots, p_r) > med(p_l, p_{l+1}, ldots, p_r) . mex of S is the smallest non-negative integer that does not occur in S . For example: med of the set S is the median of the set, i.e. the element that, after sorting the elements in non-decreasing order, will be at position number <= ft lfloor{ frac{|S| + 1}{2} } right rfloor (array elements are numbered starting from 1 and here <= ft lfloor{v} right rfloor denotes rounding v down.). For example: A sequence of n numbers is called a permutation if it contains all the numbers from 0 to n - 1 exactly once. The first line of the input contains a single integer t (1 <= q t <= q 10^4 ), the number of test cases. The descriptions of the test cases follow. The first line of each test case contains a single integer n ( 1 <= q n <= q 2 cdot 10^5 ), the length of the permutation p . The second line of each test case contains exactly n integers: p_1, p_2, ldots, p_n ( 0 <= q p_i <= q n - 1 ), elements of permutation p . It is guaranteed that the sum of n over all test cases does not exceed 2 cdot 10^5 . For each test case print the answer in a single line: the number of subsegments 1 <= q l <= q r <= q n of this permutation such that mex(p_l, p_{l+1}, ldots, p_r) > med(p_l, p_{l+1}, ldots, p_r) . The first test case contains exactly one subsegment and mex({0}) = 1 > med({0}) = 0 on it. In the third test case, on the following subsegments: [1, 0] , [0] , [1, 0, 2] and [0, 2] , mex is greater than med . In the fourth test case, on the following subsegments: [0, 2] , [0] , [0, 2, 1] and [0, 2, 1, 3]$'... |
Codeforces Round #828 (Div. 3) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
176639273 | WWW.H | F | Oct. 17, 2022, 5:24 a.m. | OK | GNU C++14 | TESTS | 31 | 61 | 1843200 | ||
176620700 | omeganot | F | Oct. 16, 2022, 9:44 p.m. | OK | GNU C++14 | TESTS | 31 | 61 | 2662400 | ||
176601988 | AIM-9X | F | Oct. 16, 2022, 5:49 p.m. | OK | GNU C++14 | TESTS | 31 | 61 | 4300800 | ||
176639312 | zmzh | F | Oct. 17, 2022, 5:24 a.m. | OK | GNU C++14 | TESTS | 31 | 62 | 1638400 | ||
176632246 | shenhaomin | F | Oct. 17, 2022, 3:09 a.m. | OK | GNU C++14 | TESTS | 31 | 62 | 1638400 | ||
176608647 | _Subrata | F | Oct. 16, 2022, 6:52 p.m. | OK | GNU C++14 | TESTS | 31 | 62 | 2662400 | ||
176603200 | Jxust | F | Oct. 16, 2022, 5:59 p.m. | OK | GNU C++14 | TESTS | 31 | 62 | 2662400 | ||
176602993 | tapanmollik | F | Oct. 16, 2022, 5:57 p.m. | OK | GNU C++14 | TESTS | 31 | 62 | 2662400 | ||
176588228 | antriksh11 | F | Oct. 16, 2022, 4:43 p.m. | OK | GNU C++14 | TESTS | 31 | 62 | 2662400 | ||
176633190 | system_1 | F | Oct. 17, 2022, 3:27 a.m. | OK | GNU C++14 | TESTS | 31 | 62 | 3584000 | ||
176625335 | huyaowen | F | Oct. 17, 2022, 12:25 a.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1843200 | ||
176597943 | Yzm007 | F | Oct. 16, 2022, 5:17 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1843200 | ||
176596783 | Yzm007 | F | Oct. 16, 2022, 5:09 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1843200 | ||
176597165 | artshcherbina | F | Oct. 16, 2022, 5:12 p.m. | OK | GNU C++17 | TESTS | 31 | 61 | 2867200 | ||
176633905 | Hamine | F | Oct. 17, 2022, 3:40 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 819200 | ||
176640189 | BigDickman | F | Oct. 17, 2022, 5:38 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 1638400 | ||
176635787 | Firefrog418 | F | Oct. 17, 2022, 4:16 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 1638400 | ||
176634212 | zgt2001 | F | Oct. 17, 2022, 3:46 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 1638400 | ||
176632014 | Feng_D | F | Oct. 17, 2022, 3:04 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 1638400 | ||
176630983 | pjshwa | F | Oct. 17, 2022, 2:44 a.m. | OK | GNU C++17 | TESTS | 31 | 62 | 1638400 | ||
176639143 | KylinKSY | F | Oct. 17, 2022, 5:23 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 15 | 1228800 | ||
176639969 | Freedom__King | F | Oct. 17, 2022, 5:35 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 15 | 9113600 | ||
176639321 | KylinKSY | F | Oct. 17, 2022, 5:25 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 31 | 1228800 | ||
176608450 | zeref | F | Oct. 16, 2022, 6:50 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 31 | 4403200 | ||
176595220 | RohitRKS | F | Oct. 16, 2022, 5:01 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 31 | 6041600 | ||
176635844 | yaoveil | F | Oct. 17, 2022, 4:17 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 1638400 | ||
176633779 | guud222 | F | Oct. 17, 2022, 3:38 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 1638400 | ||
176630567 | yaoveil | F | Oct. 17, 2022, 2:36 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 1638400 | ||
176630540 | yaoveil | F | Oct. 17, 2022, 2:35 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 1638400 | ||
176621914 | 6host | F | Oct. 16, 2022, 10:12 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 2048000 | ||
176620923 | NeutrO.onstr | F | Oct. 16, 2022, 9:48 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 2048000 | ||
176595972 | Richw818 | F | Oct. 16, 2022, 5:05 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 2048000 | ||
176596359 | AgOH | F | Oct. 16, 2022, 5:07 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 2867200 | ||
176595654 | AgOH | F | Oct. 16, 2022, 5:03 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 2867200 | ||
176629920 | FzArK | F | Oct. 17, 2022, 2:23 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 3174400 | ||
176637420 | DimmyT | F | Oct. 17, 2022, 4:46 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 46 | 819200 | ||
176631133 | ViTe | F | Oct. 17, 2022, 2:47 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 46 | 819200 | ||
176635495 | oldyan | F | Oct. 17, 2022, 4:10 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 46 | 1638400 | ||
176635356 | Aman_j1 | F | Oct. 17, 2022, 4:07 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 46 | 1638400 | ||
176629721 | Hatsune_MikuOvO | F | Oct. 17, 2022, 2:19 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 46 | 1638400 | ||
176626368 | Hasker | F | Oct. 17, 2022, 12:55 a.m. | OK | Haskell | TESTS | 31 | 93 | 26931200 | ||
176608569 | dzhi | F | Oct. 16, 2022, 6:51 p.m. | OK | Java 11 | TESTS | 31 | 296 | 31948800 | ||
176629708 | Mamimi | F | Oct. 17, 2022, 2:19 a.m. | OK | Java 17 | TESTS | 31 | 233 | 614400 | ||
176597355 | TCchen | F | Oct. 16, 2022, 5:13 p.m. | OK | Java 17 | TESTS | 31 | 249 | 40550400 | ||
176599449 | TCchen | F | Oct. 16, 2022, 5:27 p.m. | OK | Java 17 | TESTS | 31 | 264 | 40448000 | ||
176598211 | TCchen | F | Oct. 16, 2022, 5:18 p.m. | OK | Java 17 | TESTS | 31 | 264 | 40652800 | ||
176595032 | Eldies | F | Oct. 16, 2022, 5 p.m. | OK | MS C++ 2017 | TESTS | 31 | 156 | 2764800 | ||
176592584 | yali100 | F | Oct. 16, 2022, 4:49 p.m. | OK | MS C++ 2017 | TESTS | 31 | 171 | 5734400 | ||
176597691 | shaokang | F | Oct. 16, 2022, 5:15 p.m. | OK | Node.js | TESTS | 31 | 155 | 25702400 | ||
176588747 | amit_dwivedi | F | Oct. 16, 2022, 4:44 p.m. | OK | PyPy 2 | TESTS | 31 | 202 | 34918400 | ||
176602674 | Alex239 | F | Oct. 16, 2022, 5:54 p.m. | OK | PyPy 3-64 | TESTS | 31 | 140 | 47718400 | ||
176610931 | sushmanth.dampur8780 | F | Oct. 16, 2022, 7:18 p.m. | OK | PyPy 3-64 | TESTS | 31 | 187 | 49664000 | ||
176593737 | uwuenvy | F | Oct. 16, 2022, 4:54 p.m. | OK | PyPy 3-64 | TESTS | 31 | 390 | 53964800 | ||
176616298 | lionel.m | F | Oct. 16, 2022, 8:26 p.m. | OK | PyPy 3-64 | TESTS | 31 | 404 | 47923200 | ||
176595495 | acfinity | F | Oct. 16, 2022, 5:02 p.m. | OK | PyPy 3-64 | TESTS | 31 | 421 | 69529600 | ||
176595737 | Little_Sheep_Yawn | F | Oct. 16, 2022, 5:03 p.m. | OK | PyPy 3-64 | TESTS | 31 | 498 | 67993600 | ||
176595231 | KazTran | F | Oct. 16, 2022, 5:01 p.m. | OK | Python 3 | TESTS | 31 | 452 | 18432000 | ||
176606345 | Manikya_0309 | F | Oct. 16, 2022, 6:28 p.m. | OK | Python 3 | TESTS | 31 | 482 | 18432000 |
Back to search problems