Codeforces Round 523 (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
1061 Codeforces Round 523 (Div. 2) FINISHED False 7200 194624124 Nov. 22, 2018, 3:45 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 539 ) E Politics PROGRAMMING flows graphs 2800

B"There are n cities in the country. Two candidates are fighting for the post of the President. The elections are set in the future, and both candidates have already planned how they are going to connect the cities with roads. Both plans will connect all cities using n - 1 roads only. That is, each plan can be viewed as a tree. Both of the candidates had also specified their choice of the capital among n cities ( x for the first candidate and y for the second candidate), which may or may not be same. Each city has a potential of building a port (one city can have at most one port). Building a port in i -th city brings a_i amount of money. However, each candidate has his specific demands. The demands are of the form: Find out the maximum revenue that can be gained while fulfilling all demands of both candidates, or print -1 if it is not possible to do. It is additionally guaranteed, that each candidate has specified the port demands for the capital of his choice. The first line contains integers n , x and y ( 1 <= n <= 500 , 1 <= x, y <= n ) -- the number of cities, the capital of the first candidate and the capital of the second candidate respectively. Next line contains integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 100 ,000 ) -- the revenue gained if the port is constructed in the corresponding city. Each of the next n - 1 lines contains integers u_i and v_i ( 1 <= u_i, v_i <= n , u_i ne v_i ), denoting edges between cities in the tree of the first candidate. Each of the next n - 1 lines contains integers u'_i and v'_i ( 1 <= u'_i, v'_i <= n , u'_i ne v'_i ), denoting edges between cities in the tree of the second candidate. Next line contains an integer q_1 ( 1 <= q_1 <= n ), denoting the number of demands of the first candidate. Each of the next q_1 lines contains two integers k and x"...

Tutorials

Tutorial (en)

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
54894655 nekko E June 1, 2019, 1:04 a.m. OK Clang++17 Diagnostics TESTS 159 311 224665600 2800
54898918 zhoutb E June 1, 2019, 5:20 a.m. OK Clang++17 Diagnostics TESTS 159 685 161689600 2800
48202261 Gaozijian E Jan. 11, 2019, 6:32 a.m. OK GNU C++11 TESTS 159 31 0 2800
48652876 Connected_failed E Jan. 20, 2019, 11:48 p.m. OK GNU C++11 TESTS 159 31 102400 2800
48494629 wty92911 E Jan. 17, 2019, 12:27 p.m. OK GNU C++11 TESTS 159 31 102400 2800
48484413 Trespassing E Jan. 17, 2019, 7:42 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48117004 luogu_bot2 E Jan. 9, 2019, 1:26 p.m. OK GNU C++11 TESTS 159 31 102400 2800
48112365 lhylhy E Jan. 9, 2019, 10:23 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48110042 romiqi E Jan. 9, 2019, 8:45 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48109706 Hany01 E Jan. 9, 2019, 8:29 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48109503 JORFOT E Jan. 9, 2019, 8:20 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48108269 Timely_Rain E Jan. 9, 2019, 7:20 a.m. OK GNU C++11 TESTS 159 31 102400 2800
48487198 std_algorithm E Jan. 17, 2019, 8:56 a.m. OK GNU C++14 TESTS 159 31 204800 2800
54997943 Narh E June 3, 2019, 1:43 a.m. OK GNU C++14 TESTS 159 31 307200 2800
50683214 Frank_DD E March 2, 2019, 12:29 p.m. OK GNU C++14 TESTS 159 31 307200 2800
50683129 Frank_DD E March 2, 2019, 12:26 p.m. OK GNU C++14 TESTS 159 31 307200 2800
50624558 rushcheyo E March 1, 2019, 4:59 a.m. OK GNU C++14 TESTS 159 31 307200 2800
50300994 encore_ E Feb. 22, 2019, 2:13 a.m. OK GNU C++14 TESTS 159 31 307200 2800
48105739 quarteer E Jan. 9, 2019, 4:43 a.m. OK GNU C++14 TESTS 159 31 307200 2800
46116893 rapel E Nov. 23, 2018, 2:20 p.m. OK GNU C++14 TESTS 159 31 307200 2800
46090478 n_dao107 E Nov. 22, 2018, 7:19 p.m. OK GNU C++14 TESTS 159 31 307200 2800
54567112 Origenes E May 24, 2019, 5:05 p.m. OK GNU C++14 TESTS 159 31 409600 2800
52004126 HareXX E March 30, 2019, 7:35 a.m. OK GNU C++17 TESTS 159 31 204800 2800
46892434 Cothrax E Dec. 11, 2018, 7:07 a.m. OK GNU C++17 TESTS 159 31 204800 2800
51248060 luogu_bot3 E March 13, 2019, 6:43 a.m. OK GNU C++17 TESTS 159 31 307200 2800
51247995 374272 E March 13, 2019, 6:41 a.m. OK GNU C++17 TESTS 159 31 307200 2800
48106522 ShichengXiao E Jan. 9, 2019, 5:44 a.m. OK GNU C++17 TESTS 159 31 409600 2800
46344471 Makcum888 E Nov. 28, 2018, 5:22 p.m. OK GNU C++17 TESTS 159 31 409600 2800
57606623 Mr.Robot_28 E July 23, 2019, 6:13 p.m. OK GNU C++17 TESTS 159 31 716800 2800
46090721 ToTLeS E Nov. 22, 2018, 7:24 p.m. OK GNU C++17 TESTS 159 31 716800 2800
46089783 palayutm2001 E Nov. 22, 2018, 7:08 p.m. OK GNU C++17 TESTS 159 31 716800 2800
48795665 201530800126 E Jan. 23, 2019, 12:34 p.m. OK GNU C++17 TESTS 159 31 819200 2800
48052477 donli E Jan. 7, 2019, 10:04 a.m. OK Java 8 TESTS 159 124 0 2800
46087756 uwi E Nov. 22, 2018, 5:42 p.m. OK Java 8 TESTS 159 124 0 2800
51315275 sweiss E March 14, 2019, 11:16 p.m. OK Java 8 TESTS 159 186 0 2800
46188411 Harpae E Nov. 25, 2018, 1:57 a.m. OK Java 8 TESTS 159 186 0 2800
46095349 Jeel_Vaishnav E Nov. 22, 2018, 11:17 p.m. OK Java 8 TESTS 159 186 0 2800
48517776 beobeo E Jan. 18, 2019, 5:25 a.m. OK Java 8 TESTS 159 187 0 2800
48519013 beobeo E Jan. 18, 2019, 5:55 a.m. OK Java 8 TESTS 159 202 0 2800
46738151 PrakharJain E Dec. 7, 2018, 9:57 p.m. OK Java 8 TESTS 159 217 17100800 2800
68061825 dalt E Jan. 2, 2020, 4:50 a.m. OK Java 8 TESTS 159 1466 46387200 2800
46087601 BaturaDima E Nov. 22, 2018, 5:42 p.m. OK MS C++ TESTS 159 31 409600 2800

remove filters

Back to search problems