Codeforces Round 385 (Div. 1)

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
744 Codeforces Round 385 (Div. 1) FINISHED False 7200 255533124 Dec. 17, 2016, 4:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8572 ) A Hongcow Builds A Nation PROGRAMMING dfs and similar graphs 1500

B'Hongcow is ruler of the world. As ruler of the world, he wants to make it easier for people to travel by road within their own countries. The world can be modeled as an undirected graph with n nodes and m edges. k of the nodes are home to the governments of the k countries that make up the world. There is at most one edge connecting any two nodes and no edge connects a node to itself. Furthermore, for any two nodes corresponding to governments, there is no path between those two nodes. Any graph that satisfies all of these conditions is stable. Hongcow wants to add as many edges as possible to the graph while keeping it stable. Determine the maximum number of edges Hongcow can add. The first line of input will contain three integers n, m and k (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891 xe2 x80 x89000, 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100 xe2 x80 x89000, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89k xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) -- the number of vertices and edges in the graph, and the number of vertices that are homes of the government. The next line of input will contain k integers c1, xe2 x80 x89c2, xe2 x80 x89..., xe2 x80 x89ck (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). These integers will be pairwise distinct and denote the nodes that are home to the governments in this world. The following m lines of input will contain two integers ui and vi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ui, xe2 x80 x89vi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). This denotes an undirected edge between nodes ui and vi. It is guaranteed that the graph described by the input is stable. Output a single integer, the maximum number of edges Hongcow can add to the graph while keeping it stable. For the first sample test, the graph looks like this: For the second sample test, the graph looks like this: '...

Tutorials

