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 |
---|---|---|---|---|---|---|
1637 | Codeforces Global Round 19 | FINISHED | False | 9000 | 92589863 | Feb. 12, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 14936 ) | B | MEX and Array | PROGRAMMING | brute force dp greedy math |
B"Let there be an array b_1, b_2, ldots, b_k . Let there be a partition of this array into segments [l_1; r_1], [l_2; r_2], ldots, [l_c; r_c] , where l_1 = 1 , r_c = k , and for any 2 <= q i <= q c holds that r_{i-1} + 1 = l_i . In other words, each element of the array belongs to exactly one segment. Let's define the cost of a partition as c + sum_{i = 1}^{c} operatorname{mex}( {b_{l_i}, b_{l_i + 1}, ldots, b_{r_i} }), where operatorname{mex} of a set of numbers S is the smallest non-negative integer that does not occur in the set S . In other words, the cost of a partition is the number of segments plus the sum of MEX over all segments. Let's define the value of an array b_1, b_2, ldots, b_k as the maximum possible cost over all partitions of this array. You are given an array a of size n . Find the sum of values of all its subsegments. An array x is a subsegment of an array y if x can be obtained from y by deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. The input contains several test cases. The first line contains one integer t ( 1 <= q t <= q 30 ) -- the number of test cases. The first line for each test case contains one integer n ( 1 <= q n <= q 100 ) -- the length of the array. The second line contains a sequence of integers a_1, a_2, ldots, a_n ( 0 <= q a_i <= q 10^9 ) -- the array elements. It is guaranteed that the sum of the values n over all test cases does not exceed 100 . For each test case print a single integer -- the answer to the problem. In the second test case: The sum of values over all subsegments equals to 4 + 3 + 1 + 3 + 2 + 1 = 14 . "... |
Tutorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
146189288 | hnust_linuo | B | Feb. 13, 2022, 3:37 a.m. | OK | GNU C11 | TESTS | 14 | 15 | 0 | ||
146191230 | MallaSailesh | B | Feb. 13, 2022, 4:12 a.m. | OK | GNU C11 | TESTS | 14 | 15 | 0 | ||
146183848 | Vinayak-14 | B | Feb. 13, 2022, 1:26 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146183647 | Zhengenxi | B | Feb. 13, 2022, 1:22 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146183610 | arunsingh1771999 | B | Feb. 13, 2022, 1:20 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146181254 | leexzq | B | Feb. 13, 2022, 12:12 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146177520 | Explode_Legacy | B | Feb. 12, 2022, 10:24 p.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146170416 | D-code | B | Feb. 12, 2022, 8:12 p.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146195908 | Vivekch_20 | B | Feb. 13, 2022, 5:25 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146188368 | shy_but_not_shy | B | Feb. 13, 2022, 3:18 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146195986 | ddshotaman | B | Feb. 13, 2022, 5:26 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 0 | ||
146193895 | patidarujjawal | B | Feb. 13, 2022, 4:57 a.m. | OK | GNU C++14 | TESTS | 14 | 0 | 102400 | ||
146196810 | bansal_ritik | B | Feb. 13, 2022, 5:36 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146194269 | Siddharth_Ar | B | Feb. 13, 2022, 5:02 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146191552 | mostafa_ayman | B | Feb. 13, 2022, 4:18 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146189209 | nibirjoydhar | B | Feb. 13, 2022, 3:35 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146197176 | coder_679 | B | Feb. 13, 2022, 5:40 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146188783 | Akshay_Nallagari | B | Feb. 13, 2022, 3:27 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146187713 | abhinavreddyboddu | B | Feb. 13, 2022, 3:03 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146187300 | abhinavreddyboddu | B | Feb. 13, 2022, 2:53 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146187068 | yexisu | B | Feb. 13, 2022, 2:48 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146189158 | Abid_Saharia | B | Feb. 13, 2022, 3:34 a.m. | OK | GNU C++17 | TESTS | 14 | 0 | 0 | ||
146167919 | kevinyang | B | Feb. 12, 2022, 7:39 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146198068 | Ryuk10 | B | Feb. 13, 2022, 5:51 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146193592 | bkifhr8 | B | Feb. 13, 2022, 4:52 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146191854 | luogu_bot2 | B | Feb. 13, 2022, 4:24 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146190119 | wsyhb | B | Feb. 13, 2022, 3:52 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146187129 | HenryG | B | Feb. 13, 2022, 2:49 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146181530 | froggyzhang | B | Feb. 13, 2022, 12:20 a.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146177286 | rgnerdplayer | B | Feb. 12, 2022, 10:18 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146176183 | zagvozdkin | B | Feb. 12, 2022, 9:51 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146170767 | ravager_23 | B | Feb. 12, 2022, 8:18 p.m. | OK | GNU C++17 (64) | TESTS | 14 | 0 | 0 | ||
146198951 | kaam_karo_faad_do | B | Feb. 13, 2022, 6:01 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146197648 | JuLoSpace | B | Feb. 13, 2022, 5:46 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146196223 | humble_fool46 | B | Feb. 13, 2022, 5:29 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146194963 | imtiyazrasool92 | B | Feb. 13, 2022, 5:12 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146191782 | Suvro1 | B | Feb. 13, 2022, 4:22 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146191627 | Bitmaskman | B | Feb. 13, 2022, 4:20 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146189580 | Zerologic_Infinity | B | Feb. 13, 2022, 3:43 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146187505 | Dog_food_is_me | B | Feb. 13, 2022, 2:58 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146186084 | ADguy-CN | B | Feb. 13, 2022, 2:23 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146199205 | KING-STAR | B | Feb. 13, 2022, 6:03 a.m. | OK | GNU C++20 (64) | TESTS | 14 | 0 | 0 | ||
146176345 | Toinfinity | B | Feb. 12, 2022, 9:55 p.m. | OK | Java 11 | TESTS | 14 | 155 | 0 | ||
146188078 | mrudul4935 | B | Feb. 13, 2022, 3:11 a.m. | OK | Java 11 | TESTS | 14 | 155 | 0 | ||
146186334 | 0archlinux0 | B | Feb. 13, 2022, 2:29 a.m. | OK | Java 11 | TESTS | 14 | 155 | 0 | ||
146169241 | dhruvil_01 | B | Feb. 12, 2022, 7:56 p.m. | OK | Java 11 | TESTS | 14 | 156 | 0 | ||
146189965 | yash13203 | B | Feb. 13, 2022, 3:50 a.m. | OK | Java 11 | TESTS | 14 | 156 | 0 | ||
146187745 | aditya2024 | B | Feb. 13, 2022, 3:04 a.m. | OK | Java 11 | TESTS | 14 | 156 | 0 | ||
146174464 | pras7946 | B | Feb. 12, 2022, 9:19 p.m. | OK | Java 11 | TESTS | 14 | 156 | 0 | ||
146192927 | nirala69 | B | Feb. 13, 2022, 4:41 a.m. | OK | Java 11 | TESTS | 14 | 171 | 0 | ||
146199151 | dhruvil8804 | B | Feb. 13, 2022, 6:03 a.m. | OK | Java 11 | TESTS | 14 | 171 | 0 | ||
146194069 | i2w2411 | B | Feb. 13, 2022, 5 a.m. | OK | Java 11 | TESTS | 14 | 171 | 0 | ||
146164999 | dogranmol | B | Feb. 12, 2022, 7:04 p.m. | OK | Java 8 | TESTS | 14 | 77 | 0 | ||
146175312 | Abdallah_Ragab00 | B | Feb. 12, 2022, 9:34 p.m. | OK | Java 8 | TESTS | 14 | 77 | 0 | ||
146161860 | gssakash | B | Feb. 12, 2022, 6:32 p.m. | OK | Java 8 | TESTS | 14 | 92 | 0 | ||
146150420 | ifajka | B | Feb. 12, 2022, 4:57 p.m. | OK | Java 8 | TESTS | 14 | 92 | 0 | ||
146163466 | ved20 | B | Feb. 12, 2022, 6:47 p.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146152107 | kartikpapney | B | Feb. 12, 2022, 5:01 p.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146159225 | Mohamed308 | B | Feb. 12, 2022, 6:11 p.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146195939 | govindrajput | B | Feb. 13, 2022, 5:25 a.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146170477 | ushikawa | B | Feb. 12, 2022, 8:13 p.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146168409 | DEMO23 | B | Feb. 12, 2022, 7:45 p.m. | OK | Java 8 | TESTS | 14 | 93 | 0 | ||
146152976 | sankalpbhushan281999 | B | Feb. 12, 2022, 5:03 p.m. | OK | Kotlin 1.4 | TESTS | 14 | 109 | 0 | ||
146173993 | PER | B | Feb. 12, 2022, 9:10 p.m. | OK | Kotlin 1.5 | TESTS | 14 | 187 | 0 | ||
146181676 | mo3az01 | B | Feb. 13, 2022, 12:25 a.m. | OK | Kotlin 1.5 | TESTS | 14 | 202 | 204800 | ||
146162268 | abdelrahman_rashed | B | Feb. 12, 2022, 6:36 p.m. | OK | MS C++ 2017 | TESTS | 14 | 15 | 0 | ||
146193330 | Tdyx | B | Feb. 13, 2022, 4:47 a.m. | OK | .NET Core C# | TESTS | 14 | 77 | 102400 | ||
146178543 | OLOGY | B | Feb. 12, 2022, 10:52 p.m. | OK | PyPy 2 | TESTS | 14 | 46 | 0 | ||
146167977 | fme | B | Feb. 12, 2022, 7:40 p.m. | OK | PyPy 2 | TESTS | 14 | 93 | 1126400 | ||
146157405 | 1_2_3_4_5_9 | B | Feb. 12, 2022, 6:01 p.m. | OK | PyPy 2 | TESTS | 14 | 108 | 307200 | ||
146182078 | FlakeLCR | B | Feb. 13, 2022, 12:37 a.m. | OK | PyPy 3 | TESTS | 14 | 77 | 0 | ||
146169573 | noobsatish | B | Feb. 12, 2022, 8 p.m. | OK | PyPy 3 | TESTS | 14 | 77 | 0 | ||
146169474 | noobsatish | B | Feb. 12, 2022, 7:59 p.m. | OK | PyPy 3 | TESTS | 14 | 77 | 0 | ||
146147116 | vikasreddy270 | B | Feb. 12, 2022, 4:48 p.m. | OK | PyPy 3 | TESTS | 14 | 77 | 2662400 | ||
146174781 | Hqxor | B | Feb. 12, 2022, 9:24 p.m. | OK | PyPy 3 | TESTS | 14 | 77 | 2764800 | ||
146190550 | NirmalScaria1 | B | Feb. 13, 2022, 4 a.m. | OK | PyPy 3 | TESTS | 14 | 78 | 1331200 | ||
146173443 | toam | B | Feb. 12, 2022, 9:01 p.m. | OK | PyPy 3 | TESTS | 14 | 78 | 1945600 | ||
146194319 | pufanyi | B | Feb. 13, 2022, 5:03 a.m. | OK | PyPy 3 | TESTS | 14 | 92 | 0 | ||
146197070 | MohammadsadraSedighin | B | Feb. 13, 2022, 5:39 a.m. | OK | PyPy 3 | TESTS | 14 | 92 | 1331200 | ||
146191247 | Youarenotgood | B | Feb. 13, 2022, 4:12 a.m. | OK | PyPy 3 | TESTS | 14 | 93 | 1433600 | ||
146166273 | Hdk2127 | B | Feb. 12, 2022, 7:19 p.m. | OK | PyPy 3-64 | TESTS | 14 | 61 | 0 | ||
146188705 | cofonewbie | B | Feb. 13, 2022, 3:25 a.m. | OK | PyPy 3-64 | TESTS | 14 | 62 | 2048000 | ||
146188696 | likaiwen923 | B | Feb. 13, 2022, 3:25 a.m. | OK | PyPy 3-64 | TESTS | 14 | 77 | 0 | ||
146147420 | tl3097 | B | Feb. 12, 2022, 4:49 p.m. | OK | PyPy 3-64 | TESTS | 14 | 77 | 0 | ||
146192982 | rutz12 | B | Feb. 13, 2022, 4:42 a.m. | OK | PyPy 3-64 | TESTS | 14 | 78 | 2150400 | ||
146182976 | titan23 | B | Feb. 13, 2022, 1:02 a.m. | OK | PyPy 3-64 | TESTS | 14 | 78 | 2560000 | ||
146160380 | krishnam_omar | B | Feb. 12, 2022, 6:19 p.m. | OK | PyPy 3-64 | TESTS | 14 | 92 | 512000 | ||
146160499 | KabirIvan | B | Feb. 12, 2022, 6:20 p.m. | OK | PyPy 3-64 | TESTS | 14 | 93 | 2048000 | ||
146183099 | titan23 | B | Feb. 13, 2022, 1:06 a.m. | OK | PyPy 3-64 | TESTS | 14 | 93 | 2150400 | ||
146149104 | DeathIsAwe | B | Feb. 12, 2022, 4:54 p.m. | OK | PyPy 3-64 | TESTS | 14 | 93 | 2662400 | ||
146178583 | OLOGY | B | Feb. 12, 2022, 10:53 p.m. | OK | Python 2 | TESTS | 14 | 31 | 0 | ||
146178547 | OLOGY | B | Feb. 12, 2022, 10:52 p.m. | OK | Python 2 | TESTS | 14 | 31 | 0 | ||
146157195 | OLOGY | B | Feb. 12, 2022, 6:01 p.m. | OK | Python 2 | TESTS | 14 | 31 | 0 | ||
146174399 | shengyuchill | B | Feb. 12, 2022, 9:17 p.m. | OK | Python 3 | TESTS | 14 | 31 | 0 | ||
146151464 | Goldeneye534 | B | Feb. 12, 2022, 4:59 p.m. | OK | Python 3 | TESTS | 14 | 31 | 0 | ||
146149254 | s7ubham | B | Feb. 12, 2022, 4:54 p.m. | OK | Python 3 | TESTS | 14 | 31 | 0 | ||
146180636 | nifty9 | B | Feb. 12, 2022, 11:55 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146180604 | nifty9 | B | Feb. 12, 2022, 11:54 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146170179 | THEarchitect | B | Feb. 12, 2022, 8:09 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146165899 | Tasia2001 | B | Feb. 12, 2022, 7:15 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146152673 | chitraketu | B | Feb. 12, 2022, 5:02 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146151973 | choko100 | B | Feb. 12, 2022, 5:01 p.m. | OK | Python 3 | TESTS | 14 | 46 | 0 | ||
146147688 | wKai000 | B | Feb. 12, 2022, 4:50 p.m. | OK | Python 3 | TESTS | 14 | 46 | 102400 | ||
146158969 | zhhhplus | B | Feb. 12, 2022, 6:09 p.m. | OK | Rust 2021 | TESTS | 14 | 15 | 0 | ||
146158361 | Romal_Vekasi | B | Feb. 12, 2022, 6:06 p.m. | OK | Scala | TESTS | 14 | 482 | 102400 |
Back to search problems