Codeforces Round 914 (Div. 2)

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
1904 Codeforces Round 914 (Div. 2) FINISHED False 7200 35042063 Dec. 9, 2023, 4:05 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1057 ) E Tree Queries PROGRAMMING binary search data structures dfs and similar implementation trees

B"Since Hayate didn't get any Christmas presents from Santa, he is instead left solving a tree query problem. Hayate has a tree with n nodes. Hayate now wants you to answer q queries. Each query consists of a node x and k other additional nodes a_1,a_2, ldots,a_k . These k+1 nodes are guaranteed to be all distinct. For each query, you must find the length of the longest simple path starting at node x^ dagger after removing nodes a_1,a_2, ldots,a_k along with all edges connected to at least one of nodes a_1,a_2, ldots,a_k . ^ dagger A simple path of length k starting at node x is a sequence of distinct nodes x=u_0,u_1, ldots,u_k such that there exists a edge between nodes u_{i-1} and u_i for all 1 <= q i <= q k . The first line contains two integers n and q ( 1 <= n, q <= 2 cdot 10^5 ) -- the number of nodes of the tree and the number of queries. The following n - 1 lines contain two integers u and v ( 1 <= u, v <= n , u ne v ) -- denoting an edge between nodes u and v . It is guaranteed that the given edges form a tree. The following q lines describe the queries. Each line contains the integers x , k and a_1,a_2, ldots,a_k ( 1 <= q x <= q n , 0 <= q k < n , 1 <= q a_i <= q n ) -- the starting node, the number of removed nodes and the removed nodes. It is guaranteed that for each query, x,a_1,a_2, ldots,a_k are all distinct. It is guaranteed that the sum of k over all queries will not exceed 2 cdot 10^5 . For each query, output a single integer denoting the answer for that query. In the first example, the tree is as follows: In the first query, no nodes are missing. The longest simple path starting from node 2 is 2 to 1 to 3 to 4 . Thus, the answer is 3 . In the third query, nodes 1 and 6 are missing and the tree is s"...

Tutorials

Codeforces Round 914 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
236611958 EvenToWorldFinal E Dec. 10, 2023, 5:02 a.m. OK GNU C++14 TESTS 91 654 58163200
236604746 liuyz11 E Dec. 10, 2023, 2:42 a.m. OK GNU C++14 TESTS 91 826 133734400
236581561 EasonLiang E Dec. 9, 2023, 7:22 p.m. OK GNU C++14 TESTS 91 1169 49766400
236585038 Joacru E Dec. 9, 2023, 8:02 p.m. OK GNU C++14 TESTS 91 1419 65126400
236565306 JTree E Dec. 9, 2023, 5:49 p.m. OK GNU C++14 TESTS 91 1496 151654400
236581460 gabriel88766 E Dec. 9, 2023, 7:21 p.m. OK GNU C++17 TESTS 91 1045 70041600
236589584 TsunamiNoLetGo E Dec. 9, 2023, 8:48 p.m. OK GNU C++17 TESTS 91 1123 78848000
236597206 thunopro E Dec. 9, 2023, 10:52 p.m. OK GNU C++17 TESTS 91 1185 81817600
236585811 JomnoiZ E Dec. 9, 2023, 8:11 p.m. OK GNU C++17 TESTS 91 1216 47820800
236578705 10-chan E Dec. 9, 2023, 6:54 p.m. OK GNU C++17 TESTS 91 1294 67891200
236590499 umimel E Dec. 9, 2023, 9:02 p.m. OK GNU C++17 TESTS 91 1341 120832000
236598621 marcOS E Dec. 9, 2023, 11:33 p.m. OK GNU C++17 TESTS 91 1466 74444800
236584667 MridulAhi E Dec. 9, 2023, 7:58 p.m. OK GNU C++17 TESTS 91 1496 112640000
236596530 sumitprajapati E Dec. 9, 2023, 10:35 p.m. OK GNU C++17 TESTS 91 1590 133734400
236603611 wtc E Dec. 10, 2023, 2:16 a.m. OK GNU C++17 TESTS 91 1591 30310400
236575457 Bucketsmith E Dec. 9, 2023, 6:30 p.m. OK GNU C++17 (64) TESTS 91 623 68812800
236604456 MIKEFENG E Dec. 10, 2023, 2:36 a.m. OK GNU C++17 (64) TESTS 91 639 84889600
236579006 lunchbox E Dec. 9, 2023, 6:56 p.m. OK GNU C++17 (64) TESTS 91 811 84275200
236583800 Coki628 E Dec. 9, 2023, 7:48 p.m. OK GNU C++17 (64) TESTS 91 982 89395200
236600951 akifpatel E Dec. 10, 2023, 12:57 a.m. OK GNU C++17 (64) TESTS 91 1013 115609600
236572996 Enaliy E Dec. 9, 2023, 6:18 p.m. OK GNU C++17 (64) TESTS 91 1029 75468800
236597441 Khozhaev E Dec. 9, 2023, 10:58 p.m. OK GNU C++17 (64) TESTS 91 1045 156979200
236604560 enslaved E Dec. 10, 2023, 2:38 a.m. OK GNU C++17 (64) TESTS 91 1169 105574400
236609325 EasonLiang E Dec. 10, 2023, 4:16 a.m. OK GNU C++17 (64) TESTS 91 1200 57651200
236605288 kondasujay2 E Dec. 10, 2023, 2:55 a.m. OK GNU C++17 (64) TESTS 91 1684 112742400
236594028 kulezi E Dec. 9, 2023, 9:42 p.m. OK GNU C++20 (64) TESTS 91 639 67788800
236578865 AmirAli-Asgari E Dec. 9, 2023, 6:55 p.m. OK GNU C++20 (64) TESTS 91 639 102092800
236588607 G_X_J E Dec. 9, 2023, 8:34 p.m. OK GNU C++20 (64) TESTS 91 655 76390400
236606441 nanika00 E Dec. 10, 2023, 3:21 a.m. OK GNU C++20 (64) TESTS 91 670 120320000
236571404 Bench0310 E Dec. 9, 2023, 6:04 p.m. OK GNU C++20 (64) TESTS 91 701 74649600
236600965 aufannn E Dec. 10, 2023, 12:58 a.m. OK GNU C++20 (64) TESTS 91 717 100761600
236613103 tute7627 E Dec. 10, 2023, 5:20 a.m. OK GNU C++20 (64) TESTS 91 733 52940800
236594034 A_G E Dec. 9, 2023, 9:42 p.m. OK GNU C++20 (64) TESTS 91 733 63795200
236614579 luogu_bot2 E Dec. 10, 2023, 5:42 a.m. OK GNU C++20 (64) TESTS 92 748 109977600
236588208 eren__ E Dec. 9, 2023, 8:28 p.m. OK GNU C++20 (64) TESTS 91 763 361369600
236597149 CutSandstone E Dec. 9, 2023, 10:51 p.m. OK Java 17 TESTS 91 2292 206848000
236582973 misorin E Dec. 9, 2023, 7:38 p.m. OK PyPy 3-64 TESTS 91 2729 150835200
236581847 misorin E Dec. 9, 2023, 7:25 p.m. OK PyPy 3-64 TESTS 91 3010 168960000
236576505 misorin E Dec. 9, 2023, 6:36 p.m. OK PyPy 3-64 TESTS 91 3790 146841600

remove filters

Back to search problems