Codeforces Beta Round 17

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
17 Codeforces Beta Round 17 FINISHED False 7200 460911585 June 10, 2010, 3 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 5033 ) B Hierarchy PROGRAMMING dfs and similar ds greedy shortest paths 1600

B"Nick's company employed n people. Now Nick needs to build a tree hierarchy of xc2 xabsupervisor-surbodinate xc2 xbb relations in the company (this is to say that each employee, except one, has exactly one supervisor). There are m applications written in the following form: xc2 xabemployee ai is ready to become a supervisor of employee bi at extra cost ci xc2 xbb. The qualification qj of each employee is known, and for each application the following is true: qai xe2 x80 x89> xe2 x80 x89qbi. Would you help Nick calculate the minimum cost of such a hierarchy, or find out that it is impossible to build it. The first input line contains integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891000) -- amount of employees in the company. The following line contains n space-separated numbers qj (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89qj xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106) -- the employees' qualifications. The following line contains number m (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8910000) -- amount of received applications. The following m lines contain the applications themselves, each of them in the form of three space-separated numbers: ai, bi and ci (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106). Different applications can be similar, i.e. they can come from one and the same employee who offered to become a supervisor of the same person but at a different cost. For each application qai xe2 x80 x89> xe2 x80 x89qbi. Output the only line -- the minimum cost of building such a hierarchy, or -1 if it is impossible to build it. In the first sample one of the possible ways for building a hierarchy is to take applications with indexes 1, 2 and 4, which give 11 as the minimum total cost. In the second sample it is impossible to build the required hierarchy, so the answer is -1."...

Tutorials

