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 |
---|---|---|---|---|---|---|
1797 | Codeforces Round 864 (Div. 2) | FINISHED | False | 7200 | 56217263 | April 8, 2023, 2:05 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 370 ) | F | Li Hua and Path | PROGRAMMING | data structures dfs and similar divide and conquer ds trees |
B'Li Hua has a tree of n vertices and n-1 edges. The vertices are numbered from 1 to n . A pair of vertices (u,v) ( u < v ) is considered cute if exactly one of the following two statements is true: There will be m operations. In each operation, he decides an integer k_j , then inserts a vertex numbered n+j to the tree, connecting with the vertex numbered k_j . He wants to calculate the number of cute pairs before operations and after each operation. Suppose you were Li Hua, please solve this problem. The first line contains the single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of vertices in the tree. Next n-1 lines contain the edges of the tree. The i -th line contains two integers u_i and v_i ( 1 <= u_i,v_i <= n ; u_i ne v_i ) -- the corresponding edge. The given edges form a tree. The next line contains the single integer m ( 1 <= m <= 2 cdot 10^5 ) -- the number of operations. Next m lines contain operations -- one operation per line. The j -th operation contains one integer k_j ( 1 <= k_j < n+j ) -- a vertex. Print m+1 integers -- the number of cute pairs before operations and after each operation. The initial tree is shown in the following picture: There are 11 cute pairs -- (1,5),(2,3),(2,4),(2,6),(2,7),(3,4),(3,6),(3,7),(4,5),(5,7),(6,7) . Similarly, we can count the cute pairs after each operation and the result is 15 and 19 . '... |
Codeforces Round 864 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
201421749 | Hritik12 | F | April 9, 2023, 5:47 a.m. | OK | GNU C++14 | TESTS | 77 | 327 | 45056000 | ||
201417385 | zltzlt | F | April 9, 2023, 5:03 a.m. | OK | GNU C++14 | TESTS | 77 | 327 | 45056000 | ||
201422339 | zhouzizhe | F | April 9, 2023, 5:53 a.m. | OK | GNU C++14 | TESTS | 77 | 420 | 87552000 | ||
201384185 | karansrivastava | F | April 8, 2023, 8:39 p.m. | OK | GNU C++14 | TESTS | 77 | 483 | 77107200 | ||
201384117 | karansrivastava | F | April 8, 2023, 8:39 p.m. | OK | GNU C++14 | TESTS | 77 | 514 | 77107200 | ||
201388328 | Sedmoklasnikut | F | April 8, 2023, 9:16 p.m. | OK | GNU C++17 | TESTS | 77 | 405 | 41881600 | ||
201421342 | HassanKh2002 | F | April 9, 2023, 5:44 a.m. | OK | GNU C++17 | TESTS | 77 | 468 | 41369600 | ||
201402639 | bachbeo2007 | F | April 9, 2023, 1:19 a.m. | OK | GNU C++20 (64) | TESTS | 77 | 311 | 53043200 | ||
201392607 | A_G | F | April 8, 2023, 10:05 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 327 | 48947200 | ||
201387681 | Ormlis | F | April 8, 2023, 9:09 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 327 | 57036800 | ||
201362487 | DeadlyPillow | F | April 8, 2023, 5:46 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 343 | 70656000 | ||
201377788 | wxhtzdy | F | April 8, 2023, 7:45 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 421 | 60928000 | ||
201416355 | zihouzhong | F | April 9, 2023, 4:51 a.m. | OK | GNU C++20 (64) | TESTS | 77 | 452 | 63078400 | ||
201416344 | Komali0214 | F | April 9, 2023, 4:51 a.m. | OK | GNU C++20 (64) | TESTS | 77 | 655 | 56524800 | ||
201415698 | lmlmlm | F | April 9, 2023, 4:42 a.m. | OK | GNU C++20 (64) | TESTS | 77 | 655 | 56524800 | ||
201370809 | Kilo_5723 | F | April 8, 2023, 6:51 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 888 | 60416000 | ||
201356125 | SSerxhs | F | April 8, 2023, 5:06 p.m. | OK | GNU C++20 (64) | TESTS | 77 | 936 | 57344000 |
Back to search problems