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 |
---|---|---|---|---|---|---|
1437 | Educational Codeforces Round 97 (Rated for Div. 2) | FINISHED | False | 7200 | 133543511 | Oct. 27, 2020, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 13042 ) | D | Minimal Height Tree | PROGRAMMING | graphs greedy shortest paths trees |
B"Monocarp had a tree which consisted of n vertices and was rooted at vertex 1 . He decided to study BFS (Breadth-first search), so he ran BFS on his tree, starting from the root. BFS can be described by the following pseudocode: Monocarp was fascinated by BFS so much that, in the end, he lost his tree. Fortunately, he still has a sequence of vertices, in which order vertices were visited by the BFS algorithm (the array a from the pseudocode). Monocarp knows that each vertex was visited exactly once (since they were put and taken from the queue exactly once). Also, he knows that all children of each vertex were viewed in ascending order. Monocarp knows that there are many trees (in the general case) with the same visiting order a , so he doesn't hope to restore his tree. Monocarp is okay with any tree that has minimum height. The height of a tree is the maximum depth of the tree's vertices, and the depth of a vertex is the number of edges in the path from the root to it. For example, the depth of vertex 1 is 0 , since it's the root, and the depth of all root's children are 1 . Help Monocarp to find any tree with given visiting order a and minimum height. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of test cases. The first line of each test case contains a single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of vertices in the tree. The second line of each test case contains n integers a_1, a_2, ... , a_n ( 1 <= a_i <= n ; a_i neq a_j ; a_1 = 1 ) -- the order in which the vertices were visited by the BFS algorithm. It's guaranteed that the total sum of n over test cases doesn't exceed 2 cdot 10^5 . For each test case print the minimum possible height of a tree with the given visiting order a . In the first test case, there is only one tree with the given visiting order: In the second test case, there is only "... |
84149 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
96929632 | shafinalam | D | Oct. 27, 2020, 5:12 p.m. | OK | Clang++17 Diagnostics | TESTS | 7 | 1357 | 80281600 | ||
96931422 | scheung | D | Oct. 27, 2020, 5:30 p.m. | OK | GNU C11 | TESTS | 7 | 46 | 0 | ||
96925178 | rainboy | D | Oct. 27, 2020, 4:37 p.m. | OK | GNU C11 | TESTS | 7 | 46 | 819200 | ||
96917940 | SylvanasS | D | Oct. 27, 2020, 4:18 p.m. | OK | GNU C++11 | TESTS | 7 | 15 | 819200 | ||
96954946 | luogu_bot2 | D | Oct. 28, 2020, 4:12 a.m. | OK | GNU C++11 | TESTS | 8 | 15 | 4812800 | ||
96956209 | vjudge1 | D | Oct. 28, 2020, 4:39 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 716800 | ||
96946672 | Ender_zzm | D | Oct. 28, 2020, 12:11 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 1638400 | ||
96948831 | YLWang | D | Oct. 28, 2020, 1:38 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 1740800 | ||
96948823 | Wallbreaker4th | D | Oct. 28, 2020, 1:37 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 1740800 | ||
96947405 | caidzh | D | Oct. 28, 2020, 12:41 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 3276800 | ||
96945424 | luogu_bot1 | D | Oct. 27, 2020, 11:14 p.m. | OK | GNU C++11 | TESTS | 8 | 30 | 3686400 | ||
96955697 | zzkkaiming | D | Oct. 28, 2020, 4:28 a.m. | OK | GNU C++11 | TESTS | 8 | 30 | 16076800 | ||
96951755 | MonkeyKing | D | Oct. 28, 2020, 2:59 a.m. | OK | GNU C++11 | TESTS | 8 | 31 | 0 | ||
96940557 | TheKingAleks | D | Oct. 27, 2020, 8:13 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96934966 | bansalkanha68 | D | Oct. 27, 2020, 6:22 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96932163 | leetcode07 | D | Oct. 27, 2020, 5:39 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96927273 | Pegion33 | D | Oct. 27, 2020, 4:50 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96955194 | is_this_dp | D | Oct. 28, 2020, 4:17 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 819200 | ||
96922371 | coolss | D | Oct. 27, 2020, 4:29 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96940862 | do_atA_all | D | Oct. 27, 2020, 8:20 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 819200 | ||
96921716 | pvannvuILQD | D | Oct. 27, 2020, 4:28 p.m. | OK | GNU C++14 | TESTS | 7 | 46 | 921600 | ||
96949127 | _SAKAIDO_ | D | Oct. 28, 2020, 1:47 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 1638400 | ||
96950828 | aya_uchida | D | Oct. 28, 2020, 2:39 a.m. | OK | GNU C++14 | TESTS | 8 | 46 | 1638400 | ||
96954600 | 11235813213455 | D | Oct. 28, 2020, 4:04 a.m. | OK | GNU C++17 | TESTS | 8 | 31 | 2867200 | ||
96919014 | Czarcasm | D | Oct. 27, 2020, 4:21 p.m. | OK | GNU C++17 | TESTS | 7 | 46 | 819200 | ||
96959050 | Hex1234567 | D | Oct. 28, 2020, 5:37 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 819200 | ||
96951054 | jywj | D | Oct. 28, 2020, 2:44 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 819200 | ||
96948607 | Qian_2333 | D | Oct. 28, 2020, 1:31 a.m. | OK | GNU C++17 | TESTS | 8 | 46 | 819200 | ||
96944809 | urielguz333 | D | Oct. 27, 2020, 10:46 p.m. | OK | GNU C++17 | TESTS | 8 | 46 | 819200 | ||
96944671 | Arrias | D | Oct. 27, 2020, 10:39 p.m. | OK | GNU C++17 | TESTS | 8 | 46 | 819200 | ||
96930802 | BlackDwek | D | Oct. 27, 2020, 5:24 p.m. | OK | GNU C++17 | TESTS | 7 | 46 | 819200 | ||
96927726 | .magician. | D | Oct. 27, 2020, 4:53 p.m. | OK | GNU C++17 | TESTS | 7 | 46 | 819200 | ||
96923160 | FedeNQ | D | Oct. 27, 2020, 4:31 p.m. | OK | GNU C++17 | TESTS | 7 | 46 | 819200 | ||
96932836 | HenriqueBrito | D | Oct. 27, 2020, 5:48 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 819200 | ||
96931255 | 13muce | D | Oct. 27, 2020, 5:28 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 819200 | ||
96934302 | Response777 | D | Oct. 27, 2020, 6:10 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 819200 | ||
96949531 | dejavu11zzz | D | Oct. 28, 2020, 2 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 819200 | ||
96930349 | m.hasan01 | D | Oct. 27, 2020, 5:19 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 2560000 | ||
96926612 | kirdmivus | D | Oct. 27, 2020, 4:45 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 2560000 | ||
96950639 | Kanoon | D | Oct. 28, 2020, 2:33 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 31 | 2969600 | ||
96926047 | tomato_potato | D | Oct. 27, 2020, 4:41 p.m. | OK | GNU C++17 (64) | TESTS | 7 | 31 | 16896000 | ||
96955364 | madlogic | D | Oct. 28, 2020, 4:21 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 46 | 819200 | ||
96960148 | TinkerX | D | Oct. 28, 2020, 5:56 a.m. | OK | GNU C++17 (64) | TESTS | 8 | 46 | 819200 | ||
96953212 | synapse | D | Oct. 28, 2020, 3:33 a.m. | OK | Go | TESTS | 8 | 124 | 5529600 | ||
96953055 | synapse | D | Oct. 28, 2020, 3:29 a.m. | OK | Go | TESTS | 8 | 124 | 5529600 | ||
96916939 | atishay127 | D | Oct. 27, 2020, 4:15 p.m. | OK | Java 11 | TESTS | 7 | 171 | 6144000 | ||
96957151 | Yash-Saxena | D | Oct. 28, 2020, 4:58 a.m. | OK | Java 11 | TESTS | 8 | 186 | 0 | ||
96926389 | akman10 | D | Oct. 27, 2020, 4:43 p.m. | OK | Java 11 | TESTS | 7 | 186 | 0 | ||
96919755 | sarthakmanna | D | Oct. 27, 2020, 4:23 p.m. | OK | Java 11 | TESTS | 7 | 186 | 3686400 | ||
96940493 | yesbutno1685 | D | Oct. 27, 2020, 8:11 p.m. | OK | Java 11 | TESTS | 7 | 202 | 0 | ||
96943981 | yesbutno1685 | D | Oct. 27, 2020, 10:05 p.m. | OK | Java 11 | TESTS | 8 | 202 | 0 | ||
96935912 | vineet_001 | D | Oct. 27, 2020, 6:39 p.m. | OK | Java 11 | TESTS | 7 | 202 | 0 | ||
96933863 | sanju2504 | D | Oct. 27, 2020, 6:03 p.m. | OK | Java 11 | TESTS | 7 | 202 | 0 | ||
96933442 | Monkey_de_Luffy | D | Oct. 27, 2020, 5:57 p.m. | OK | Java 11 | TESTS | 7 | 202 | 0 | ||
96922511 | toxic4u | D | Oct. 27, 2020, 4:30 p.m. | OK | Java 11 | TESTS | 7 | 202 | 0 | ||
96957849 | ragnarok001 | D | Oct. 28, 2020, 5:12 a.m. | OK | Java 8 | TESTS | 8 | 109 | 6144000 | ||
96955476 | gladwin_rojer | D | Oct. 28, 2020, 4:23 a.m. | OK | Java 8 | TESTS | 8 | 124 | 1843200 | ||
96922289 | Ad-007 | D | Oct. 27, 2020, 4:29 p.m. | OK | Java 8 | TESTS | 7 | 124 | 6144000 | ||
96928783 | 2020akadaver | D | Oct. 27, 2020, 5:03 p.m. | OK | Java 8 | TESTS | 7 | 139 | 1843200 | ||
96942344 | pehchan_kaun | D | Oct. 27, 2020, 9:04 p.m. | OK | Java 8 | TESTS | 7 | 139 | 1945600 | ||
96922099 | puchipuu | D | Oct. 27, 2020, 4:29 p.m. | OK | Java 8 | TESTS | 7 | 139 | 6144000 | ||
96936448 | adp527 | D | Oct. 27, 2020, 6:49 p.m. | OK | Java 8 | TESTS | 7 | 140 | 0 | ||
96938063 | RichardBot7000 | D | Oct. 27, 2020, 7:18 p.m. | OK | Java 8 | TESTS | 7 | 140 | 1843200 | ||
96918332 | Shantanu_Rathod | D | Oct. 27, 2020, 4:19 p.m. | OK | Java 8 | TESTS | 7 | 140 | 1843200 | ||
96918242 | shojin_pro | D | Oct. 27, 2020, 4:19 p.m. | OK | Java 8 | TESTS | 7 | 140 | 1843200 | ||
96932277 | nuralamcse024 | D | Oct. 27, 2020, 5:41 p.m. | OK | JavaScript | TESTS | 7 | 140 | 18432000 | ||
96921853 | Mirimax | D | Oct. 27, 2020, 4:28 p.m. | OK | Kotlin | TESTS | 7 | 202 | 10342400 | ||
96920760 | Hydraqwq | D | Oct. 27, 2020, 4:25 p.m. | OK | MS C++ 2017 | TESTS | 7 | 62 | 819200 | ||
96920529 | shebao | D | Oct. 27, 2020, 4:25 p.m. | OK | MS C++ 2017 | TESTS | 7 | 62 | 819200 | ||
96917433 | nik1998 | D | Oct. 27, 2020, 4:17 p.m. | OK | MS C++ 2017 | TESTS | 7 | 139 | 5632000 | ||
96922579 | ShvarcstNeger | D | Oct. 27, 2020, 4:30 p.m. | OK | MS C++ 2017 | TESTS | 7 | 140 | 1638400 | ||
96942310 | Numbervan | D | Oct. 27, 2020, 9:03 p.m. | OK | MS C++ 2017 | TESTS | 7 | 140 | 2560000 | ||
96939446 | xsc | D | Oct. 27, 2020, 7:47 p.m. | OK | MS C++ 2017 | TESTS | 7 | 140 | 3072000 | ||
96920136 | dbsthdud918 | D | Oct. 27, 2020, 4:24 p.m. | OK | MS C++ 2017 | TESTS | 7 | 155 | 0 | ||
96918729 | 544432 | D | Oct. 27, 2020, 4:20 p.m. | OK | MS C++ 2017 | TESTS | 7 | 155 | 819200 | ||
96941965 | ustaritz | D | Oct. 27, 2020, 8:52 p.m. | OK | MS C++ 2017 | TESTS | 7 | 155 | 2252800 | ||
96918485 | pyrological | D | Oct. 27, 2020, 4:19 p.m. | OK | MS C++ 2017 | TESTS | 7 | 155 | 2560000 | ||
96940001 | matrix4 | D | Oct. 27, 2020, 8 p.m. | OK | PyPy 2 | TESTS | 7 | 124 | 10854400 | ||
96956732 | hxu10 | D | Oct. 28, 2020, 4:49 a.m. | OK | PyPy 2 | TESTS | 8 | 233 | 15257600 | ||
96960321 | Anuranjan_Pandey | D | Oct. 28, 2020, 5:59 a.m. | OK | PyPy 3 | TESTS | 8 | 202 | 15360000 | ||
96923987 | bravotango | D | Oct. 27, 2020, 4:33 p.m. | OK | PyPy 3 | TESTS | 7 | 202 | 21913600 | ||
96917406 | htkb | D | Oct. 27, 2020, 4:17 p.m. | OK | PyPy 3 | TESTS | 7 | 217 | 15257600 | ||
96920184 | deepanshu_pali | D | Oct. 27, 2020, 4:24 p.m. | OK | PyPy 3 | TESTS | 7 | 217 | 19558400 | ||
96949129 | Coki628 | D | Oct. 28, 2020, 1:47 a.m. | OK | PyPy 3 | TESTS | 8 | 233 | 14336000 | ||
96958388 | sanjeevkumar113f | D | Oct. 28, 2020, 5:24 a.m. | OK | PyPy 3 | TESTS | 8 | 234 | 15257600 | ||
96941246 | titia | D | Oct. 27, 2020, 8:30 p.m. | OK | PyPy 3 | TESTS | 7 | 248 | 15667200 | ||
96940056 | Bovniova | D | Oct. 27, 2020, 8:02 p.m. | OK | PyPy 3 | TESTS | 7 | 248 | 15667200 | ||
96921592 | vinay272001 | D | Oct. 27, 2020, 4:28 p.m. | OK | PyPy 3 | TESTS | 7 | 249 | 13209600 | ||
96937560 | learnercode | D | Oct. 27, 2020, 7:08 p.m. | OK | PyPy 3 | TESTS | 7 | 249 | 13414400 | ||
96939263 | lemraus | D | Oct. 27, 2020, 7:43 p.m. | OK | Python 3 | TESTS | 7 | 202 | 14643200 | ||
96948522 | nuoyanli | D | Oct. 28, 2020, 1:27 a.m. | OK | Python 3 | TESTS | 8 | 218 | 14028800 | ||
96927160 | lemraus | D | Oct. 27, 2020, 4:49 p.m. | OK | Python 3 | TESTS | 7 | 218 | 14643200 | ||
96930702 | sh1194 | D | Oct. 27, 2020, 5:23 p.m. | OK | Python 3 | TESTS | 7 | 233 | 14643200 | ||
96954472 | programmer_neo | D | Oct. 28, 2020, 4:01 a.m. | OK | Python 3 | TESTS | 8 | 280 | 14438400 | ||
96925803 | kalandar | D | Oct. 27, 2020, 4:40 p.m. | OK | Python 3 | TESTS | 7 | 280 | 14643200 | ||
96931202 | prayashverma007 | D | Oct. 27, 2020, 5:27 p.m. | OK | Python 3 | TESTS | 7 | 295 | 14643200 | ||
96934227 | lucifer085 | D | Oct. 27, 2020, 6:09 p.m. | OK | Python 3 | TESTS | 7 | 327 | 19558400 | ||
96934081 | lucifer085 | D | Oct. 27, 2020, 6:07 p.m. | OK | Python 3 | TESTS | 7 | 342 | 19558400 | ||
96943321 | ss057 | D | Oct. 27, 2020, 9:40 p.m. | OK | Python 3 | TESTS | 7 | 343 | 14643200 | ||
96917418 | o2c | D | Oct. 27, 2020, 4:17 p.m. | OK | Rust | TESTS | 7 | 46 | 3174400 | ||
96927401 | yvay5cqe | D | Oct. 27, 2020, 4:51 p.m. | OK | Rust | TESTS | 7 | 155 | 7884800 |
Back to search problems