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 |
---|---|---|---|---|---|---|
1856 | Codeforces Round 890 (Div. 2) supported by Constructor Institute | FINISHED | False | 7200 | 40577099 | Aug. 5, 2023, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 1438 ) | E2 | PermuTree (hard version) | PROGRAMMING | bitmasks dp implementation trees |
B'This is the hard version of the problem. The differences between the two versions are the constraint on n and the time limit. You can make hacks only if both versions of the problem are solved. You are given a tree with n vertices rooted at vertex 1 . For some permutation ^ dagger a of length n , let f(a) be the number of pairs of vertices (u, v) such that a_u < a_{ operatorname{lca}(u, v)} < a_v . Here, operatorname{lca}(u,v) denotes the lowest common ancestor of vertices u and v . Find the maximum possible value of f(a) over all permutations a of length n . ^ dagger A permutation of length n is an array consisting of n distinct integers from 1 to n in arbitrary order. For example, [2,3,1,5,4] is a permutation, but [1,2,2] is not a permutation ( 2 appears twice in the array), and [1,3,4] is also not a permutation ( n=3 but there is 4 in the array). The first line contains a single integer n ( 2 <= n <= 10^6 ). The second line contains n - 1 integers p_2,p_3, ldots,p_n ( 1 <= p_i < i ) indicating that there is an edge between vertices i and p_i . Output the maximum value of f(a) . The tree in the first test: One possible optimal permutation a is [2, 1, 4, 5, 3] with 4 suitable pairs of vertices: The tree in the third test: The tree in the fourth test: '... |
Codeforces Round #890 (Div. 2) Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
217390090 | chenguoyi | E2 | Aug. 6, 2023, 12:15 a.m. | OK | GNU C++14 | TESTS | 142 | 514 | 164249600 | ||
217405856 | RobertoFirmino | E2 | Aug. 6, 2023, 5:06 a.m. | OK | GNU C++14 | TESTS | 142 | 624 | 40448000 | ||
217405789 | RobertoFirmino | E2 | Aug. 6, 2023, 5:05 a.m. | OK | GNU C++14 | TESTS | 142 | 639 | 40448000 | ||
217400392 | Cu_OH_2 | E2 | Aug. 6, 2023, 3:40 a.m. | OK | GNU C++14 | TESTS | 142 | 639 | 112332800 | ||
217402911 | bkifhr9 | E2 | Aug. 6, 2023, 4:21 a.m. | OK | GNU C++14 | TESTS | 142 | 702 | 144179200 | ||
217402889 | RongC | E2 | Aug. 6, 2023, 4:21 a.m. | OK | GNU C++14 | TESTS | 142 | 717 | 144179200 | ||
217365543 | AuroraAlaska | E2 | Aug. 5, 2023, 6:24 p.m. | OK | GNU C++14 | TESTS | 140 | 732 | 256307200 | ||
217391053 | CJ_xde_lt | E2 | Aug. 6, 2023, 12:43 a.m. | OK | GNU C++14 | TESTS | 142 | 779 | 44441600 | ||
217391033 | CJ_xde_pt | E2 | Aug. 6, 2023, 12:43 a.m. | OK | GNU C++14 | TESTS | 142 | 779 | 44441600 | ||
217367759 | chdyFZH | E2 | Aug. 5, 2023, 6:42 p.m. | OK | GNU C++14 | TESTS | 142 | 795 | 72089600 | ||
217398832 | xu826281112 | E2 | Aug. 6, 2023, 3:14 a.m. | OK | GNU C++17 | TESTS | 142 | 311 | 124416000 | ||
217355793 | TeasingMaster | E2 | Aug. 5, 2023, 5:23 p.m. | OK | GNU C++17 | TESTS | 139 | 358 | 113459200 | ||
217403280 | brute_forceCE | E2 | Aug. 6, 2023, 4:27 a.m. | OK | GNU C++17 | TESTS | 142 | 436 | 120115200 | ||
217403705 | shadow9236 | E2 | Aug. 6, 2023, 4:34 a.m. | OK | GNU C++17 | TESTS | 142 | 467 | 36454400 | ||
217403656 | shadow9236 | E2 | Aug. 6, 2023, 4:33 a.m. | OK | GNU C++17 | TESTS | 142 | 467 | 36454400 | ||
217403249 | shadow9236 | E2 | Aug. 6, 2023, 4:27 a.m. | OK | GNU C++17 | TESTS | 142 | 467 | 36454400 | ||
217383791 | pab2 | E2 | Aug. 5, 2023, 9:52 p.m. | OK | GNU C++17 | TESTS | 142 | 499 | 68300800 | ||
217400570 | WyyOIer | E2 | Aug. 6, 2023, 3:43 a.m. | OK | GNU C++17 | TESTS | 142 | 514 | 114688000 | ||
217398763 | hehehehehehehehe | E2 | Aug. 6, 2023, 3:13 a.m. | OK | GNU C++17 | TESTS | 142 | 530 | 32256000 | ||
217398839 | Nson | E2 | Aug. 6, 2023, 3:14 a.m. | OK | GNU C++17 | TESTS | 142 | 530 | 72294400 | ||
217396025 | yangjl | E2 | Aug. 6, 2023, 2:25 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 265 | 63283200 | ||
217360316 | lunchbox | E2 | Aug. 5, 2023, 5:46 p.m. | OK | GNU C++17 (64) | TESTS | 139 | 467 | 48230400 | ||
217360461 | lunchbox | E2 | Aug. 5, 2023, 5:47 p.m. | OK | GNU C++17 (64) | TESTS | 139 | 498 | 48230400 | ||
217406479 | Superposition | E2 | Aug. 6, 2023, 5:15 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 514 | 248217600 | ||
217401138 | wsyear | E2 | Aug. 6, 2023, 3:52 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 514 | 248217600 | ||
217350454 | kotatsugame | E2 | Aug. 5, 2023, 4:32 p.m. | OK | GNU C++17 (64) | TESTS | 139 | 530 | 49868800 | ||
217400880 | wsyear | E2 | Aug. 6, 2023, 3:48 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 530 | 248217600 | ||
217401239 | Zeardoe | E2 | Aug. 6, 2023, 3:54 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 561 | 200192000 | ||
217407925 | bkifhr8 | E2 | Aug. 6, 2023, 5:34 a.m. | OK | GNU C++17 (64) | TESTS | 142 | 592 | 272179200 | ||
217369968 | ZhiGeBaiShui | E2 | Aug. 5, 2023, 7:01 p.m. | OK | GNU C++17 (64) | TESTS | 142 | 608 | 264192000 | ||
217390099 | neal | E2 | Aug. 6, 2023, 12:15 a.m. | OK | GNU C++20 (64) | TESTS | 142 | 187 | 52224000 | ||
217388864 | neal | E2 | Aug. 5, 2023, 11:43 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 202 | 52224000 | ||
217389376 | neal | E2 | Aug. 5, 2023, 11:55 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 217 | 52224000 | ||
217388849 | neal | E2 | Aug. 5, 2023, 11:43 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 217 | 52224000 | ||
217359192 | maspy | E2 | Aug. 5, 2023, 5:39 p.m. | OK | GNU C++20 (64) | TESTS | 139 | 234 | 46387200 | ||
217389080 | neal | E2 | Aug. 5, 2023, 11:48 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 234 | 52224000 | ||
217388763 | neal | E2 | Aug. 5, 2023, 11:40 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 234 | 52224000 | ||
217368046 | maspy | E2 | Aug. 5, 2023, 6:45 p.m. | OK | GNU C++20 (64) | TESTS | 142 | 249 | 46284800 | ||
217359653 | maspy | E2 | Aug. 5, 2023, 5:42 p.m. | OK | GNU C++20 (64) | TESTS | 139 | 249 | 46387200 | ||
217358703 | maspy | E2 | Aug. 5, 2023, 5:36 p.m. | OK | GNU C++20 (64) | TESTS | 139 | 249 | 46592000 | ||
217368820 | Ayush___ | E2 | Aug. 5, 2023, 6:52 p.m. | OK | PyPy 3-64 | TESTS | 142 | 842 | 143257600 | ||
217360748 | misorin | E2 | Aug. 5, 2023, 5:48 p.m. | OK | PyPy 3-64 | TESTS | 139 | 842 | 143257600 | ||
217393625 | dasarashirisha2004 | E2 | Aug. 6, 2023, 1:40 a.m. | OK | PyPy 3-64 | TESTS | 142 | 2027 | 153702400 | ||
217359733 | misorin | E2 | Aug. 5, 2023, 5:42 p.m. | OK | PyPy 3-64 | TESTS | 139 | 2027 | 153702400 | ||
217357348 | misorin | E2 | Aug. 5, 2023, 5:29 p.m. | OK | PyPy 3-64 | TESTS | 139 | 2074 | 153702400 | ||
217396108 | sansen | E2 | Aug. 6, 2023, 2:27 a.m. | OK | Rust 2021 | TESTS | 142 | 155 | 38502400 |
Back to search problems