Codeforces Round 527 (Div. 3)

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
1092 Codeforces Round 527 (Div. 3) FINISHED False 7200 192295487 Dec. 18, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1788 ) E Minimal Diameter Forest PROGRAMMING constructive algorithms dfs and similar greedy trees 2500

B'You are given a forest -- an undirected graph with n vertices such that each its connected component is a tree. The diameter (aka "longest shortest path") of a connected undirected graph is the maximum number of edges in the shortest path between any pair of its vertices. You task is to add some edges (possibly zero) to the graph so that it becomes a tree and the diameter of the tree is minimal possible. If there are multiple correct answers, print any of them. The first line contains two integers n and m ( 1 <= n <= 1000 , 0 <= m <= n - 1 ) -- the number of vertices of the graph and the number of edges, respectively. Each of the next m lines contains two integers v and u ( 1 <= v, u <= n , v ne u ) -- the descriptions of the edges. It is guaranteed that the given graph is a forest. In the first line print the diameter of the resulting tree. Each of the next (n - 1) - m lines should contain two integers v and u ( 1 <= v, u <= n , v ne u ) -- the descriptions of the added edges. The resulting graph should be a tree and its diameter should be minimal possible. For m = n - 1 no edges are added, thus the output consists of a single integer -- diameter of the given tree. If there are multiple correct answers, print any of them. In the first example adding edges (1, 4) or (3, 4) will lead to a total diameter of 3. Adding edge (2, 4), however, will make it 2. Edge (1, 2) is the only option you have for the second example. The diameter is 1. You can 't add any edges in the third example. The diameter is already 2. '...

Tutorials

