Codeforces Round 601 (Div. 1)

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
1254 Codeforces Round 601 (Div. 1) FINISHED False 7200 163265087 Nov. 19, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 275 ) E Send Tree to Charlie PROGRAMMING combinatorics dfs and similar ds trees 3200

B"Christmas was knocking on the door, and our protagonist, Bob, was preparing a spectacular present for his long-time second best friend Charlie. As chocolate boxes are lame, he decided to decorate a tree instead. Bob's tree can be represented as an undirected connected graph with n nodes (numbered 1 to n ) and n-1 edges. Initially, Bob placed a decoration with label i on node i , for each 1 <= i <= n . However, as such a simple arrangement is lame, he decided to shuffle the decorations a bit. Formally, Bob did the following steps: After finishing, Bob seemed satisfied with the arrangement, so he went to sleep. The next morning, Bob wakes up only to find out that his beautiful arrangement has been ruined! Last night, Bob's younger brother Bobo dropped some of the decorations on the floor while he was playing with the tree. Fortunately, no decorations were lost, so Bob can repair the tree in no time. However, he completely forgets how the tree looked like yesterday. Therefore, given the labels of the decorations still on the tree, Bob wants to know the number of possible configurations of the tree. As the result can be quite large, Bob will be happy if you can output the result modulo 1000000007 ( 10^9+7 ). Note that, it is possible that there exists no possible configurations. The first line contains a single integer n ( 2 <= q n <= q 500 ,000 ) -- the number of nodes. Each of the next n - 1 lines contains two integers u and v ( 1 <= q u, v <= q n ), denoting that there is an edge connecting two nodes u and v . It is guaranteed that the given edges form a tree. The last line contains n integers a_1, a_2, ldots, a_n ( 0 <= a_i <= n ). For each i , a_i = 0 means that the decoration of node i has been dropped on the floor. Otherwise, a_i is the label of the decoration of node i . It is guaranteed that no label appears mo"...

Tutorials

Codeforces Round #601 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
65613424 rainboy E Nov. 24, 2019, 1:34 a.m. OK GNU C11 TESTS 31 686 61542400 3200
66541002 Aita_Venkata_Rishmitha E Dec. 9, 2019, 11:30 a.m. OK GNU C++11 TESTS 31 561 75878400 3200
65410287 WZYYN E Nov. 20, 2019, 3:41 a.m. OK GNU C++11 TESTS 31 623 60006400 3200
65386461 1919810 E Nov. 19, 2019, 4:27 p.m. OK GNU C++11 TESTS 31 685 109977600 3200
65471411 dqa2020 E Nov. 21, 2019, 8:31 a.m. OK GNU C++11 TESTS 31 732 75878400 3200
65697916 egoist E Nov. 25, 2019, 9:17 a.m. OK GNU C++11 TESTS 31 733 86425600 3200
65387985 _rqy E Nov. 19, 2019, 4:32 p.m. OK GNU C++11 TESTS 31 733 106086400 3200
66629549 hobbies E Dec. 11, 2019, 10:37 a.m. OK GNU C++11 TESTS 31 748 92569600 3200
65731351 Owen_codeisking E Nov. 26, 2019, 5:17 a.m. OK GNU C++11 TESTS 31 904 86937600 3200
65490237 Big_black_jujube E Nov. 21, 2019, 2:20 p.m. OK GNU C++11 TESTS 31 1107 88268800 3200
65464553 Don_Quijote E Nov. 21, 2019, 5:03 a.m. OK GNU C++11 TESTS 31 1122 80896000 3200
65505723 Motarack E Nov. 21, 2019, 10:15 p.m. OK GNU C++14 TESTS 31 624 63692800 3200
65553499 obadayousef E Nov. 22, 2019, 8:03 p.m. OK GNU C++14 TESTS 31 639 63692800 3200
66535782 mayaohua2003 E Dec. 9, 2019, 9:32 a.m. OK GNU C++14 TESTS 31 841 71270400 3200
65908568 jiangly E Nov. 28, 2019, 12:01 p.m. OK GNU C++14 TESTS 31 857 75264000 3200
65563752 Toxel E Nov. 23, 2019, 4:47 a.m. OK GNU C++14 TESTS 31 920 69222400 3200
65391860 ecnerwala E Nov. 19, 2019, 5:47 p.m. OK GNU C++14 TESTS 31 935 73011200 3200
65695540 Owen_codeisking E Nov. 25, 2019, 7:54 a.m. OK GNU C++14 TESTS 31 950 87142400 3200
66229591 yan-zp E Dec. 3, 2019, 1:54 p.m. OK GNU C++14 TESTS 31 966 69324800 3200
65516971 beginend E Nov. 22, 2019, 6:30 a.m. OK GNU C++14 TESTS 31 966 73420800 3200
65898484 tmwilliamlin168 E Nov. 28, 2019, 7:31 a.m. OK GNU C++14 TESTS 31 1028 79462400 3200
65413669 Kuroni E Nov. 20, 2019, 5:47 a.m. OK GNU C++17 TESTS 31 701 46284800 3200
65524410 _D41_ E Nov. 22, 2019, 9:45 a.m. OK GNU C++17 TESTS 31 701 70041600 3200
65440435 GreymaneSilverfang E Nov. 20, 2019, 2:11 p.m. OK GNU C++17 TESTS 31 717 87449600 3200
65413741 Kuroni E Nov. 20, 2019, 5:49 a.m. OK GNU C++17 TESTS 31 732 46284800 3200
65713818 krijgertje E Nov. 25, 2019, 3:34 p.m. OK GNU C++17 TESTS 31 779 93798400 3200
65563130 mango_lassi E Nov. 23, 2019, 4:23 a.m. OK GNU C++17 TESTS 31 795 67174400 3200
65439553 GreymaneSilverfang E Nov. 20, 2019, 1:54 p.m. OK GNU C++17 TESTS 31 795 87449600 3200
65440262 GreymaneSilverfang E Nov. 20, 2019, 2:07 p.m. OK GNU C++17 TESTS 31 810 87449600 3200
66729455 bnaninaidu9949 E Dec. 12, 2019, 5:02 p.m. OK GNU C++17 TESTS 31 935 76083200 3200
65439133 GreymaneSilverfang E Nov. 20, 2019, 1:48 p.m. OK GNU C++17 TESTS 31 967 87449600 3200
65613082 Dukkha E Nov. 24, 2019, 1:15 a.m. OK Java 11 TESTS 31 2667 115200000 3200

remove filters

Back to search problems