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 |
---|---|---|---|---|---|---|
1774 | Polynomial Round 2022 (Div. 1 + Div. 2, Rated, Prizes!) | FINISHED | False | 9000 | 60535499 | Dec. 17, 2022, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3525 ) | E | Two Chess Pieces | PROGRAMMING | dfs and similar dp greedy trees |
B"Cirno_9baka has a tree with n nodes. He is willing to share it with you, which means you can operate on it. Initially, there are two chess pieces on the node 1 of the tree. In one step, you can choose any piece, and move it to the neighboring node. You are also given an integer d . You need to ensure that the distance between the two pieces doesn't ever exceed d . Each of these two pieces has a sequence of nodes which they need to pass in any order, and eventually, they have to return to the root. As a curious boy, he wants to know the minimum steps you need to take. The first line contains two integers n and d ( 2 <= d <= n <= 2 cdot 10^5 ). The i -th of the following n - 1 lines contains two integers u_i, v_i (1 <= u_i, v_i <= n) , denoting the edge between the nodes u_i, v_i of the tree. It's guaranteed that these edges form a tree. The next line contains an integer m_1 ( 1 <= m_1 <= n ) and m_1 integers a_1, a_2, ldots, a_{m_1} ( 1 <= a_i <= n , all a_i are distinct) -- the sequence of nodes that the first piece needs to pass. The second line contains an integer m_2 ( 1 <= m_2 <= n ) and m_2 integers b_1, b_2, ldots, b_{m_2} ( 1 <= b_i <= n , all b_i are distinct) -- the sequence of nodes that the second piece needs to pass. Output a single integer -- the minimum steps you need to take. In the first sample, here is one possible sequence of steps of length 6 . The second piece moves by the route 1 to 2 to 4 to 2 to 1 . Then, the first piece moves by the route 1 to 3 to 1 . In the second sample, here is one possible sequence of steps of length 8 : The first piece moves by the route 1 to 2 to 3 . Then, the second piece moves by the route 1 to 2 . Then, the first piece moves by the route 3 to 4 to 3 to 2 to 1 . Then, the second piece moves by the route 2"... |
Polynomial Round 2022 (Div. 1 + Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
185719730 | rainboy | E | Dec. 17, 2022, 6:57 p.m. | OK | GNU C11 | TESTS | 142 | 171 | 16179200 | ||
185702281 | chro4896 | E | Dec. 17, 2022, 4:44 p.m. | OK | GNU C11 | TESTS | 142 | 187 | 22425600 | ||
185703841 | happydef | E | Dec. 17, 2022, 4:49 p.m. | OK | GNU C++14 | TESTS | 142 | 202 | 90931200 | ||
185740142 | Song_Gch | E | Dec. 18, 2022, 2:06 a.m. | OK | GNU C++14 | TESTS | 142 | 264 | 18432000 | ||
185716741 | angesh | E | Dec. 17, 2022, 6:34 p.m. | OK | GNU C++14 | TESTS | 142 | 264 | 32460800 | ||
185702874 | aha_xjs | E | Dec. 17, 2022, 4:46 p.m. | OK | GNU C++14 | TESTS | 142 | 265 | 23040000 | ||
185741560 | conexposys | E | Dec. 18, 2022, 2:43 a.m. | OK | GNU C++14 | TESTS | 142 | 265 | 27443200 | ||
185741677 | conexposys | E | Dec. 18, 2022, 2:46 a.m. | OK | GNU C++14 | TESTS | 142 | 265 | 27443200 | ||
185717052 | FishStick | E | Dec. 17, 2022, 6:36 p.m. | OK | GNU C++14 | TESTS | 142 | 265 | 51916800 | ||
185741986 | __chtholly__ | E | Dec. 18, 2022, 2:53 a.m. | OK | GNU C++14 | TESTS | 142 | 280 | 16793600 | ||
185744110 | baiABC | E | Dec. 18, 2022, 3:45 a.m. | OK | GNU C++14 | TESTS | 142 | 280 | 25804800 | ||
185746087 | Cp_forever | E | Dec. 18, 2022, 4:27 a.m. | OK | GNU C++14 | TESTS | 142 | 280 | 28672000 | ||
185717336 | D2JPJ2D | E | Dec. 17, 2022, 6:38 p.m. | OK | GNU C++17 | TESTS | 142 | 234 | 22016000 | ||
185715933 | kmparvez | E | Dec. 17, 2022, 6:30 p.m. | OK | GNU C++17 | TESTS | 142 | 248 | 15769600 | ||
185700929 | Vibhor2003 | E | Dec. 17, 2022, 4:40 p.m. | OK | GNU C++17 | TESTS | 142 | 249 | 18636800 | ||
185703355 | mahdi.hasnat | E | Dec. 17, 2022, 4:47 p.m. | OK | GNU C++17 | TESTS | 142 | 264 | 25804800 | ||
185750013 | Bucketsmith | E | Dec. 18, 2022, 5:32 a.m. | OK | GNU C++17 | TESTS | 142 | 265 | 17408000 | ||
185745935 | kimmoqt | E | Dec. 18, 2022, 4:24 a.m. | OK | GNU C++17 | TESTS | 142 | 280 | 19558400 | ||
185702027 | Dobermann | E | Dec. 17, 2022, 4:43 p.m. | OK | GNU C++17 | TESTS | 142 | 280 | 21811200 | ||
185705564 | abcpony | E | Dec. 17, 2022, 4:54 p.m. | OK | GNU C++17 | TESTS | 142 | 280 | 22630400 | ||
185721972 | cjybyjk | E | Dec. 17, 2022, 7:19 p.m. | OK | GNU C++17 | TESTS | 142 | 280 | 22835200 | ||
185700757 | pty6666 | E | Dec. 17, 2022, 4:40 p.m. | OK | GNU C++17 | TESTS | 142 | 280 | 24166400 | ||
185748011 | Monohydr | E | Dec. 18, 2022, 5:05 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 202 | 34406400 | ||
185746522 | van_hoang | E | Dec. 18, 2022, 4:37 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 218 | 35225600 | ||
185742586 | Alex_Wei | E | Dec. 18, 2022, 3:09 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 248 | 36864000 | ||
185705017 | RedLeaf | E | Dec. 17, 2022, 4:52 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 280 | 34611200 | ||
185699931 | akua | E | Dec. 17, 2022, 4:37 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 280 | 39321600 | ||
185716591 | thiago_bastos | E | Dec. 17, 2022, 6:33 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 280 | 41369600 | ||
185700616 | ZI_MA | E | Dec. 17, 2022, 4:39 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 296 | 43212800 | ||
185746232 | zhangboju | E | Dec. 18, 2022, 4:30 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 311 | 36044800 | ||
185733839 | GoatTamer | E | Dec. 17, 2022, 10:25 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 311 | 40960000 | ||
185734175 | GoatTamer | E | Dec. 17, 2022, 10:33 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 327 | 40960000 | ||
185727099 | magnus.hegdahl | E | Dec. 17, 2022, 8:22 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 78 | 13824000 | ||
185739871 | nor | E | Dec. 18, 2022, 1:59 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 109 | 23859200 | ||
185739806 | nor | E | Dec. 18, 2022, 1:57 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 124 | 23859200 | ||
185701693 | jiangbowen | E | Dec. 17, 2022, 4:43 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 139 | 35635200 | ||
185727018 | magnus.hegdahl | E | Dec. 17, 2022, 8:21 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 156 | 13619200 | ||
185736069 | definitelynotmee | E | Dec. 17, 2022, 11:32 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 186 | 23654400 | ||
185739827 | nor | E | Dec. 18, 2022, 1:57 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 202 | 25497600 | ||
185719129 | Havoc_01 | E | Dec. 17, 2022, 6:52 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 202 | 34099200 | ||
185747717 | fhhuo | E | Dec. 18, 2022, 5:01 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 202 | 42496000 | ||
185738088 | Gary2005 | E | Dec. 18, 2022, 12:59 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 217 | 34508800 | ||
185702525 | shubhargava | E | Dec. 17, 2022, 4:45 p.m. | OK | Java 11 | TESTS | 142 | 841 | 50585600 | ||
185716650 | dzhi | E | Dec. 17, 2022, 6:33 p.m. | OK | Java 11 | TESTS | 142 | 1216 | 96768000 | ||
185715895 | TCchen | E | Dec. 17, 2022, 6:29 p.m. | OK | Java 17 | TESTS | 142 | 482 | 29593600 | ||
185709331 | Alex_by | E | Dec. 17, 2022, 5:02 p.m. | OK | Java 17 | TESTS | 142 | 966 | 84787200 | ||
185704672 | YocyCraft | E | Dec. 17, 2022, 4:51 p.m. | OK | Java 17 | TESTS | 142 | 1450 | 154931200 | ||
185702716 | DarLam | E | Dec. 17, 2022, 4:46 p.m. | OK | Java 8 | TESTS | 142 | 296 | 30720000 | ||
185733683 | alexey.enkov | E | Dec. 17, 2022, 10:21 p.m. | OK | Java 8 | TESTS | 142 | 857 | 70348800 | ||
185732089 | invincible777 | E | Dec. 17, 2022, 9:43 p.m. | OK | Java 8 | TESTS | 142 | 1123 | 107008000 | ||
185716499 | harshsingla06 | E | Dec. 17, 2022, 6:32 p.m. | OK | Java 8 | TESTS | 142 | 1325 | 187596800 | ||
185734357 | alexey.enkov | E | Dec. 17, 2022, 10:38 p.m. | OK | Kotlin 1.7 | TESTS | 142 | 1575 | 167321600 | ||
185707679 | ktropin | E | Dec. 17, 2022, 4:59 p.m. | OK | Mono C# | TESTS | 142 | 842 | 66764800 | ||
185700688 | Eldies | E | Dec. 17, 2022, 4:40 p.m. | OK | MS C++ 2017 | TESTS | 142 | 951 | 20172800 | ||
185742850 | Young_Sean | E | Dec. 18, 2022, 3:16 a.m. | OK | PyPy 3-64 | TESTS | 142 | 1045 | 129843200 | ||
185738549 | Little_Sheep_Yawn | E | Dec. 18, 2022, 1:17 a.m. | OK | PyPy 3-64 | TESTS | 142 | 1045 | 129843200 | ||
185741132 | skhan_org | E | Dec. 18, 2022, 2:31 a.m. | OK | PyPy 3-64 | TESTS | 142 | 1075 | 137216000 | ||
185719706 | letsgolimen | E | Dec. 17, 2022, 6:57 p.m. | OK | PyPy 3-64 | TESTS | 142 | 1170 | 114380800 | ||
185732962 | ishaanshri95 | E | Dec. 17, 2022, 10:04 p.m. | OK | PyPy 3-64 | TESTS | 142 | 1793 | 183091200 | ||
185723490 | aayush_chhabra | E | Dec. 17, 2022, 7:35 p.m. | OK | Python 3 | TESTS | 142 | 1903 | 233881600 | ||
185741079 | Spheniscine | E | Dec. 18, 2022, 2:30 a.m. | OK | Rust 2021 | TESTS | 142 | 156 | 27238400 |
Back to search problems