Codeforces Round #527 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
47306636 Graphter E Dec. 20, 2018, 5:08 p.m. OK Clang++17 Diagnostics TESTS 34 62 9523200 2500
54991660 Denor E June 2, 2019, 7:10 p.m. OK Delphi TESTS 34 31 102400 2500
47239723 ruban E Dec. 19, 2018, 12:02 a.m. OK Delphi TESTS 34 108 235929600 2500
56717886 rainboy E July 8, 2019, 3:23 p.m. OK GNU C11 TESTS 34 31 102400 2500
47551502 CSHwang E Dec. 27, 2018, 1:16 p.m. OK GNU C++11 TESTS 34 15 0 2500
52936662 huangzhen E April 18, 2019, 6:52 a.m. OK GNU C++11 TESTS 34 15 512000 2500
62778426 Rikuki E Oct. 17, 2019, 12:18 p.m. OK GNU C++11 TESTS 34 15 5427200 2500
47397238 AuqaKyz E Dec. 23, 2018, 11:59 a.m. OK GNU C++11 TESTS 34 30 102400 2500
47533753 limabeans E Dec. 26, 2018, 9:55 p.m. OK GNU C++11 TESTS 34 30 102400 2500
47369145 zhtzht E Dec. 22, 2018, 1:14 p.m. OK GNU C++11 TESTS 34 30 102400 2500
47272672 prodipdatta7 E Dec. 19, 2018, 5:29 p.m. OK GNU C++11 TESTS 34 30 102400 2500
53540295 Scut82 E April 30, 2019, 6:16 a.m. OK GNU C++11 TESTS 34 30 102400 2500
47315720 jzqjzq E Dec. 21, 2018, 3:06 a.m. OK GNU C++11 TESTS 34 30 409600 2500
47546419 zstu_MingSD E Dec. 27, 2018, 10:25 a.m. OK GNU C++11 TESTS 34 30 3276800 2500
52499077 xiaolongbao E April 8, 2019, 3:08 p.m. OK GNU C++14 TESTS 34 15 102400 2500
47539929 nganhvu E Dec. 27, 2018, 6:15 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47322494 ArshiaDadras E Dec. 21, 2018, 8:34 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47314392 shdut E Dec. 21, 2018, 12:36 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47313783 eu3neuom E Dec. 20, 2018, 11:23 p.m. OK GNU C++14 TESTS 34 15 204800 2500
49904974 black_horse2014 E Feb. 14, 2019, 11:31 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47269874 kirai E Dec. 19, 2018, 4:07 p.m. OK GNU C++14 TESTS 34 15 204800 2500
47258565 Hamzqq9 E Dec. 19, 2018, 11:25 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47228380 RUSH_D_CAT E Dec. 18, 2018, 5:07 p.m. OK GNU C++14 TESTS 34 15 204800 2500
47284436 Kyuu E Dec. 20, 2018, 5:01 a.m. OK GNU C++14 TESTS 34 15 204800 2500
47252604 bittudalal E Dec. 19, 2018, 8:58 a.m. OK GNU C++17 TESTS 34 15 204800 2500
55490346 Felerius E June 12, 2019, 9:47 a.m. OK GNU C++17 TESTS 34 15 204800 2500
47332690 AM. E Dec. 21, 2018, 1:40 p.m. OK GNU C++17 TESTS 34 15 204800 2500
47315615 Juaanma E Dec. 21, 2018, 2:54 a.m. OK GNU C++17 TESTS 34 15 204800 2500
47312407 JonathanR E Dec. 20, 2018, 9:08 p.m. OK GNU C++17 TESTS 34 15 204800 2500
47282603 cjnwq E Dec. 20, 2018, 3:05 a.m. OK GNU C++17 TESTS 34 15 204800 2500
47259476 badcw E Dec. 19, 2018, 11:46 a.m. OK GNU C++17 TESTS 34 15 204800 2500
47232347 ______-__________-______ E Dec. 18, 2018, 6:42 p.m. OK GNU C++17 TESTS 34 15 204800 2500
47228079 Chi E Dec. 18, 2018, 5:01 p.m. OK GNU C++17 TESTS 34 15 204800 2500
48403446 sys. E Jan. 15, 2019, 12:47 a.m. OK GNU C++17 TESTS 34 15 307200 2500
47779205 ledinhbao E Dec. 31, 2018, 6:52 a.m. OK Go TESTS 34 31 0 2500
48054031 2008061626 E Jan. 7, 2019, 11:09 a.m. OK Go TESTS 34 31 5324800 2500
48902357 ZeyadKhattab E Jan. 24, 2019, 6:36 p.m. OK Java 8 TESTS 34 124 0 2500
47860075 jayliner66 E Jan. 3, 2019, 5:15 a.m. OK Java 8 TESTS 34 124 0 2500
47379047 Intrincantation E Dec. 22, 2018, 7:26 p.m. OK Java 8 TESTS 34 124 0 2500
47358138 icpc_loser E Dec. 22, 2018, 7:18 a.m. OK Java 8 TESTS 34 124 0 2500
47305717 wadissimo E Dec. 20, 2018, 4:35 p.m. OK Java 8 TESTS 34 124 0 2500
47284485 programbhavan E Dec. 20, 2018, 5:03 a.m. OK Java 8 TESTS 34 124 0 2500
47270384 kunal725725 E Dec. 19, 2018, 4:21 p.m. OK Java 8 TESTS 34 124 0 2500
47267468 yellowjian E Dec. 19, 2018, 2:59 p.m. OK Java 8 TESTS 34 124 0 2500
60753857 yaoct E Sept. 18, 2019, 7:50 a.m. OK Java 8 TESTS 34 124 0 2500
52688131 mikkk E April 13, 2019, 2:19 p.m. OK Java 8 TESTS 34 124 0 2500
47289526 moss3s E Dec. 20, 2018, 8:20 a.m. OK Kotlin TESTS 34 156 0 2500
47708140 Anastasiya_Andreevna E Dec. 29, 2018, 10:49 p.m. OK Mono C# TESTS 34 62 6656000 2500
47292494 omikad E Dec. 20, 2018, 10:10 a.m. OK Mono C# TESTS 34 62 6656000 2500
53789799 kz20182726kz E May 5, 2019, 12:12 p.m. OK MS C++ TESTS 34 46 102400 2500
57852595 Bettledemire_ E July 27, 2019, 1:44 p.m. OK MS C++ 2017 TESTS 34 31 20582400 2500
47343815 mayakin E Dec. 21, 2018, 6:36 p.m. OK PHP TESTS 34 249 512000 2500
50799693 gatsko E March 4, 2019, 9:40 p.m. OK PyPy 2 TESTS 34 187 2764800 2500
47237371 whatshisbucket E Dec. 18, 2018, 9:28 p.m. OK Python 3 TESTS 34 109 204800 2500
48365382 masya38ru E Jan. 13, 2019, 9:24 p.m. OK Python 3 TESTS 34 124 716800 2500
50568105 galim665 E Feb. 27, 2019, 2:03 p.m. OK Python 3 TESTS 34 1075 819200 2500
49994892 __ACoder E Feb. 16, 2019, 2:29 p.m. OK Python 3 TESTS 34 1107 716800 2500
47318025 yakamoto E Dec. 21, 2018, 5:45 a.m. OK Scala TESTS 34 467 0 2500

remove filters

Back to search problems