Codeforces Round 504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final)

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
1023 Codeforces Round 504 (rated, Div. 1 + Div. 2, based on VK Cup 2018 Final) FINISHED False 8100 203009124 Aug. 17, 2018, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 897 ) F Mobile Phone Network PROGRAMMING dfs and similar ds graphs trees 2600

B'You are managing a mobile phone network, and want to offer competitive prices to connect a network. The network has n nodes. Your competitor has already offered some connections between some nodes, with some fixed prices. These connections are bidirectional. There are initially m connections the competitor is offering. The i -th connection your competitor is offering will connect nodes fa_i and fb_i and costs fw_i . You have a list of k connections that you want to offer. It is guaranteed that this set of connection does not form any cycle. The j -th of these connections will connect nodes ga_j and gb_j . These connections are also bidirectional. The cost of these connections have not been decided yet. You can set the prices of these connections to any arbitrary integer value. These prices are set independently for each connection. After setting the prices, the customer will choose such n - 1 connections that all nodes are connected in a single network and the total cost of chosen connections is minimum possible. If there are multiple ways to choose such networks, the customer will choose an arbitrary one that also maximizes the number of your connections in it. You want to set prices in such a way such that all your k connections are chosen by the customer, and the sum of prices of your connections is maximized. Print the maximum profit you can achieve, or -1 if it is unbounded. The first line of input will contain three integers n , k and m ( 1 <= q n, k, m <= q 5 cdot 10^5, k <= q n-1 ), the number of nodes, the number of your connections, and the number of competitor connections, respectively. The next k lines contain two integers ga_i and gb_i ( 1 <= q ga_i, gb_i <= q n , ga_i not= gb_i ), representing one of your connections between nodes ga_i and gb_i . Your set of connections is guaranteed to be acyclic. The next $'...

Tutorials

