Codeforces Round 547 (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
1141 Codeforces Round 547 (Div. 3) FINISHED False 7200 184433087 March 19, 2019, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2330 ) G Privatization of Roads in Treeland PROGRAMMING binary search constructive algorithms dfs and similar graphs greedy trees 2500

B"Treeland consists of n cities and n-1 roads. Each road is bidirectional and connects two distinct cities. From any city you can get to any other city by roads. Yes, you are right -- the country's topology is an undirected tree. There are some private road companies in Treeland. The government decided to sell roads to the companies. Each road will belong to one company and a company can own multiple roads. The government is afraid to look unfair. They think that people in a city can consider them unfair if there is one company which owns two or more roads entering the city. The government wants to make such privatization that the number of such cities doesn't exceed k and the number of companies taking part in the privatization is minimal. Choose the number of companies r such that it is possible to assign each road to one company in such a way that the number of cities that have two or more roads of one company is at most k . In other words, if for a city all the roads belong to the different companies then the city is good. Your task is to find the minimal r that there is such assignment to companies from 1 to r that the number of cities which are not good doesn't exceed k . The first line contains two integers n and k ( 2 <= n <= 200000, 0 <= k <= n - 1 ) -- the number of cities and the maximal number of cities which can have two or more roads belonging to one company. The following n-1 lines contain roads, one road per line. Each line contains a pair of integers x_i , y_i ( 1 <= x_i, y_i <= n ), where x_i , y_i are cities connected with the i -th road. In the first line print the required r ( 1 <= r <= n - 1 ). In the second line print n-1 numbers c_1, c_2, ... , c_{n-1} ( 1 <= c_i <= r ), where c_i is the company to own the i -th road. If there are multiple answers, print any of them. "...

Tutorials

