Codeforces Round 509 (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
1041 Codeforces Round 509 (Div. 2) FINISHED False 7200 200431523 Sept. 16, 2018, 10:35 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 3638 ) E Tree Reconstruction PROGRAMMING constructive algorithms data structures graphs greedy 1900

B'Monocarp has drawn a tree (an undirected connected acyclic graph) and then has given each vertex an index. All indices are distinct numbers from 1 to n . For every edge e of this tree, Monocarp has written two numbers: the maximum indices of the vertices of the two components formed if the edge e (and only this edge) is erased from the tree. Monocarp has given you a list of n - 1 pairs of numbers. He wants you to provide an example of a tree that will produce the said list if this tree exists. If such tree does not exist, say so. The first line contains one integer n ( 2 <= n <= 1 ,000 ) -- the number of vertices in the tree. Each of the next n-1 lines contains two integers a_i and b_i each ( 1 <= a_i < b_i <= n ) -- the maximal indices of vertices in the components formed if the i -th edge is removed. If there is no such tree that can produce the given list of pairs, print "NO" (without quotes). Otherwise print "YES" (without quotes) in the first line and the edges of the tree in the next n - 1 lines. Each of the last n - 1 lines should contain two integers x_i and y_i ( 1 <= x_i, y_i <= n ) -- vertices connected by an edge. Note: The numeration of edges doesn 't matter for this task. Your solution will be considered correct if your tree produces the same pairs as given in the input file (possibly reordered). That means that you can print the edges of the tree you reconstructed in any order. Possible tree from the first example. Dotted lines show edges you need to remove to get appropriate pairs. '...

Tutorials

