Codeforces Round 202 (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
348 Codeforces Round 202 (Div. 1) FINISHED False 7200 351527399 Sept. 27, 2013, 3:30 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2103 ) B Apple Tree PROGRAMMING dfs and similar number theory trees 2400

B"You are given a rooted tree with n vertices. In each leaf vertex there's a single integer -- the number of apples in this vertex. The weight of a subtree is the sum of all numbers in this subtree leaves. For instance, the weight of a subtree that corresponds to some leaf is the number written in the leaf. A tree is balanced if for every vertex v of the tree all its subtrees, corresponding to the children of vertex v, are of equal weight. Count the minimum number of apples that you need to remove from the tree (specifically, from some of its leaves) in order to make the tree balanced. Notice that you can always achieve the goal by just removing all apples. The first line contains integer n (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105), showing the number of vertices in the tree. The next line contains n integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89108), ai is the number of apples in the vertex number i. The number of apples in non-leaf vertices is guaranteed to be zero. Then follow n xe2 x80 x89- xe2 x80 x891 lines, describing the tree edges. Each line contains a pair of integers xi, xe2 x80 x89yi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89xi, xe2 x80 x89yi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, xe2 x80 x89xi xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89yi) -- the vertices connected by an edge. The vertices are indexed from 1 to n. Vertex 1 is the root. Print a single integer -- the minimum number of apples to remove in order to make the tree balanced. Please, do not write the %lld specifier to read or write 64-bit integers in xd0 xa1++. It is preferred to use the sin, cout streams cin, cout or the %I64d specifier."...

Tutorials