Codeforces Round 504 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
65908240 hos.lyric F Nov. 28, 2019, 11:53 a.m. OK D TESTS 66 2620 186880000 2600
41756563 Canophia F Aug. 18, 2018, 12:21 p.m. OK GNU C++ TESTS 66 342 35942400 2600
41756032 yanshannan F Aug. 18, 2018, 12:06 p.m. OK GNU C++ TESTS 66 358 36147200 2600
41755513 vjudge3 F Aug. 18, 2018, 11:50 a.m. OK GNU C++ TESTS 66 389 36147200 2600
41755491 luogu_bot5 F Aug. 18, 2018, 11:49 a.m. OK GNU C++ TESTS 66 389 36147200 2600
42191586 rainy_season F Aug. 28, 2018, 3:10 a.m. OK GNU C++ TESTS 66 405 28057600 2600
41714314 _Cwystc_Killer_ F Aug. 17, 2018, 4:07 p.m. OK GNU C++ TESTS 66 436 45158400 2600
42327233 jangjie F Sept. 1, 2018, 6:51 a.m. OK GNU C++ TESTS 66 498 68198400 2600
42458266 Winniechen F Sept. 4, 2018, 12:32 p.m. OK GNU C++ TESTS 66 576 28364800 2600
42458222 Winniechen F Sept. 4, 2018, 12:31 p.m. OK GNU C++ TESTS 66 592 28364800 2600
42327055 daifucong F Sept. 1, 2018, 6:40 a.m. OK GNU C++ TESTS 66 639 28057600 2600
61542946 rng_78 F Sept. 30, 2019, 9:22 a.m. OK GNU C++11 TESTS 66 248 77209600 2600
42721522 ReaLNero1 F Sept. 10, 2018, 2:09 a.m. OK GNU C++11 TESTS 66 295 24780800 2600
42499610 kamiyoru F Sept. 5, 2018, 4:16 p.m. OK GNU C++11 TESTS 66 295 24780800 2600
42499178 kamiyoru F Sept. 5, 2018, 4:01 p.m. OK GNU C++11 TESTS 66 295 26726400 2600
42499776 kamiyoru F Sept. 5, 2018, 4:21 p.m. OK GNU C++11 TESTS 66 296 24780800 2600
68646380 Rubbish12345 F Jan. 12, 2020, 9:12 a.m. OK GNU C++11 TESTS 66 296 30105600 2600
42499429 vjudge4 F Sept. 5, 2018, 4:10 p.m. OK GNU C++11 TESTS 66 311 26726400 2600
42499835 kamiyoru F Sept. 5, 2018, 4:23 p.m. OK GNU C++11 TESTS 66 312 24780800 2600
68628168 star_magic_young F Jan. 12, 2020, 12:28 a.m. OK GNU C++11 TESTS 66 312 33075200 2600
42721025 Anson529 F Sept. 10, 2018, 1:13 a.m. OK GNU C++11 TESTS 66 327 28057600 2600
68645601 iotang F Jan. 12, 2020, 8:58 a.m. OK GNU C++14 TESTS 66 326 34099200 2600
42106842 linkfqy F Aug. 26, 2018, 1:50 a.m. OK GNU C++14 TESTS 66 343 28672000 2600
41741719 wcy1122 F Aug. 18, 2018, 5:49 a.m. OK GNU C++14 TESTS 66 748 42086400 2600
41886066 wangshuhe963 F Aug. 20, 2018, 3:51 a.m. OK GNU C++14 TESTS 66 763 30105600 2600
44018239 vjudge3 F Oct. 9, 2018, 12:36 a.m. OK GNU C++14 TESTS 66 764 24064000 2600
51244390 mayaohua2003 F March 13, 2019, 3:16 a.m. OK GNU C++14 TESTS 66 764 32972800 2600
41826074 fengyecong F Aug. 19, 2018, 12:07 p.m. OK GNU C++14 TESTS 66 780 36147200 2600
41756526 DEMOPON F Aug. 18, 2018, 12:20 p.m. OK GNU C++14 TESTS 66 795 28057600 2600
44065336 gs15120 F Oct. 10, 2018, 8:55 a.m. OK GNU C++14 TESTS 66 795 30720000 2600
41722993 Gromah F Aug. 17, 2018, 4:47 p.m. OK GNU C++14 TESTS 66 811 32563200 2600
66184910 jyf111 F Dec. 2, 2019, 2:06 p.m. OK GNU C++17 TESTS 66 421 38297600 2600
69445763 Shiina_Mashiro19 F Jan. 24, 2020, 2:44 a.m. OK GNU C++17 TESTS 66 436 38809600 2600
55807886 nickluo F June 20, 2019, 12:57 a.m. OK GNU C++17 TESTS 66 452 43724800 2600
42852531 DZYO F Sept. 14, 2018, 6:49 a.m. OK GNU C++17 TESTS 66 561 41062400 2600
43605406 massimodong F Sept. 30, 2018, 12:06 p.m. OK GNU C++17 TESTS 66 639 28057600 2600
41826410 OZTOET F Aug. 19, 2018, 12:16 p.m. OK GNU C++17 TESTS 66 779 28057600 2600
41713059 natsugiri F Aug. 17, 2018, 4:02 p.m. OK GNU C++17 TESTS 66 794 38502400 2600
61914897 Arpa F Oct. 5, 2019, 11:50 a.m. OK GNU C++17 TESTS 66 795 6553600 2600
42616560 vjudge2 F Sept. 7, 2018, 2 p.m. OK GNU C++17 TESTS 66 795 28057600 2600
41745535 ghostfly233 F Aug. 18, 2018, 7:27 a.m. OK GNU C++17 TESTS 66 795 34611200 2600
42196012 tri F Aug. 28, 2018, 6:25 a.m. OK Java 8 TESTS 66 1403 117452800 2600
42196030 tri F Aug. 28, 2018, 6:26 a.m. OK Java 8 TESTS 66 1450 117452800 2600
48156486 fetetriste F Jan. 9, 2019, 5:23 p.m. OK Java 8 TESTS 66 1574 104038400 2600
41725426 Lewin F Aug. 17, 2018, 7:01 p.m. OK Java 8 TESTS 66 1621 133427200 2600
41717190 uwi F Aug. 17, 2018, 4:21 p.m. OK Java 8 TESTS 66 1684 124416000 2600
57470564 beginner1010 F July 21, 2019, 5:57 p.m. OK Java 8 TESTS 66 1762 223232000 2600
41979630 PrakharJain F Aug. 22, 2018, 11:32 p.m. OK Java 8 TESTS 66 1856 160153600 2600
41979651 PrakharJain F Aug. 22, 2018, 11:34 p.m. OK Java 8 TESTS 66 1887 160256000 2600
67262491 Ahmad F Dec. 20, 2019, 4:22 a.m. OK Java 8 TESTS 66 1887 242278400 2600
41717440 Egor F Aug. 17, 2018, 4:22 p.m. OK Java 8 TESTS 66 2401 165580800 2600
59385578 Eva F Aug. 24, 2019, 6:12 a.m. OK Kotlin TESTS 66 1871 194048000 2600
43980186 vjudge4 F Oct. 8, 2018, 1:59 a.m. OK MS C++ TESTS 66 1107 74137600 2600
41733645 davidlee1999WTK F Aug. 18, 2018, 12:54 a.m. OK MS C++ TESTS 66 1622 108032000 2600
41733412 davidlee1999WTK F Aug. 18, 2018, 12:43 a.m. OK MS C++ TESTS 66 1965 108134400 2600
41733625 davidlee1999WTK F Aug. 18, 2018, 12:53 a.m. OK MS C++ TESTS 66 1996 108032000 2600

remove filters

Back to search problems