Codeforces Round 715 (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
1508 Codeforces Round 715 (Div. 1) FINISHED False 8100 118682663 April 16, 2021, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 353 ) E Tree Calendar PROGRAMMING brute force constructive algorithms dfs and similar sortings

B'Yuu Koito and Touko Nanami are newlyweds! On the wedding day, Yuu gifted Touko a directed tree with n nodes and rooted at 1 , and a labeling a which is some DFS order of the tree. Every edge in this tree is directed away from the root. After calling dfs(1) the following algorithm returns a as a DFS order of a tree rooted at 1 : Note that there may be different DFS orders for a given tree. Touko likes the present so much she decided to play with it! On each day following the wedding day, Touko performs this procedure once: Days have passed since their wedding, and Touko has somehow forgotten which date the wedding was and what was the original labeling a ! Fearing that Yuu might get angry, Touko decided to ask you to derive these two pieces of information using the current labeling. Being her good friend, you need to find the number of days that have passed since the wedding, and the original labeling of the tree. However, there is a chance that Touko might have messed up her procedures, which result in the current labeling being impossible to obtain from some original labeling; in that case, please inform Touko as well. The first line of the input contains an integer n ( 2 <= n <= 3 cdot 10^5 ) -- the number of nodes on the tree. The second line contains n integers a_1 , a_2 , ..., a_n ( 1 <= a_i <= n , all a_i are distinct) -- the current labeling of the tree. Each of the next n - 1 lines contains two integers u_i and v_i ( 1 <= u, v <= n , u neq v ), describing an directed edge from u_i to v_i . The edges form a directed tree rooted at 1 . If the current labeling is impossible to arrive at from any DFS order, print NO. Else, on the first line, print YES. On the second line, print a single integer denoting the number of days since the wedding. On the third line, print n numbers space-separated denoting the original labelin'...

Tutorials

Codeforces Round #715 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
113275668 rainboy E April 16, 2021, 9:06 p.m. OK GNU C11 TESTS 59 1357 28979200
113254312 Alice_foo_foo E April 16, 2021, 4:44 p.m. OK GNU C++11 TESTS 59 483 45670400
113249169 duality E April 16, 2021, 4:30 p.m. OK GNU C++11 TESTS 59 530 52019200
113262014 Kaycee E April 16, 2021, 5:45 p.m. OK GNU C++11 TESTS 59 623 81100800
113258404 fanache99 E April 16, 2021, 5:15 p.m. OK GNU C++11 TESTS 59 779 36352000
113253919 Isonan E April 16, 2021, 4:43 p.m. OK GNU C++11 TESTS 59 1934 74752000
113260663 Farhod_Farmon E April 16, 2021, 5:32 p.m. OK GNU C++14 TESTS 59 404 31539200
113228851 Radewoosh E April 16, 2021, 3:38 p.m. OK GNU C++14 TESTS 59 451 78028800
113262480 al3xstr33t E April 16, 2021, 5:49 p.m. OK GNU C++14 TESTS 59 467 38195200
113246922 DmitryGrigorev E April 16, 2021, 4:24 p.m. OK GNU C++14 TESTS 59 545 45875200
113250503 caoyue E April 16, 2021, 4:34 p.m. OK GNU C++14 TESTS 59 576 143052800
113249222 djq_fpc E April 16, 2021, 4:30 p.m. OK GNU C++14 TESTS 59 763 67481600
113277869 AwakeAnay E April 16, 2021, 10:04 p.m. OK GNU C++14 TESTS 59 1340 49049600
113288140 1-gon E April 17, 2021, 3:28 a.m. OK GNU C++17 TESTS 59 358 38707200
113239041 ksun48 E April 16, 2021, 4:03 p.m. OK GNU C++17 TESTS 59 405 36966400
113253035 SirShokoladina E April 16, 2021, 4:41 p.m. OK GNU C++17 TESTS 59 436 22323200
113256527 never_giveup E April 16, 2021, 4:49 p.m. OK GNU C++17 TESTS 59 436 27238400
113287762 frg E April 17, 2021, 3:20 a.m. OK GNU C++17 TESTS 59 467 30208000
113245115 tlwpdus E April 16, 2021, 4:19 p.m. OK GNU C++17 TESTS 59 514 44646400
113258409 Golovanov399 E April 16, 2021, 5:15 p.m. OK GNU C++17 TESTS 59 560 61235200
113272986 maximumSHOT E April 16, 2021, 8:17 p.m. OK GNU C++17 TESTS 59 935 67584000
113238610 Petr E April 16, 2021, 4:01 p.m. OK GNU C++17 (64) TESTS 59 327 48128000
113261188 jtnydv25 E April 16, 2021, 5:36 p.m. OK GNU C++17 (64) TESTS 59 327 59187200
113263313 Kuroni E April 16, 2021, 5:58 p.m. OK GNU C++17 (64) TESTS 59 343 49254400
113255274 blackbori E April 16, 2021, 4:47 p.m. OK GNU C++17 (64) TESTS 59 343 57958400
113267168 antony191 E April 16, 2021, 6:46 p.m. OK GNU C++17 (64) TESTS 59 358 54886400
113295506 sigma425 E April 17, 2021, 5:37 a.m. OK GNU C++17 (64) TESTS 59 358 65024000
113247201 user202729_ E April 16, 2021, 4:24 p.m. OK GNU C++17 (64) TESTS 59 374 56217600
113274121 Xylofo E April 16, 2021, 8:34 p.m. OK GNU C++17 (64) TESTS 59 389 50483200
113231701 maroonrk E April 16, 2021, 3:44 p.m. OK GNU C++17 (64) TESTS 59 420 72192000
113228353 ecnerwala E April 16, 2021, 3:37 p.m. OK GNU C++17 (64) TESTS 59 421 57651200
113258920 uwi E April 16, 2021, 5:19 p.m. OK Java 11 TESTS 59 1029 85094400
113261955 Tlatoani E April 16, 2021, 5:44 p.m. OK Kotlin TESTS 59 1200 54272000
113258223 sansen E April 16, 2021, 5:14 p.m. OK Rust TESTS 59 374 71987200

remove filters

Back to search problems