Codeforces Beta Round #17 Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
2863995 Misha100896 B Jan. 1, 2013, 3:01 p.m. OK Delphi TESTS 36 15 4096000 1600
352623 alexander-nsk94 B March 23, 2011, 4:53 p.m. OK Delphi TESTS 36 30 819200 1600
75686 PanZverski B June 10, 2010, 3:28 p.m. OK Delphi TESTS 36 30 819200 1600
79189 sankear B June 29, 2010, 9:34 p.m. OK Delphi TESTS 36 30 921600 1600
75489 iroro B June 10, 2010, 3:21 p.m. OK Delphi TESTS 36 30 921600 1600
75665 GlebsHP B June 10, 2010, 3:28 p.m. OK Delphi TESTS 36 30 1024000 1600
75258 CherryTree B June 10, 2010, 3:13 p.m. OK Delphi TESTS 36 30 3174400 1600
78815 pva701 B June 13, 2010, 5:37 p.m. OK Delphi TESTS 36 30 4915200 1600
76184 Babanin_Ivan B June 10, 2010, 3:54 p.m. OK Delphi TESTS 36 30 5734400 1600
76441 Serega B June 10, 2010, 4:06 p.m. OK Delphi TESTS 36 30 8908800 1600
16528049 prosmgeorg B March 5, 2016, 7:10 a.m. OK FPC TESTS 36 30 0 1600
1567371 tennisru B April 17, 2012, 3:21 p.m. OK FPC TESTS 36 30 1024000 1600
338698 crfyth B March 16, 2011, 6:40 p.m. OK FPC TESTS 36 30 1024000 1600
332324 Emelyanov B March 13, 2011, 1:02 p.m. OK FPC TESTS 36 30 1024000 1600
322720 vladislav B March 6, 2011, 4:51 p.m. OK FPC TESTS 36 30 1024000 1600
79232 vilcheuski B July 17, 2010, 5:28 p.m. OK FPC TESTS 36 30 1024000 1600
75647 chavit B June 10, 2010, 3:27 p.m. OK FPC TESTS 36 30 1024000 1600
75479 sillyboy B June 10, 2010, 3:20 p.m. OK FPC TESTS 36 30 1024000 1600
1845164 hnivhnivt8695 B June 30, 2012, 3:01 a.m. OK FPC TESTS 36 30 1228800 1600
1762025 scorpion B June 3, 2012, 7:43 p.m. OK FPC TESTS 36 30 1228800 1600
22121859 salah_bouziane B Nov. 8, 2016, 11:51 p.m. OK GNU C TESTS 36 30 0 1600
7993409 srdr38 B Sept. 28, 2014, 11:17 a.m. OK GNU C TESTS 36 30 0 1600
76791 Sunshan B June 10, 2010, 4:24 p.m. OK GNU C TESTS 36 30 1331200 1600
75170 LayCurse B June 10, 2010, 3:11 p.m. OK GNU C TESTS 36 30 1331200 1600
23169086 dby B Dec. 20, 2016, 4:16 a.m. OK GNU C TESTS 36 30 1843200 1600
77176 china.zhangchenzi B June 10, 2010, 4:41 p.m. OK GNU C TESTS 36 30 11468800 1600
18545382 rainboy B June 17, 2016, 2:58 p.m. OK GNU C TESTS 36 30 40448000 1600
78791 choice B June 13, 2010, 3:42 p.m. OK GNU C TESTS 36 50 1331200 1600
77292 o948 B June 10, 2010, 4:46 p.m. OK GNU C TESTS 36 50 1331200 1600
665907 kawatea B Sept. 3, 2011, 5:14 p.m. OK GNU C TESTS 36 50 1536000 1600
4136390 sd0061 B July 22, 2013, 3:11 p.m. OK GNU C++ TESTS 36 15 0 1600
4135745 vjudge5 B July 22, 2013, 1:09 p.m. OK GNU C++ TESTS 36 15 0 1600
4135161 vjudge5 B July 22, 2013, 11:52 a.m. OK GNU C++ TESTS 36 15 0 1600
3881026 Predimonio B June 13, 2013, 8:28 p.m. OK GNU C++ TESTS 36 15 0 1600
3851887 timdeng2324 B June 9, 2013, 7:39 p.m. OK GNU C++ TESTS 36 15 0 1600
3793564 delta_4d B May 30, 2013, 8:24 a.m. OK GNU C++ TESTS 36 15 0 1600
3611376 akb B April 23, 2013, 1:14 p.m. OK GNU C++ TESTS 36 15 0 1600
3383900 coderz B March 23, 2013, 6:31 a.m. OK GNU C++ TESTS 36 15 0 1600
3312633 aiiYuu B March 13, 2013, 11:37 p.m. OK GNU C++ TESTS 36 15 0 1600
3271493 vjudge4 B March 10, 2013, 1:53 a.m. OK GNU C++ TESTS 36 15 0 1600
3228698 Doxer B March 2, 2013, 7:36 a.m. OK GNU C++0x TESTS 36 15 0 1600
3017294 lemur B Jan. 27, 2013, 6:09 p.m. OK GNU C++0x TESTS 36 15 0 1600
3222389 Poseidon B March 1, 2013, 4:50 a.m. OK GNU C++0x TESTS 36 15 409600 1600
476091 Archon.JK B June 5, 2011, 2:26 p.m. OK GNU C++0x TESTS 36 30 1331200 1600
1628357 jiangzhijie B April 26, 2012, 1:37 a.m. OK GNU C++0x TESTS 36 50 1536000 1600
2049861 killerdjo B Aug. 26, 2012, 9:23 a.m. OK GNU C++0x TESTS 36 50 1740800 1600
7818082 HellKitsune B Sept. 17, 2014, 1:07 p.m. OK GNU C++0x TESTS 36 60 0 1600
7949789 patrick.sava B Sept. 25, 2014, 5:19 p.m. OK GNU C++0x TESTS 36 60 102400 1600
9388530 andreyrmg B Jan. 8, 2015, 6:50 p.m. OK GNU C++0x TESTS 36 60 204800 1600
9154433 JafarBM B Dec. 16, 2014, 5:41 p.m. OK GNU C++0x TESTS 36 60 307200 1600
32533771 a1s3a B Nov. 21, 2017, 6:54 p.m. OK GNU C++11 TESTS 36 30 0 1600
27435196 quailty B May 29, 2017, 7:37 p.m. OK GNU C++11 TESTS 36 30 0 1600
22650754 avenger07 B Dec. 2, 2016, 2:39 a.m. OK GNU C++11 TESTS 36 30 0 1600
20397907 xiumu B Sept. 5, 2016, 10:58 a.m. OK GNU C++11 TESTS 36 30 0 1600
14749500 sggreat B Dec. 10, 2015, 7:22 p.m. OK GNU C++11 TESTS 36 30 0 1600
15148493 aka.Sohieb B Jan. 1, 2016, 1:35 p.m. OK GNU C++11 TESTS 36 30 102400 1600
15148433 aka.Sohieb B Jan. 1, 2016, 1:29 p.m. OK GNU C++11 TESTS 36 30 102400 1600
15140069 IamGannaWinACM B Dec. 31, 2015, 6:09 p.m. OK GNU C++11 TESTS 36 30 102400 1600
14102816 Matrix.code B Nov. 6, 2015, 9:56 a.m. OK GNU C++11 TESTS 36 30 102400 1600
14098132 munaiyi B Nov. 6, 2015, 1:37 a.m. OK GNU C++11 TESTS 36 30 102400 1600
31913476 Cristiano_Ronaldo B Oct. 31, 2017, 7:46 a.m. OK GNU C++14 TESTS 36 30 0 1600
30178792 Pi_Tigrannik B Sept. 7, 2017, 10:48 a.m. OK GNU C++14 TESTS 36 30 0 1600
30178515 Pi_Tigrannik B Sept. 7, 2017, 10:33 a.m. OK GNU C++14 TESTS 36 30 0 1600
30002072 saransh.agarwal B Sept. 2, 2017, 4:37 a.m. OK GNU C++14 TESTS 36 30 0 1600
22926398 Qoogle B Dec. 13, 2016, 12:43 p.m. OK GNU C++14 TESTS 36 30 0 1600
20975885 omar42 B Sept. 28, 2016, 5:51 p.m. OK GNU C++14 TESTS 36 30 0 1600
22029748 ista2000 B Nov. 4, 2016, 8:24 a.m. OK GNU C++14 TESTS 36 30 102400 1600
31193571 -Morass- B Oct. 10, 2017, 3:17 p.m. OK GNU C++14 TESTS 36 30 204800 1600
30867250 chogba B Sept. 30, 2017, 1:05 p.m. OK GNU C++14 TESTS 36 30 307200 1600
27474646 demonsbane B May 31, 2017, 9:46 p.m. OK GNU C++14 TESTS 36 30 307200 1600
40927182 000tension B July 29, 2018, 7:26 p.m. OK GNU C++17 TESTS 36 30 0 1600
68947083 Takagi B Jan. 16, 2020, 4:34 p.m. OK GNU C++17 TESTS 36 60 0 1600
56720330 Quinas B July 8, 2019, 4:30 p.m. OK GNU C++17 TESTS 36 60 204800 1600
66487406 Danini B Dec. 8, 2019, 7:04 a.m. OK GNU C++17 TESTS 36 60 409600 1600
67865713 MostafaRastegar B Dec. 29, 2019, 9:37 a.m. OK GNU C++17 TESTS 36 60 614400 1600
55192930 veerappan B June 6, 2019, 7:14 a.m. OK GNU C++17 TESTS 36 60 819200 1600
47701648 Shayan.P B Dec. 29, 2018, 5:07 p.m. OK GNU C++17 TESTS 36 60 1228800 1600
69059103 _ultra_instinct_ B Jan. 18, 2020, 3:44 p.m. OK GNU C++17 TESTS 36 62 0 1600
68129699 harshchhatbar B Jan. 3, 2020, 4:32 p.m. OK GNU C++17 TESTS 36 62 0 1600
66386924 KingInTheNorth_ B Dec. 6, 2019, 7:50 a.m. OK GNU C++17 TESTS 36 62 0 1600
10227095 Eeyore B March 10, 2015, 1:49 p.m. OK Go TESTS 36 62 0 1600
394297 bjin B April 16, 2011, 2:35 p.m. OK Haskell TESTS 36 190 7372800 1600
76714 die.saito B June 10, 2010, 4:20 p.m. OK Haskell TESTS 36 230 6246400 1600
76735 segoon B June 10, 2010, 4:21 p.m. OK Haskell TESTS 36 250 7372800 1600
75737 SergeyLazarev B June 10, 2010, 3:30 p.m. OK Java 6 TESTS 36 80 42188800 1600
78265 rexim B June 11, 2010, 12:45 a.m. OK Java 6 TESTS 36 80 42393600 1600
78222 mipt.vi002 B June 10, 2010, 10:02 p.m. OK Java 6 TESTS 36 80 42393600 1600
75992 yaro B June 10, 2010, 3:41 p.m. OK Java 6 TESTS 36 80 42393600 1600
75633 mastersobg B June 10, 2010, 3:26 p.m. OK Java 6 TESTS 36 80 42393600 1600
75158 xiaowuc1 B June 10, 2010, 3:10 p.m. OK Java 6 TESTS 36 80 42393600 1600
75201 MaxBuzz B June 10, 2010, 3:11 p.m. OK Java 6 TESTS 36 90 42188800 1600
76427 fetetriste B June 10, 2010, 4:05 p.m. OK Java 6 TESTS 36 90 42393600 1600
77876 mastersobg B June 10, 2010, 5:12 p.m. OK Java 6 TESTS 36 90 42393600 1600
77928 mastersobg B June 10, 2010, 5:21 p.m. OK Java 6 TESTS 36 90 42393600 1600
2359160 Bambam B Oct. 14, 2012, 4:53 p.m. OK Java 7 TESTS 36 109 0 1600
5196071 veeann B Nov. 23, 2013, 4:51 a.m. OK Java 7 TESTS 36 124 0 1600
5195478 kylesky B Nov. 23, 2013, 2:10 a.m. OK Java 7 TESTS 36 124 0 1600
5527052 GhpS B Dec. 26, 2013, 8:31 p.m. OK Java 7 TESTS 36 156 0 1600
10455308 suin3g B March 26, 2015, 8:43 a.m. OK Java 7 TESTS 36 156 0 1600
10453408 corrosive_e B March 26, 2015, 1:47 a.m. OK Java 7 TESTS 36 156 0 1600
10450413 dspstanky B March 25, 2015, 4:40 p.m. OK Java 7 TESTS 36 156 0 1600
5196303 yona B Nov. 23, 2013, 5:44 a.m. OK Java 7 TESTS 36 156 0 1600
5196143 hadrianang B Nov. 23, 2013, 5:11 a.m. OK Java 7 TESTS 36 156 0 1600
5195744 ginree B Nov. 23, 2013, 3:19 a.m. OK Java 7 TESTS 36 156 204800 1600
62799772 sonusingh.nitaa B Oct. 17, 2019, 2:17 p.m. OK Java 8 TESTS 36 186 3276800 1600
58928793 Oom B Aug. 16, 2019, 9:41 p.m. OK Java 8 TESTS 36 186 3379200 1600
57560593 o.radwan B July 23, 2019, 12:12 a.m. OK Java 8 TESTS 36 186 3379200 1600
47348445 ShowStopper728 B Dec. 21, 2018, 10:31 p.m. OK Java 8 TESTS 36 186 3379200 1600
20289618 stacy992 B Aug. 30, 2016, 8:34 p.m. OK Java 8 TESTS 36 186 3584000 1600
62069513 atrperrocumbiacajeteala B Oct. 7, 2019, 4:16 p.m. OK Java 8 TESTS 36 186 3686400 1600
48035449 kunal725725 B Jan. 6, 2019, 3:11 p.m. OK Java 8 TESTS 36 216 3481600 1600
65022939 anirudhrahul B Nov. 15, 2019, 6:13 a.m. OK Java 8 TESTS 36 216 3481600 1600
50203903 vjudge5 B Feb. 19, 2019, 6:20 p.m. OK Java 8 TESTS 36 216 3481600 1600
11380526 tomdmitriev B June 1, 2015, 3:08 p.m. OK Java 8 TESTS 36 218 0 1600
15920801 agat00 B Feb. 9, 2016, 7:50 p.m. OK JavaScript TESTS 36 122 3174400 1600
76467 Tactic B June 10, 2010, 4:07 p.m. OK Mono C# TESTS 36 130 6144000 1600
75670 maslowmw B June 10, 2010, 3:28 p.m. OK Mono C# TESTS 36 140 6144000 1600
78552 tanzaku B June 11, 2010, 1:41 p.m. OK Mono C# TESTS 36 140 17203200 1600
76334 rito B June 10, 2010, 4 p.m. OK Mono C# TESTS 36 160 6246400 1600
75778 Hadi_Asiaie B June 10, 2010, 3:32 p.m. OK Mono C# TESTS 36 160 16998400 1600
25131288 og.kostya B March 1, 2017, 5:41 p.m. OK MS C# TESTS 36 92 9113600 1600
24822542 Mem B Feb. 20, 2017, 12:52 p.m. OK MS C# TESTS 36 154 14131200 1600
18122106 azukun B May 27, 2016, 6 p.m. OK MS C# TESTS 36 186 14233600 1600
3616244 tomas.svab B April 24, 2013, 11:49 a.m. OK MS C++ TESTS 36 15 204800 1600
4059338 problem-solved B July 13, 2013, 11:23 a.m. OK MS C++ TESTS 36 15 2764800 1600
7361583 TonySnark B Aug. 6, 2014, 2:24 p.m. OK MS C++ TESTS 36 30 0 1600
5835046 izaidi B Jan. 29, 2014, 10:02 p.m. OK MS C++ TESTS 36 30 0 1600
4549703 Kazim B Sept. 24, 2013, 3:40 p.m. OK MS C++ TESTS 36 30 0 1600
4835256 Mosyagin B Oct. 20, 2013, 8:10 p.m. OK MS C++ TESTS 36 30 102400 1600
6301586 qwg B April 8, 2014, 4:45 p.m. OK MS C++ TESTS 36 30 204800 1600
11544875 danilka.pro B June 12, 2015, 2:33 p.m. OK MS C++ TESTS 36 30 512000 1600
79509 t__nt B Nov. 16, 2010, 3:12 a.m. OK MS C++ TESTS 36 30 1331200 1600
79536 _jte_ B Dec. 7, 2010, 10:50 p.m. OK MS C++ TESTS 36 30 1331200 1600
49208118 dharaniv1999 B Jan. 30, 2019, 2:35 p.m. OK MS C++ 2017 TESTS 36 62 0 1600
66398432 vjudge3 B Dec. 6, 2019, 11:34 a.m. OK MS C++ 2017 TESTS 36 92 307200 1600
63630487 Saber4096 B Oct. 28, 2019, 6:09 a.m. OK MS C++ 2017 TESTS 36 92 409600 1600
7678458 ShingRay B Sept. 4, 2014, 2:37 a.m. OK Ocaml TESTS 36 62 204800 1600
44251632 pavankatta B Oct. 13, 2018, 10:45 a.m. OK PyPy 2 TESTS 36 466 5529600 1600
46659195 tarikisildar B Dec. 5, 2018, 6:08 p.m. OK PyPy 3 TESTS 36 528 3891200 1600
63756472 boboquack B Oct. 29, 2019, 11:53 p.m. OK PyPy 3 TESTS 36 530 4608000 1600
46677398 FadeoN B Dec. 6, 2018, 10:31 a.m. OK PyPy 3 TESTS 36 560 3584000 1600
267081 ftiasch B Jan. 29, 2011, 5:17 a.m. OK Python 2 TESTS 36 90 2764800 1600
483229 july B June 8, 2011, 3:17 p.m. OK Python 2 TESTS 36 90 2867200 1600
360834 AntonDubovik B March 28, 2011, 11:21 a.m. OK Python 2 TESTS 36 90 2867200 1600
922319 nns2009 B June 10, 2010, 3:22 p.m. OK Python 2 TESTS 36 90 2969600 1600
78535 jaindsonvs B June 11, 2010, 12:53 p.m. OK Python 2 TESTS 36 90 2969600 1600
266686 Aleksey B Jan. 28, 2011, 12:08 p.m. OK Python 2 TESTS 36 90 3584000 1600
2791103 ghafi007 B Dec. 18, 2012, 2:20 p.m. OK Python 2 TESTS 36 93 0 1600
78610 xydinesh B June 11, 2010, 7:18 p.m. OK Python 2 TESTS 36 110 2969600 1600
78609 xydinesh B June 11, 2010, 7:09 p.m. OK Python 2 TESTS 36 110 2969600 1600
76105 jaindsonvs B June 10, 2010, 3:47 p.m. OK Python 2 TESTS 36 110 3584000 1600
11363825 darrensun B May 31, 2015, 7:26 a.m. OK Python 3 TESTS 36 154 0 1600
5360379 yugle7 B Dec. 6, 2013, 12:42 p.m. OK Python 3 TESTS 36 156 102400 1600
11363868 darrensun B May 31, 2015, 7:32 a.m. OK Python 3 TESTS 36 186 0 1600
7452825 sjhshuan_NOW B Aug. 15, 2014, 11:38 a.m. OK Python 3 TESTS 36 186 0 1600
46677955 HaaaToka B Dec. 6, 2018, 10:48 a.m. OK Python 3 TESTS 36 248 0 1600
68321051 M0M B Jan. 6, 2020, 2:58 p.m. OK Python 3 TESTS 36 248 307200 1600
55736924 tushusavaliya B June 19, 2019, 4:51 a.m. OK Python 3 TESTS 36 278 0 1600
55736771 tusharsavaliya B June 19, 2019, 4:43 a.m. OK Python 3 TESTS 36 278 0 1600
29629575 Qumeric B Aug. 20, 2017, 8:06 p.m. OK Python 3 TESTS 36 280 0 1600
42121927 Mk_Python_v1 B Aug. 26, 2018, 12:56 p.m. OK Python 3 TESTS 36 280 102400 1600
78031 yoshibo- B June 10, 2010, 5:55 p.m. OK Ruby TESTS 36 160 4096000 1600
56014652 sorry_im_smurfing B June 24, 2019, 8:14 p.m. OK Ruby TESTS 36 186 0 1600
15914683 not_bot_but_POT B Feb. 9, 2016, 1:51 p.m. OK Ruby TESTS 36 186 204800 1600
35843059 ______u______ B March 2, 2018, 3:05 p.m. OK Ruby TESTS 36 186 6451200 1600
35843027 ______n______ B March 2, 2018, 3:05 p.m. OK Ruby TESTS 36 186 6451200 1600
35842795 _____i_____ B March 2, 2018, 3 p.m. OK Ruby TESTS 36 186 6451200 1600
35842594 _____k_____ B March 2, 2018, 2:55 p.m. OK Ruby TESTS 36 186 6451200 1600
35837639 ______h______ B March 2, 2018, 1:16 p.m. OK Ruby TESTS 36 186 6451200 1600
35837638 ______k______ B March 2, 2018, 1:16 p.m. OK Ruby TESTS 36 186 6451200 1600
35837347 ______i______ B March 2, 2018, 1:10 p.m. OK Ruby TESTS 36 186 6451200 1600

remove filters

Back to search problems