Codeforces Round #509 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
43078899 Rabbicode E Sept. 19, 2018, 12:57 p.m. OK Clang++17 Diagnostics TESTS 78 77 307200 1900
42936980 fluffyowl E Sept. 16, 2018, 11:43 a.m. OK D TESTS 78 31 4198400 1900
67631666 rr_ E Dec. 26, 2019, 4:26 a.m. OK D TESTS 78 31 4198400 1900
43087470 ruban E Sept. 19, 2018, 4:55 p.m. OK Delphi TESTS 78 31 110387200 1900
42951691 ruban E Sept. 16, 2018, 2:36 p.m. OK Delphi TESTS 78 31 110387200 1900
42945636 pekempey E Sept. 16, 2018, 12:29 p.m. OK GNU C11 TESTS 78 46 0 1900
52256456 WhYnOtmE_ljq E April 3, 2019, 6:02 a.m. OK GNU C++11 TESTS 78 30 0 1900
68958370 vjudge1 E Jan. 16, 2020, 9:47 p.m. OK GNU C++11 TESTS 78 31 0 1900
67168223 run_aroud E Dec. 18, 2019, 4:19 p.m. OK GNU C++11 TESTS 78 31 0 1900
65409645 w_57 E Nov. 20, 2019, 3:10 a.m. OK GNU C++11 TESTS 78 31 0 1900
64734626 luogu_bot1 E Nov. 12, 2019, 9:47 a.m. OK GNU C++11 TESTS 78 31 0 1900
64734313 ctz45562 E Nov. 12, 2019, 9:37 a.m. OK GNU C++11 TESTS 78 31 0 1900
63904108 2016smy E Oct. 31, 2019, 5:58 a.m. OK GNU C++11 TESTS 78 31 0 1900
61603318 WarrenWN E Oct. 1, 2019, 11:50 a.m. OK GNU C++11 TESTS 78 31 0 1900
60705156 LMOliver E Sept. 17, 2019, 4:30 a.m. OK GNU C++11 TESTS 78 31 0 1900
69192329 Naraka E Jan. 20, 2020, 1:52 p.m. OK GNU C++11 TESTS 78 31 0 1900
42933366 kingsnow E Sept. 16, 2018, 11:24 a.m. OK GNU C++14 TESTS 78 30 0 1900
61013541 janurban E Sept. 21, 2019, 12:49 p.m. OK GNU C++14 TESTS 78 30 0 1900
45413467 LODB---D E Nov. 7, 2018, 1:04 p.m. OK GNU C++14 TESTS 78 30 0 1900
44165048 zebas E Oct. 12, 2018, 12:18 a.m. OK GNU C++14 TESTS 78 30 0 1900
42937046 ---------- E Sept. 16, 2018, 11:43 a.m. OK GNU C++14 TESTS 78 30 0 1900
68041035 Lezedary_sandwich E Jan. 1, 2020, 2:20 p.m. OK GNU C++14 TESTS 78 30 102400 1900
47106822 harshlunagaria E Dec. 16, 2018, 1:21 p.m. OK GNU C++14 TESTS 78 30 102400 1900
43005567 hoangmaihuy E Sept. 17, 2018, 3:44 p.m. OK GNU C++14 TESTS 78 30 204800 1900
54914088 SuhasPai3799 E June 1, 2019, 12:44 p.m. OK GNU C++14 TESTS 78 30 204800 1900
49841730 gur_chella E Feb. 12, 2019, 6:50 p.m. OK GNU C++14 TESTS 78 30 204800 1900
53856880 trungvthe130284 E May 7, 2019, 4:46 p.m. OK GNU C++17 TESTS 78 30 0 1900
42957305 surokpro E Sept. 16, 2018, 5 p.m. OK GNU C++17 TESTS 78 30 0 1900
42936508 Ahmed_Morsy E Sept. 16, 2018, 11:40 a.m. OK GNU C++17 TESTS 78 30 0 1900
56612459 vjudge1 E July 6, 2019, 8 a.m. OK GNU C++17 TESTS 78 30 0 1900
59963903 pradyum_bansal namanbansal013 aman_goyal E Sept. 3, 2019, 7:22 p.m. OK GNU C++17 TESTS 78 30 204800 1900
42938336 nishank.suresh E Sept. 16, 2018, 11:50 a.m. OK GNU C++17 TESTS 78 30 204800 1900
45348620 njsfdxfszx59 E Nov. 6, 2018, 5:53 a.m. OK GNU C++17 TESTS 78 30 409600 1900
42996615 Fekete E Sept. 17, 2018, 12:17 p.m. OK GNU C++17 TESTS 78 30 1843200 1900
56796302 vjudge1 E July 10, 2019, 12:38 p.m. OK GNU C++17 TESTS 78 30 3686400 1900
68835356 KellyLu E Jan. 15, 2020, 2:44 a.m. OK GNU C++17 TESTS 78 31 0 1900
43183336 Marii E Sept. 21, 2018, 2:20 p.m. OK Go TESTS 78 46 0 1900
42958547 Haar E Sept. 16, 2018, 5:41 p.m. OK Haskell TESTS 78 46 8601600 1900
67983492 bleh0.5 E Dec. 30, 2019, 8:40 p.m. OK Java 11 TESTS 78 218 0 1900
68956390 bhautik_77 E Jan. 16, 2020, 8:23 p.m. OK Java 8 TESTS 78 109 0 1900
50613911 mikkk E Feb. 28, 2019, 6:21 p.m. OK Java 8 TESTS 78 124 0 1900
49737668 KulikAlex E Feb. 10, 2019, 6:02 p.m. OK Java 8 TESTS 78 124 0 1900
47337814 gtpan77 jonsnow7 E Dec. 21, 2018, 3:55 p.m. OK Java 8 TESTS 78 124 0 1900
46391627 SpargelTarzan E Nov. 30, 2018, 6:20 a.m. OK Java 8 TESTS 78 124 0 1900
45399460 donli E Nov. 7, 2018, 7:27 a.m. OK Java 8 TESTS 78 124 0 1900
45346855 donli E Nov. 6, 2018, 4:05 a.m. OK Java 8 TESTS 78 124 0 1900
45346211 donli E Nov. 6, 2018, 3:22 a.m. OK Java 8 TESTS 78 124 0 1900
45205097 wadissimo E Nov. 2, 2018, 12:18 p.m. OK Java 8 TESTS 78 124 0 1900
68960841 O_E E Jan. 17, 2020, 12:37 a.m. OK Java 8 TESTS 78 124 0 1900
43411564 P_Nyagolov E Sept. 25, 2018, 1:40 p.m. OK JavaScript TESTS 78 46 1433600 1900
42961978 mircea85 E Sept. 16, 2018, 7:50 p.m. OK Mono C# TESTS 78 61 512000 1900
58523688 og.kostya E Aug. 10, 2019, 6:09 a.m. OK Mono C# TESTS 78 62 1740800 1900
42958173 omikad E Sept. 16, 2018, 5:28 p.m. OK Mono C# TESTS 78 77 4096000 1900
49858745 vjudge2 E Feb. 13, 2019, 8:29 a.m. OK MS C++ TESTS 78 31 0 1900
43157893 mandinga E Sept. 20, 2018, 9:21 p.m. OK MS C++ TESTS 78 31 0 1900
49859549 XRDS-BJFU101 E Feb. 13, 2019, 8:51 a.m. OK MS C++ TESTS 78 31 0 1900
49948982 vjudge5 E Feb. 15, 2019, 1:16 p.m. OK MS C++ TESTS 78 31 0 1900
57465090 vjudge5 E July 21, 2019, 3:15 p.m. OK MS C++ TESTS 78 31 0 1900
43109493 nik1998 E Sept. 20, 2018, 10:56 a.m. OK MS C++ TESTS 78 31 102400 1900
43081854 XDIMANX007 E Sept. 19, 2018, 2:13 p.m. OK MS C++ TESTS 78 31 102400 1900
43010444 dimdem E Sept. 17, 2018, 6:15 p.m. OK MS C++ TESTS 78 31 102400 1900
43024082 absi2011 E Sept. 18, 2018, 7:28 a.m. OK MS C++ TESTS 78 31 307200 1900
42980524 vjudge3 E Sept. 17, 2018, 8:48 a.m. OK MS C++ TESTS 78 31 307200 1900
56629643 fishdog E July 6, 2019, 3:36 p.m. OK MS C++ 2017 TESTS 78 46 0 1900
57725941 YESMAths E July 25, 2019, 7:09 a.m. OK PyPy 2 TESTS 78 186 921600 1900
57725583 YESMAths E July 25, 2019, 7:02 a.m. OK PyPy 2 TESTS 78 186 921600 1900
62519342 deadguy E Oct. 13, 2019, 3:17 p.m. OK PyPy 3 TESTS 78 234 4505600 1900
43564776 qguaihudou E Sept. 29, 2018, 10:39 a.m. OK PyPy 3 TESTS 78 248 2867200 1900
43020245 Djok216 E Sept. 18, 2018, 4:01 a.m. OK Python 2 TESTS 78 187 102400 1900
42934276 nwi E Sept. 16, 2018, 11:29 a.m. OK Python 2 TESTS 78 217 102400 1900
43152615 sergovoy E Sept. 20, 2018, 6:09 p.m. OK Python 3 TESTS 78 124 102400 1900
58387985 NocturneBflat E Aug. 6, 2019, 12:41 p.m. OK Python 3 TESTS 78 124 409600 1900
42940402 layog E Sept. 16, 2018, 12:01 p.m. OK Python 3 TESTS 78 140 204800 1900
42943017 anagohirame E Sept. 16, 2018, 12:15 p.m. OK Python 3 TESTS 78 155 204800 1900
42971707 n0n_n0n E Sept. 17, 2018, 6:53 a.m. OK Python 3 TESTS 78 155 1126400 1900
42953213 coro65536 E Sept. 16, 2018, 3:01 p.m. OK Python 3 TESTS 78 202 512000 1900
42951451 yakamoto E Sept. 16, 2018, 2:33 p.m. OK Scala TESTS 78 670 614400 1900

remove filters

Back to search problems