Editorial for Codeforces Round #202

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
5820832 Misha100896 B Jan. 27, 2014, 5:09 p.m. OK Delphi TESTS 32 466 30617600 2400
4721985 thaison1496 B Oct. 10, 2013, 3:44 a.m. OK FPC TESTS 32 124 6963200 2400
21569507 s34vv1nd B Oct. 18, 2016, 2:14 p.m. OK FPC TESTS 32 124 9318400 2400
5125768 pal3 B Nov. 16, 2013, 1:41 p.m. OK FPC TESTS 32 124 10137600 2400
4586844 Nik_Storm_2010 B Sept. 27, 2013, 5:07 p.m. OK FPC TESTS 32 498 17305600 2400
10258175 2609108028 B March 13, 2015, 1:27 p.m. OK GNU C++ TESTS 32 60 98508800 2400
12855979 unknown_shadow B Sept. 5, 2015, 4:33 p.m. OK GNU C++ TESTS 32 62 5017600 2400
10429402 Memory120 B March 25, 2015, 6:31 a.m. OK GNU C++ TESTS 32 62 8396800 2400
4917090 sem7oussem B Oct. 27, 2013, 8:49 p.m. OK GNU C++ TESTS 32 62 10752000 2400
40989523 ReaLNero1 B July 30, 2018, 11 p.m. OK GNU C++ TESTS 32 62 12390400 2400
4942420 xyz111 B Oct. 31, 2013, 10:19 a.m. OK GNU C++ TESTS 32 62 12390400 2400
4589468 SillyHook06 B Sept. 27, 2013, 6:06 p.m. OK GNU C++ TESTS 32 62 14028800 2400
4927137 vfleaking B Oct. 29, 2013, 8:11 a.m. OK GNU C++ TESTS 32 62 14336000 2400
4613407 vu_duong B Sept. 30, 2013, 3:27 p.m. OK GNU C++ TESTS 32 62 16179200 2400
4589970 KarlisS B Sept. 27, 2013, 6:18 p.m. OK GNU C++ TESTS 32 92 4812800 2400
4620784 No_stop B Oct. 1, 2013, 2 p.m. OK GNU C++0x TESTS 32 124 11264000 2400
4605367 Mark_Fan B Sept. 29, 2013, 1:14 p.m. OK GNU C++0x TESTS 32 124 16691200 2400
8859168 Swistakk B Nov. 26, 2014, 11:59 a.m. OK GNU C++0x TESTS 32 154 15769600 2400
9338979 nuip B Jan. 1, 2015, 1:18 p.m. OK GNU C++0x TESTS 32 154 16588800 2400
9403230 aliasadiiii B Jan. 11, 2015, 1:21 p.m. OK GNU C++0x TESTS 32 154 18944000 2400
4593768 liympanda B Sept. 28, 2013, 2:53 a.m. OK GNU C++0x TESTS 32 156 11366400 2400
9280250 hogloid B Dec. 27, 2014, 2:53 a.m. OK GNU C++0x TESTS 32 156 12185600 2400
5022401 fairylights B Nov. 7, 2013, 12:01 p.m. OK GNU C++0x TESTS 32 156 12595200 2400
4633513 diego_v1 B Oct. 1, 2013, 7:07 p.m. OK GNU C++0x TESTS 32 156 12595200 2400
9940938 AlexJH B Feb. 20, 2015, 6:20 p.m. OK GNU C++0x TESTS 32 156 12800000 2400
49105090 luogu_bot5 B Jan. 28, 2019, 12:49 p.m. OK GNU C++11 TESTS 32 92 7372800 2400
43729453 luogu_bot5 B Oct. 3, 2018, 1:35 p.m. OK GNU C++11 TESTS 32 92 7372800 2400
63296218 shuashuawan B Oct. 24, 2019, 1:03 p.m. OK GNU C++11 TESTS 32 92 14028800 2400
63296135 bear77 B Oct. 24, 2019, 1:02 p.m. OK GNU C++11 TESTS 32 92 14028800 2400
19975284 UoA_ZQC B Aug. 20, 2016, 5:14 a.m. OK GNU C++11 TESTS 32 124 12902400 2400
64872681 makacha B Nov. 14, 2019, 8:43 a.m. OK GNU C++11 TESTS 32 124 14028800 2400
43109938 MMMyers B Sept. 20, 2018, 11:12 a.m. OK GNU C++11 TESTS 32 154 11161600 2400
43031988 degage B Sept. 18, 2018, 12:06 p.m. OK GNU C++11 TESTS 32 154 12390400 2400
15199391 matthew99 B Jan. 6, 2016, 2:48 a.m. OK GNU C++11 TESTS 32 154 12390400 2400
22613373 I_love_Y_UME B Nov. 30, 2016, 3:34 a.m. OK GNU C++11 TESTS 32 154 13619200 2400
38789480 Hoansn B May 31, 2018, 4:04 a.m. OK GNU C++14 TESTS 32 124 21504000 2400
25893254 BanFcc B March 29, 2017, 10:44 a.m. OK GNU C++14 TESTS 32 154 14336000 2400
28865087 LiChenKoh B July 25, 2017, 4:22 a.m. OK GNU C++14 TESTS 32 156 16486400 2400
47451129 pzdba B Dec. 24, 2018, 9:44 a.m. OK GNU C++14 TESTS 32 186 12185600 2400
28269142 hongjun-7 B July 4, 2017, 3:22 a.m. OK GNU C++14 TESTS 32 186 13312000 2400
50780611 lolicon234 B March 4, 2019, 11:11 a.m. OK GNU C++14 TESTS 32 186 13414400 2400
28272486 hongjun-7 B July 4, 2017, 6:35 a.m. OK GNU C++14 TESTS 32 186 14131200 2400
55333595 pkgunboat B June 9, 2019, 12:25 p.m. OK GNU C++14 TESTS 32 186 14950400 2400
64788918 Qu0cNguyen B Nov. 13, 2019, 10:21 a.m. OK GNU C++14 TESTS 32 186 15052800 2400
32613084 ArlanKuralbayev B Nov. 24, 2017, 7:26 a.m. OK GNU C++14 TESTS 32 186 15360000 2400
51907545 green-coder B March 27, 2019, 4:22 p.m. OK GNU C++17 TESTS 32 186 12390400 2400
64798480 HoaPhat1 B Nov. 13, 2019, 1:44 p.m. OK GNU C++17 TESTS 32 186 14540800 2400
67410718 sdcgvhgj B Dec. 22, 2019, 8:14 a.m. OK GNU C++17 TESTS 32 186 14950400 2400
46632253 noelcowm B Dec. 5, 2018, 4:07 a.m. OK GNU C++17 TESTS 32 186 20172800 2400
64862689 user202729_ B Nov. 14, 2019, 4:15 a.m. OK GNU C++17 TESTS 32 216 14540800 2400
47679558 ONE_DAY_I_WILL B Dec. 29, 2018, 11:21 a.m. OK GNU C++17 TESTS 32 216 16179200 2400
63725937 AmShZ B Oct. 29, 2019, 12:41 p.m. OK GNU C++17 TESTS 32 216 16281600 2400
60134554 Phortox B Sept. 5, 2019, 5:51 p.m. OK GNU C++17 TESTS 32 216 19968000 2400
53820421 nitish235 B May 6, 2019, 12:52 p.m. OK GNU C++17 TESTS 32 216 44236800 2400
55127352 adityaaaaaaaaaaaaaaa B June 5, 2019, 1:29 p.m. OK GNU C++17 TESTS 32 218 9830400 2400
4584739 autotaker B Sept. 27, 2013, 4:46 p.m. OK Haskell TESTS 32 498 32563200 2400
4593947 uwi B Sept. 28, 2013, 3:19 a.m. OK Java 6 TESTS 32 218 0 2400
4584043 llaki B Sept. 27, 2013, 4:40 p.m. OK Java 6 TESTS 32 654 21811200 2400
4589648 mkirsche B Sept. 27, 2013, 6:10 p.m. OK Java 6 TESTS 32 872 58777600 2400
4914371 myIdols-TimAndArul B Oct. 27, 2013, 4:53 p.m. OK Java 6 TESTS 32 889 12902400 2400
4643603 alibaba B Oct. 2, 2013, 4:49 p.m. OK Java 6 TESTS 32 1808 32256000 2400
4643450 alibaba B Oct. 2, 2013, 4:37 p.m. OK Java 6 TESTS 32 1872 29900800 2400
4590543 Egor B Sept. 27, 2013, 6:41 p.m. OK Java 7 TESTS 32 248 14028800 2400
5782043 hama-du B Jan. 24, 2014, 3:45 a.m. OK Java 7 TESTS 32 436 22937600 2400
4579961 ilyakor B Sept. 27, 2013, 4:07 p.m. OK Java 7 TESTS 32 468 32870400 2400
15221926 p1p13 B Jan. 7, 2016, 7:48 a.m. OK Java 7 TESTS 32 528 33075200 2400
4589600 AlexanderBolshakov B Sept. 27, 2013, 6:09 p.m. OK Java 7 TESTS 32 560 26726400 2400
8624711 mashinist B Nov. 9, 2014, 4:42 p.m. OK Java 7 TESTS 32 590 33792000 2400
4607804 himanshu.rustagi B Sept. 29, 2013, 7:56 p.m. OK Java 7 TESTS 32 592 52224000 2400
4579052 mmaxio B Sept. 27, 2013, 4 p.m. OK Java 7 TESTS 32 624 10752000 2400
4706732 tomdmitriev B Oct. 8, 2013, 7:28 a.m. OK Java 7 TESTS 32 624 13414400 2400
4583636 mrNobody B Sept. 27, 2013, 4:36 p.m. OK Java 7 TESTS 32 624 28876800 2400
44707900 ankurdua15 B Oct. 22, 2018, 5:34 p.m. OK Java 8 TESTS 32 374 21606400 2400
60492188 StayAwayFromBitches B Sept. 13, 2019, 2:54 p.m. OK Java 8 TESTS 32 404 16691200 2400
43585161 prashantpiyush B Sept. 29, 2018, 7:32 p.m. OK Java 8 TESTS 32 496 21504000 2400
38804903 amnesiac_dusk B May 31, 2018, 2:24 p.m. OK Java 8 TESTS 32 560 44544000 2400
56004045 AryssonFigueiredo B June 24, 2019, 2:31 p.m. OK Java 8 TESTS 32 592 20582400 2400
38454294 tmwilliamlin168 B May 20, 2018, 9:34 a.m. OK Java 8 TESTS 32 652 35737600 2400
38457462 tmwilliamlin168 B May 20, 2018, 11:24 a.m. OK Java 8 TESTS 32 652 37068800 2400
39049420 dipankar12 B June 8, 2018, 3:04 p.m. OK Java 8 TESTS 32 746 58982400 2400
39076761 Hoda_Hisham B June 9, 2018, 6:59 p.m. OK Java 8 TESTS 32 810 38707200 2400
38454741 tmwilliamlin168 B May 20, 2018, 9:55 a.m. OK Java 8 TESTS 32 810 54067200 2400
4593610 fiver B Sept. 28, 2013, 2:31 a.m. OK MS C# TESTS 32 530 92876800 2400
6368294 azukun B April 15, 2014, 3:28 p.m. OK MS C# TESTS 32 1060 33484800 2400
6368163 azukun B April 15, 2014, 3:15 p.m. OK MS C# TESTS 32 1214 47001600 2400
4606636 BIT_silence B Sept. 29, 2013, 4:49 p.m. OK MS C++ TESTS 32 92 12288000 2400
4579794 cfy B Sept. 27, 2013, 4:05 p.m. OK MS C++ TESTS 32 124 8294400 2400
4584178 Xiaodongdong B Sept. 27, 2013, 4:41 p.m. OK MS C++ TESTS 32 124 9830400 2400
4612713 uncleFun B Sept. 30, 2013, 1:59 p.m. OK MS C++ TESTS 32 124 11059200 2400
4611211 lastseed B Sept. 30, 2013, 9:28 a.m. OK MS C++ TESTS 32 124 17612800 2400
4611191 lastseed B Sept. 30, 2013, 9:25 a.m. OK MS C++ TESTS 32 124 23142400 2400
4611179 lastseed B Sept. 30, 2013, 9:23 a.m. OK MS C++ TESTS 32 124 23244800 2400
4598147 Furko B Sept. 28, 2013, 12:40 p.m. OK MS C++ TESTS 32 124 36864000 2400
4677687 tomas.svab B Oct. 5, 2013, 5:59 a.m. OK MS C++ TESTS 32 156 8806400 2400
4880535 Tom. B Oct. 25, 2013, 2:55 p.m. OK MS C++ TESTS 32 156 9625600 2400
4592279 ray040123 B Sept. 27, 2013, 9:46 p.m. OK Python 2 TESTS 32 1466 21504000 2400
4589234 ray040123 B Sept. 27, 2013, 5:29 p.m. OK Python 2 TESTS 32 1496 21606400 2400
4621110 battuzz94 B Oct. 1, 2013, 2:54 p.m. OK Python 2 TESTS 32 1622 137420800 2400

remove filters

Back to search problems