66062

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
52764473 Denor G April 15, 2019, 1:21 a.m. OK Delphi TESTS 144 202 13721600 2500
52146849 chaorenhaha G April 1, 2019, 9:48 a.m. OK FPC TESTS 144 717 15052800 2500
53823443 rainboy G May 6, 2019, 2:33 p.m. OK GNU C11 TESTS 144 764 21606400 2500
51928062 prayerhgq G March 28, 2019, 8:50 a.m. OK GNU C++11 TESTS 144 78 16793600 2500
55610422 ReaLNero1 G June 16, 2019, 5:18 a.m. OK GNU C++11 TESTS 144 78 23654400 2500
61775154 fnoi16wjhui G Oct. 3, 2019, 11:30 a.m. OK GNU C++11 TESTS 144 93 8806400 2500
57123686 clya2004 G July 16, 2019, 2:55 a.m. OK GNU C++11 TESTS 144 124 15052800 2500
52226176 Potassium_ G April 2, 2019, 9:36 a.m. OK GNU C++11 TESTS 144 124 15769600 2500
52226216 Potassium_ G April 2, 2019, 9:38 a.m. OK GNU C++11 TESTS 144 124 15769600 2500
60382152 nwpu2018302329 G Sept. 11, 2019, 9:43 a.m. OK GNU C++11 TESTS 144 124 16793600 2500
54754969 nightsunflower G May 28, 2019, 2:35 p.m. OK GNU C++11 TESTS 144 124 17715200 2500
52312398 BBuf G April 4, 2019, 3:18 p.m. OK GNU C++11 TESTS 144 124 18432000 2500
61820373 luogu_bot1 G Oct. 4, 2019, 1:58 a.m. OK GNU C++11 TESTS 144 139 16588800 2500
52221552 tj.TDD G April 2, 2019, 6:54 a.m. OK GNU C++14 TESTS 144 140 15257600 2500
52515143 Rabbittank G April 9, 2019, 4:39 a.m. OK GNU C++14 TESTS 144 155 15974400 2500
51857294 buerdepepeqi G March 26, 2019, 11:43 a.m. OK GNU C++14 TESTS 144 156 22835200 2500
53603736 danya.smelskiy G May 1, 2019, 9:12 a.m. OK GNU C++14 TESTS 144 187 20172800 2500
52480425 boatinw99 G April 8, 2019, 4:57 a.m. OK GNU C++14 TESTS 144 187 20889600 2500
52446956 AlexPanda G April 7, 2019, 8:20 a.m. OK GNU C++14 TESTS 144 187 20992000 2500
52481327 YoungForUzz G April 8, 2019, 5:47 a.m. OK GNU C++14 TESTS 144 187 30412800 2500
51991087 Dambola G March 29, 2019, 8:09 p.m. OK GNU C++14 TESTS 144 202 15667200 2500
52521788 _HYX_ G April 9, 2019, 9:09 a.m. OK GNU C++14 TESTS 144 202 19456000 2500
53220673 YJH143 G April 24, 2019, 11:42 a.m. OK GNU C++14 TESTS 144 202 20172800 2500
52642052 gyz_gyz G April 12, 2019, 12:54 p.m. OK GNU C++17 TESTS 144 140 29593600 2500
51812434 henu-wxj G March 25, 2019, 6:53 a.m. OK GNU C++17 TESTS 144 155 16793600 2500
52451504 Hugh_Locke G April 7, 2019, 9:57 a.m. OK GNU C++17 TESTS 144 155 16793600 2500
53039318 CodeBells G April 20, 2019, 8:58 a.m. OK GNU C++17 TESTS 144 155 17612800 2500
65339129 happy_ G Nov. 19, 2019, 10:15 a.m. OK GNU C++17 TESTS 144 156 15257600 2500
58104348 2005lz G Aug. 1, 2019, 3:13 a.m. OK GNU C++17 TESTS 144 156 15974400 2500
60823165 yuxizi G Sept. 19, 2019, 1:59 a.m. OK GNU C++17 TESTS 144 156 15974400 2500
53473678 H4XeO6 G April 28, 2019, 2:09 p.m. OK GNU C++17 TESTS 144 156 16793600 2500
55462344 Keven G June 11, 2019, 3:12 p.m. OK GNU C++17 TESTS 144 156 20787200 2500
56786248 Pro_king G July 10, 2019, 8:35 a.m. OK GNU C++17 TESTS 144 171 18636800 2500
66267403 dalt G Dec. 4, 2019, 11:01 a.m. OK Java 11 TESTS 144 1887 222105600 2500
54760863 caoash G May 28, 2019, 3:49 p.m. OK Java 8 TESTS 144 514 58880000 2500
51922159 yorky G March 28, 2019, 5:20 a.m. OK Java 8 TESTS 144 592 46182400 2500
51807567 flyman3046 G March 25, 2019, 12:16 a.m. OK Java 8 TESTS 144 639 45363200 2500
51839775 kuldeeppatel G March 25, 2019, 8:37 p.m. OK Java 8 TESTS 144 639 59904000 2500
52805951 GiantTornado G April 16, 2019, 4:30 a.m. OK Java 8 TESTS 144 670 58982400 2500
51980098 Molven G March 29, 2019, 3:56 p.m. OK Java 8 TESTS 144 686 59904000 2500
52797846 CloverAsta G April 15, 2019, 10:53 p.m. OK Java 8 TESTS 144 701 55705600 2500
53823925 Dukkha G May 6, 2019, 2:50 p.m. OK Java 8 TESTS 144 779 57344000 2500
51840572 aakashjaiswal G March 25, 2019, 9:23 p.m. OK Java 8 TESTS 144 826 59392000 2500
64259129 procrastinate7 G Nov. 4, 2019, 3:58 p.m. OK Java 8 TESTS 144 857 109260800 2500
52256587 exs G April 3, 2019, 6:09 a.m. OK Kotlin TESTS 144 1918 48844800 2500
55684515 og.kostya G June 17, 2019, 2:46 p.m. OK Mono C# TESTS 144 482 38809600 2500
52451446 vjudge1 G April 7, 2019, 9:56 a.m. OK MS C++ TESTS 144 186 13619200 2500
53601199 wjfwjfwjf G May 1, 2019, 7:47 a.m. OK MS C++ TESTS 144 202 16896000 2500
52293575 bryanhuang2000 G April 4, 2019, 4:31 a.m. OK MS C++ TESTS 144 514 18432000 2500
56591135 CtrlAlt G July 5, 2019, 5:29 p.m. OK MS C++ 2017 TESTS 144 265 17305600 2500
51926528 SyavaSpb G March 28, 2019, 8:01 a.m. OK MS C++ 2017 TESTS 144 592 17203200 2500
51887507 yumtam G March 27, 2019, 7:15 a.m. OK PyPy 3 TESTS 144 873 64000000 2500
54323646 Pedantic G May 18, 2019, 12:22 a.m. OK PyPy 3 TESTS 144 1357 64102400 2500
56950356 sidor.poland G July 13, 2019, 1:51 a.m. OK PyPy 3 TESTS 144 1481 74240000 2500
51892857 Helli.code G March 27, 2019, 10:05 a.m. OK Python 2 TESTS 144 1481 92672000 2500
51943925 Soapen hops378 Felerius G March 28, 2019, 3:49 p.m. OK Python 3 TESTS 144 1981 64409600 2500
51954871 ksun_fan G March 29, 2019, 12:55 a.m. OK Ruby TESTS 144 1247 90828800 2500
59945292 Lancern G Sept. 3, 2019, 12:48 p.m. OK Rust TESTS 144 187 40140800 2500
61399782 sansen G Sept. 28, 2019, 4:36 a.m. OK Rust TESTS 144 217 22630400 2500

remove filters

Back to search problems