Codeforces Round #385 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
23054865 Gassa A Dec. 17, 2016, 4:46 p.m. OK D TESTS 61 93 14745600 1500
23058111 s34vv1nd A Dec. 17, 2016, 5:03 p.m. OK FPC TESTS 61 31 2764800 1500
28701690 KagamiharaNadeshiko A July 19, 2017, 4:46 p.m. OK FPC TESTS 61 31 3276800 1500
27790333 luckystars A June 15, 2017, 9:20 a.m. OK FPC TESTS 61 31 12185600 1500
39063267 chaorenhaha A June 9, 2018, 7:51 a.m. OK FPC TESTS 61 46 1638400 1500
23835027 ice_tea A Jan. 15, 2017, 10:17 a.m. OK FPC TESTS 61 46 9318400 1500
25029941 JoeBlow A Feb. 26, 2017, 6:56 a.m. OK GNU C TESTS 61 31 2969600 1500
23079864 jkxjkx1031 A Dec. 18, 2016, 8:27 a.m. OK GNU C TESTS 61 31 4096000 1500
23057683 Tebak_Siapa_Aku A Dec. 17, 2016, 5:01 p.m. OK GNU C TESTS 61 31 6860800 1500
23779864 darshanprabhune3105 A Jan. 13, 2017, 8:38 a.m. OK GNU C TESTS 61 93 1945600 1500
30054422 vjudge3 A Sept. 4, 2017, 1:51 p.m. OK GNU C++ TESTS 61 15 0 1500
30052405 vjudge4 A Sept. 4, 2017, 12:09 p.m. OK GNU C++ TESTS 61 15 0 1500
30051515 vjudge1 A Sept. 4, 2017, 11:14 a.m. OK GNU C++ TESTS 61 15 0 1500
27574707 Herrwerner A June 5, 2017, 3:20 a.m. OK GNU C++ TESTS 61 15 0 1500
27335175 vjudge2 A May 25, 2017, 11:36 a.m. OK GNU C++ TESTS 61 15 0 1500
23075773 UsedToBe A Dec. 18, 2016, 2:30 a.m. OK GNU C++ TESTS 61 15 1536000 1500
24563616 vjudge2 A Feb. 10, 2017, 6:26 a.m. OK GNU C++ TESTS 61 15 1945600 1500
23129972 hzq84621 A Dec. 19, 2016, 5:33 a.m. OK GNU C++ TESTS 61 15 1945600 1500
23203957 RedTea A Dec. 21, 2016, 4 p.m. OK GNU C++ TESTS 61 15 2150400 1500
25060993 Fire_man A Feb. 26, 2017, 5:25 p.m. OK GNU C++ TESTS 61 15 2150400 1500
30796748 alwaysGREEEN A Sept. 28, 2017, 6:47 a.m. OK GNU C11 TESTS 61 31 0 1500
65663629 vjudge1 A Nov. 24, 2019, 1:23 p.m. OK GNU C11 TESTS 61 46 1024000 1500
23074405 partha_mbstu A Dec. 17, 2016, 11:20 p.m. OK GNU C++11 TESTS 61 15 1433600 1500
23056122 liujunhao A Dec. 17, 2016, 4:52 p.m. OK GNU C++11 TESTS 61 15 1945600 1500
23333592 rxdoi A Dec. 26, 2016, 6:04 a.m. OK GNU C++11 TESTS 61 15 2150400 1500
23054231 jcvb A Dec. 17, 2016, 4:43 p.m. OK GNU C++11 TESTS 61 15 2150400 1500
27114195 150137 A May 15, 2017, 1:18 a.m. OK GNU C++11 TESTS 61 15 2150400 1500
23217290 FISHTOBY A Dec. 22, 2016, 4:45 a.m. OK GNU C++11 TESTS 61 15 2252800 1500
23055505 niike0goood A Dec. 17, 2016, 4:48 p.m. OK GNU C++11 TESTS 61 15 3379200 1500
24283595 Ragdoll A Jan. 31, 2017, 7:07 a.m. OK GNU C++11 TESTS 61 15 3481600 1500
35107363 axa A Feb. 9, 2018, 10:52 p.m. OK GNU C++11 TESTS 61 15 3481600 1500
28272471 tzn826531725 A July 4, 2017, 6:34 a.m. OK GNU C++11 TESTS 61 15 3481600 1500
23504427 Al.Cash A Jan. 2, 2017, 6:17 p.m. OK GNU C++14 TESTS 61 15 3481600 1500
23056082 Egor.Lifar A Dec. 17, 2016, 4:52 p.m. OK GNU C++14 TESTS 61 15 6860800 1500
24637464 platypus179 A Feb. 13, 2017, 8:43 p.m. OK GNU C++14 TESTS 61 15 23552000 1500
23193062 lych123 A Dec. 21, 2016, 7:25 a.m. OK GNU C++14 TESTS 61 30 3481600 1500
23061335 hongjun-7 A Dec. 17, 2016, 5:22 p.m. OK GNU C++14 TESTS 61 30 7577600 1500
31213732 pb0207 A Oct. 11, 2017, 10:49 a.m. OK GNU C++14 TESTS 61 31 0 1500
51680202 NiaBie A March 22, 2019, 12:20 p.m. OK GNU C++14 TESTS 61 31 0 1500
23077181 OnionPringles A Dec. 18, 2016, 5:08 a.m. OK GNU C++14 TESTS 61 31 204800 1500
23076156 Wolf_Zheng A Dec. 18, 2016, 3:19 a.m. OK GNU C++14 TESTS 61 31 1126400 1500
30364032 PawKow2K A Sept. 15, 2017, 1:28 p.m. OK GNU C++14 TESTS 61 31 1536000 1500
59538733 VadymKa A Aug. 26, 2019, 5:58 p.m. OK GNU C++17 TESTS 61 31 2969600 1500
57943560 AC_TRIGGER A July 29, 2019, 1:27 p.m. OK GNU C++17 TESTS 61 31 5939200 1500
48463078 HimJ A Jan. 16, 2019, 3:45 p.m. OK GNU C++17 TESTS 61 31 7884800 1500
55955186 egekabas A June 23, 2019, 6:31 a.m. OK GNU C++17 TESTS 61 46 0 1500
68405878 gustavo_farani A Jan. 8, 2020, 2:53 p.m. OK GNU C++17 TESTS 61 46 0 1500
65696857 vjudge2 A Nov. 25, 2019, 8:42 a.m. OK GNU C++17 TESTS 61 46 0 1500
52782518 vjudge1 A April 15, 2019, 3:04 p.m. OK GNU C++17 TESTS 61 46 0 1500
52782474 Thallium_is_Vegetable A April 15, 2019, 3:03 p.m. OK GNU C++17 TESTS 61 46 0 1500
47723161 aboluo2003 A Dec. 30, 2018, 12:38 p.m. OK GNU C++17 TESTS 61 46 0 1500
51288706 swust5120175184 A March 14, 2019, 8:52 a.m. OK GNU C++17 TESTS 61 46 204800 1500
66811781 zhanyi_xiaolu A Dec. 14, 2019, 3:10 a.m. OK Java 11 TESTS 61 374 0 1500
23057097 kenkoooo A Dec. 17, 2016, 4:57 p.m. OK Java 8 TESTS 61 109 20480000 1500
44771725 amolpratap007 A Oct. 24, 2018, 12:40 p.m. OK Java 8 TESTS 61 124 0 1500
29778597 lm010 A Aug. 25, 2017, 12:10 p.m. OK Java 8 TESTS 61 124 0 1500
23138685 hama-du A Dec. 19, 2016, 12:48 p.m. OK Java 8 TESTS 61 124 20172800 1500
23055492 hiro116s A Dec. 17, 2016, 4:48 p.m. OK Java 8 TESTS 61 124 20480000 1500
23057203 ilyakor A Dec. 17, 2016, 4:58 p.m. OK Java 8 TESTS 61 124 20582400 1500
23063021 husanovSh A Dec. 17, 2016, 5:33 p.m. OK Java 8 TESTS 61 124 20582400 1500
23060666 Slamur A Dec. 17, 2016, 5:18 p.m. OK Java 8 TESTS 61 124 20992000 1500
33753543 prabhat236218 A Dec. 29, 2017, 7:32 a.m. OK Java 8 TESTS 61 124 37068800 1500
68721743 ijxjdjd A Jan. 13, 2020, 4:31 p.m. OK Java 8 TESTS 61 139 0 1500
23172910 leonidvasilyev A Dec. 20, 2016, 8:38 a.m. OK JavaScript TESTS 61 156 11571200 1500
23058911 dened A Dec. 17, 2016, 5:08 p.m. OK Kotlin TESTS 61 155 20684800 1500
50699380 cyansea A March 2, 2019, 7:58 p.m. OK Kotlin TESTS 61 187 921600 1500
51865530 nemars A March 26, 2019, 2:59 p.m. OK Mono C# TESTS 61 93 6758400 1500
23056528 riantkb A Dec. 17, 2016, 4:54 p.m. OK Mono C# TESTS 61 109 14438400 1500
28496894 isgulkov A July 13, 2017, 9:03 a.m. OK Mono C# TESTS 61 218 18329600 1500
25222468 Sorryforpartyrocking A March 4, 2017, 5:23 p.m. OK MS C# TESTS 61 124 17510400 1500
23059266 AU.Bahosain A Dec. 17, 2016, 5:10 p.m. OK MS C++ TESTS 61 30 2150400 1500
66489880 vjudge1 A Dec. 8, 2019, 8:08 a.m. OK MS C++ TESTS 61 31 0 1500
66441757 vjudge1 A Dec. 7, 2019, 8:10 a.m. OK MS C++ TESTS 61 31 102400 1500
65904102 vjudge1 A Nov. 28, 2019, 10:06 a.m. OK MS C++ TESTS 61 31 1536000 1500
23615922 vjudge5 A Jan. 7, 2017, 3:25 a.m. OK MS C++ TESTS 61 31 2048000 1500
24802521 vjudge2 A Feb. 19, 2017, 1:06 p.m. OK MS C++ TESTS 61 31 2150400 1500
24690118 vjudge1 A Feb. 15, 2017, 8:47 a.m. OK MS C++ TESTS 61 31 2150400 1500
23054695 natalia A Dec. 17, 2016, 4:45 p.m. OK MS C++ TESTS 61 31 3072000 1500
23055233 Levshunovma A Dec. 17, 2016, 4:47 p.m. OK MS C++ TESTS 61 31 3481600 1500
23057758 Oleg_Smirnov A Dec. 17, 2016, 5:01 p.m. OK MS C++ TESTS 61 31 3584000 1500
65761406 vjudge5 A Nov. 26, 2019, 3:59 p.m. OK MS C++ 2017 TESTS 61 46 307200 1500
52891295 Najmus_Sakib_Rashid A April 17, 2019, 8 a.m. OK MS C++ 2017 TESTS 61 124 102400 1500
69241054 vjudge2 A Jan. 21, 2020, 11:25 a.m. OK MS C++ 2017 TESTS 61 140 1536000 1500
69240864 vjudge1 A Jan. 21, 2020, 11:21 a.m. OK MS C++ 2017 TESTS 61 202 5017600 1500
34876616 Kengreville A Feb. 2, 2018, 9:23 p.m. OK Ocaml TESTS 61 46 7475200 1500
23055804 Giove A Dec. 17, 2016, 4:50 p.m. OK PyPy 2 TESTS 61 217 23654400 1500
23131212 nealzane A Dec. 19, 2016, 6:41 a.m. OK PyPy 2 TESTS 61 389 47001600 1500
40599750 apoorv1999 A July 21, 2018, 7:51 a.m. OK PyPy 2 TESTS 61 467 23552000 1500
46526574 aeternalis1 A Dec. 2, 2018, 10:21 p.m. OK PyPy 2 TESTS 61 655 3276800 1500
47805940 bhargav_0085 A Jan. 1, 2019, 7:12 a.m. OK PyPy 2 TESTS 61 717 23552000 1500
64326661 amitme7836 A Nov. 5, 2019, 5:35 p.m. OK PyPy 2 TESTS 61 732 23552000 1500
59629955 youness.amhaouch A Aug. 28, 2019, 5:39 p.m. OK PyPy 3 TESTS 61 857 10240000 1500
65261971 Mohamed_Ayman A Nov. 17, 2019, 3:21 p.m. OK PyPy 3 TESTS 61 858 13516800 1500
43225031 nowyyz A Sept. 21, 2018, 8:32 p.m. OK PyPy 3 TESTS 61 935 8192000 1500
35152021 laoliumang A Feb. 11, 2018, 11:57 a.m. OK Python 2 TESTS 61 311 8601600 1500
25287432 mundada A March 6, 2017, 9:35 a.m. OK Python 2 TESTS 61 311 8704000 1500
23722409 pypy A Jan. 11, 2017, 4:48 p.m. OK Python 2 TESTS 61 327 7270400 1500
25287621 mundada A March 6, 2017, 9:46 a.m. OK Python 2 TESTS 61 327 8806400 1500
25287215 mundada A March 6, 2017, 9:24 a.m. OK Python 2 TESTS 61 342 8704000 1500
55954854 anshuman16423 A June 23, 2019, 6:16 a.m. OK Python 2 TESTS 61 374 2355200 1500
23077080 2390_ A Dec. 18, 2016, 4:57 a.m. OK Python 2 TESTS 61 374 9113600 1500
30156867 kcherdakov A Sept. 6, 2017, 3:11 p.m. OK Python 2 TESTS 61 389 307200 1500
23117019 cbosch_carlgauss A Dec. 19, 2016, 12:37 a.m. OK Python 2 TESTS 61 389 307200 1500
23075954 Dtl666_CF A Dec. 18, 2016, 2:56 a.m. OK Python 2 TESTS 61 389 307200 1500
40464906 orailly A July 17, 2018, 6:21 a.m. OK Python 3 TESTS 61 249 5939200 1500
40465444 orailly A July 17, 2018, 6:34 a.m. OK Python 3 TESTS 61 296 6041600 1500
23381729 oppa_neckich A Dec. 28, 2016, 4:16 p.m. OK Python 3 TESTS 61 358 7475200 1500
49987869 toysheeyeyraku A Feb. 16, 2019, 11:24 a.m. OK Python 3 TESTS 61 373 8704000 1500
24397359 vjudge2 A Feb. 2, 2017, 10:16 p.m. OK Python 3 TESTS 61 389 14643200 1500
24281484 shangtai A Jan. 31, 2017, 3:55 a.m. OK Python 3 TESTS 61 405 7884800 1500
34660070 pykay A Jan. 29, 2018, 11:56 a.m. OK Python 3 TESTS 61 405 8499200 1500
23165816 Yut0 A Dec. 19, 2016, 9:56 p.m. OK Python 3 TESTS 61 436 7475200 1500
24400418 vjudge3 A Feb. 3, 2017, 3:06 a.m. OK Python 3 TESTS 61 452 4915200 1500
42118755 Mk_Python_v1 A Aug. 26, 2018, 11:21 a.m. OK Python 3 TESTS 61 514 2560000 1500
28354065 package.zaic A July 7, 2017, 5:29 p.m. OK Ruby TESTS 61 483 23347200 1500
26897099 ASoboll A May 6, 2017, 8:59 a.m. OK Scala TESTS 61 358 5222400 1500
23269106 gridman A Dec. 24, 2016, 10:16 a.m. OK Scala TESTS 61 390 24678400 1500
23259479 gridman A Dec. 23, 2016, 9:09 p.m. OK Scala TESTS 61 420 24678400 1500

remove filters

Back to search problems