Codeforces Round 221 (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
375 Codeforces Round 221 (Div. 1) FINISHED False 7200 343929599 Dec. 24, 2013, 2 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 6936 ) D Tree and Queries PROGRAMMING data structures dfs and similar trees 2400

B'You have a rooted tree consisting of n vertices. Each vertex of the tree has some color. We will assume that the tree vertices are numbered by integers from 1 to n. Then we represent the color of vertex v as cv. The tree root is a vertex with number 1. In this problem you need to answer to m queries. Each query is described by two integers vj, xe2 x80 x89kj. The answer to query vj, xe2 x80 x89kj is the number of such colors of vertices x, that the subtree of vertex vj contains at least kj vertices of color x. You can find the definition of a rooted tree by the following link: http://en.wikipedia.org/wiki/Tree_(graph_theory). The first line contains two integers n and m (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105; 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). The next line contains a sequence of integers c1, xe2 x80 x89c2, xe2 x80 x89..., xe2 x80 x89cn (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). The next n xe2 x80 x89- xe2 x80 x891 lines contain the edges of the tree. The i-th line contains the numbers ai, xe2 x80 x89bi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai, xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) -- the vertices connected by an edge of the tree. Next m lines contain the queries. The j-th line contains two integers vj, xe2 x80 x89kj (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89vj xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n; 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89kj xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105). Print m integers -- the answers to the queries in the order the queries appear in the input. A subtree of vertex v in a rooted tree with root r is a set of vertices {u : xe2 x80 x89dist(r, xe2 x80 x89v) xe2 x80 x89+ xe2 x80 x89dist(v, xe2 x80 x89u) xe2 x80 x89= xe2 x80 x89dist(r, xe2 x80 x89u)}. Where dist(x, xe2 x80 x89y) is the length (in edges) of the shortest path between vertices x and y.'...

Tutorials

Codeforces Round #221 Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
41125721 vjudge1 D Aug. 2, 2018, 2:10 p.m. OK Clang++17 Diagnostics TESTS 57 311 80384000 2400
41125577 vjudge5 D Aug. 2, 2018, 2:05 p.m. OK Clang++17 Diagnostics TESTS 57 311 80384000 2400
5594860 ergatis D Dec. 31, 2013, 8:26 p.m. OK D TESTS 57 390 31129600 2400
5594838 ergatis D Dec. 31, 2013, 8:22 p.m. OK D TESTS 57 390 31232000 2400
5594845 ergatis D Dec. 31, 2013, 8:23 p.m. OK D TESTS 57 405 31129600 2400
6248701 zhzq123 D April 3, 2014, 9:06 a.m. OK Delphi TESTS 57 108 16281600 2400
5533536 zhzq123 D Dec. 28, 2013, 3:33 a.m. OK FPC TESTS 57 140 8396800 2400
5533534 zhzq123 D Dec. 28, 2013, 3:32 a.m. OK FPC TESTS 57 140 8806400 2400
5519045 Alex_2oo8 D Dec. 25, 2013, 1:10 p.m. OK FPC TESTS 57 218 7577600 2400
5775656 chffy D Jan. 23, 2014, 8:43 a.m. OK FPC TESTS 57 264 14131200 2400
26490784 zhanggengchen D April 19, 2017, 7:41 a.m. OK FPC TESTS 57 295 18227200 2400
6203212 thaibinh_007 D April 1, 2014, 8:37 a.m. OK FPC TESTS 57 702 12800000 2400
5516493 sy2006 D Dec. 25, 2013, 5:13 a.m. OK GNU C++ TESTS 57 46 12800000 2400
33395647 thchuan D Dec. 19, 2017, 2:32 a.m. OK GNU C++ TESTS 57 62 14643200 2400
25318328 Chenhongkan D March 7, 2017, 10:29 a.m. OK GNU C++ TESTS 57 62 15155200 2400
40989249 ReaLNero1 D July 30, 2018, 10:44 p.m. OK GNU C++ TESTS 57 62 18227200 2400
5516151 dhh1995 D Dec. 25, 2013, 3:56 a.m. OK GNU C++ TESTS 57 62 18432000 2400
28166456 vjudge5 D June 30, 2017, 7:36 a.m. OK GNU C++ TESTS 57 62 21708800 2400
25322546 WAonce D March 7, 2017, 1:57 p.m. OK GNU C++ TESTS 57 77 15667200 2400
28139247 HEXU123 D June 29, 2017, 12:17 p.m. OK GNU C++ TESTS 57 77 61235200 2400
5596083 void_rank D Jan. 1, 2014, 4:21 a.m. OK GNU C++ TESTS 57 78 10137600 2400
10406932 C_SUNSHINE D March 23, 2015, 5:57 a.m. OK GNU C++ TESTS 57 78 11468800 2400
5509786 bakabakashyoshyo D Dec. 24, 2013, 3:46 p.m. OK GNU C++0x TESTS 57 93 63283200 2400
5631143 lost3030 D Jan. 7, 2014, 6:58 a.m. OK GNU C++0x TESTS 57 140 10035200 2400
7403037 soda_beta D Aug. 9, 2014, 8:05 a.m. OK GNU C++0x TESTS 57 140 12185600 2400
7932597 Laakeri D Sept. 24, 2014, 4:13 a.m. OK GNU C++0x TESTS 57 140 16179200 2400
9297155 _iris_ D Dec. 29, 2014, 10:37 a.m. OK GNU C++0x TESTS 57 140 18739200 2400
5508056 Swistakk D Dec. 24, 2013, 3:10 p.m. OK GNU C++0x TESTS 57 140 32358400 2400
7403250 soda_beta D Aug. 9, 2014, 8:23 a.m. OK GNU C++0x TESTS 57 155 15667200 2400
5680340 2011330300713 D Jan. 13, 2014, 5:45 a.m. OK GNU C++0x TESTS 57 156 14131200 2400
5523405 harhrayr D Dec. 26, 2013, 7:54 a.m. OK GNU C++0x TESTS 57 156 14131200 2400
9939435 J-C D Feb. 20, 2015, 4:07 p.m. OK GNU C++0x TESTS 57 171 11980800 2400
58883996 hovny D Aug. 16, 2019, 12:33 a.m. OK GNU C++11 TESTS 57 61 15564800 2400
65585713 Jackpei D Nov. 23, 2019, 12:22 p.m. OK GNU C++11 TESTS 57 62 8089600 2400
57327567 luogu_bot3 D July 19, 2019, 12:47 p.m. OK GNU C++11 TESTS 57 62 8192000 2400
49361112 QuanZhang D Feb. 2, 2019, 12:54 p.m. OK GNU C++11 TESTS 57 62 8192000 2400
45675731 yzh666 D Nov. 13, 2018, 1:01 p.m. OK GNU C++11 TESTS 57 62 8192000 2400
51994493 lykkk D March 29, 2019, 11:44 p.m. OK GNU C++11 TESTS 57 62 10752000 2400
54752939 lykkk D May 28, 2019, 1:42 p.m. OK GNU C++11 TESTS 57 62 10854400 2400
52811078 lykkk D April 16, 2019, 8:44 a.m. OK GNU C++11 TESTS 57 62 10854400 2400
52142743 lykkk D April 1, 2019, 7:43 a.m. OK GNU C++11 TESTS 57 62 10854400 2400
51970317 yk_l D March 29, 2019, 12:06 p.m. OK GNU C++11 TESTS 57 62 10854400 2400
34110771 Marco_L_T D Jan. 12, 2018, 4:31 p.m. OK GNU C++14 TESTS 57 62 30720000 2400
34110770 Marco_L_T D Jan. 12, 2018, 4:31 p.m. OK GNU C++14 TESTS 57 62 30720000 2400
34110901 Marco_L_T D Jan. 12, 2018, 4:37 p.m. OK GNU C++14 TESTS 57 62 31129600 2400
34110779 Marco_L_T D Jan. 12, 2018, 4:31 p.m. OK GNU C++14 TESTS 57 77 30720000 2400
34110731 Marco_L_T D Jan. 12, 2018, 4:28 p.m. OK GNU C++14 TESTS 57 77 30720000 2400
29774846 strawberrry D Aug. 25, 2017, 9:17 a.m. OK GNU C++14 TESTS 57 93 13107200 2400
52146292 vjudge1 D April 1, 2019, 9:30 a.m. OK GNU C++14 TESTS 57 124 15667200 2400
61919534 vjudge1 D Oct. 5, 2019, 1 p.m. OK GNU C++14 TESTS 57 140 12390400 2400
65038865 vjudge3 D Nov. 15, 2019, 12:42 p.m. OK GNU C++14 TESTS 57 140 13619200 2400
51863489 vjudge1 D March 26, 2019, 2:09 p.m. OK GNU C++14 TESTS 57 140 13619200 2400
68708452 luogu_bot1 D Jan. 13, 2020, 12:10 p.m. OK GNU C++17 TESTS 57 77 15360000 2400
51857288 vjudge1 D March 26, 2019, 11:43 a.m. OK GNU C++17 TESTS 57 124 11571200 2400
51857012 vjudge4 D March 26, 2019, 11:36 a.m. OK GNU C++17 TESTS 57 124 15667200 2400
52221891 vjudge1 D April 2, 2019, 7:06 a.m. OK GNU C++17 TESTS 57 139 15667200 2400
59704842 vjudge4 D Aug. 30, 2019, 12:14 p.m. OK GNU C++17 TESTS 57 140 10035200 2400
54494424 vjudge3 D May 22, 2019, 5 p.m. OK GNU C++17 TESTS 57 140 10956800 2400
51826887 vjudge4 D March 25, 2019, 2:21 p.m. OK GNU C++17 TESTS 57 140 13619200 2400
51826793 vjudge3 D March 25, 2019, 2:18 p.m. OK GNU C++17 TESTS 57 140 13619200 2400
51791562 vjudge2 D March 24, 2019, 1:02 p.m. OK GNU C++17 TESTS 57 140 15257600 2400
44751539 Rtn_e D Oct. 23, 2018, 8:12 p.m. OK GNU C++17 TESTS 57 155 12800000 2400
5519978 kelvinlau D Dec. 25, 2013, 3:42 p.m. OK Go TESTS 57 920 32256000 2400
5519944 kelvinlau D Dec. 25, 2013, 3:37 p.m. OK Go TESTS 57 936 30822400 2400
5519835 kelvinlau D Dec. 25, 2013, 3:21 p.m. OK Go TESTS 57 936 32153600 2400
5521000 kelvinlau D Dec. 25, 2013, 7:03 p.m. OK Go TESTS 57 936 39628800 2400
5519910 kelvinlau D Dec. 25, 2013, 3:32 p.m. OK Go TESTS 57 951 32153600 2400
5520514 kelvinlau D Dec. 25, 2013, 5:17 p.m. OK Go TESTS 57 967 41881600 2400
5519994 kelvinlau D Dec. 25, 2013, 3:44 p.m. OK Go TESTS 57 998 32256000 2400
5520503 kelvinlau D Dec. 25, 2013, 5:15 p.m. OK Go TESTS 57 998 41881600 2400
5504647 uwi D Dec. 24, 2013, 2:23 p.m. OK Java 7 TESTS 57 140 0 2400
5517571 uwi D Dec. 25, 2013, 8:58 a.m. OK Java 7 TESTS 57 171 9420800 2400
6619190 deletelazy D May 15, 2014, 7:47 a.m. OK Java 7 TESTS 57 296 6451200 2400
5612979 alexey.kasatkin D Jan. 3, 2014, 10:52 p.m. OK Java 7 TESTS 57 296 81510400 2400
5613280 alexey.kasatkin D Jan. 4, 2014, 12:52 a.m. OK Java 7 TESTS 57 327 96358400 2400
5508058 Egor D Dec. 24, 2013, 3:10 p.m. OK Java 7 TESTS 57 343 51097600 2400
5660052 xenoslash D Jan. 11, 2014, 2:36 p.m. OK Java 7 TESTS 57 421 33894400 2400
5522108 hama-du D Dec. 26, 2013, 1:53 a.m. OK Java 7 TESTS 57 421 85606400 2400
5513426 fetetriste D Dec. 24, 2013, 7:45 p.m. OK Java 7 TESTS 57 436 113868800 2400
5512577 qwerty787788 D Dec. 24, 2013, 5:36 p.m. OK Java 7 TESTS 57 561 142540800 2400
22801263 uwi D Dec. 8, 2016, 4:06 a.m. OK Java 8 TESTS 57 311 34611200 2400
27756889 Maulik_Patel D June 13, 2017, 2 p.m. OK Java 8 TESTS 57 342 26419200 2400
22801162 uwi D Dec. 8, 2016, 3:56 a.m. OK Java 8 TESTS 57 358 31027200 2400
42222178 aminul D Aug. 28, 2018, 9:50 p.m. OK Java 8 TESTS 57 374 24473600 2400
63037695 vjudge1 D Oct. 20, 2019, 9:48 p.m. OK Java 8 TESTS 57 374 29184000 2400
36868938 Maulik_Patel D April 2, 2018, 5:37 a.m. OK Java 8 TESTS 57 390 51609600 2400
23177515 U_Square D Dec. 20, 2016, 1:19 p.m. OK Java 8 TESTS 57 404 49459200 2400
59968784 NatInTheHat D Sept. 3, 2019, 10:45 p.m. OK Java 8 TESTS 57 405 26931200 2400
43736079 aman28rwt D Oct. 3, 2018, 4:03 p.m. OK Java 8 TESTS 57 420 6144000 2400
25242280 RP_9 D March 5, 2017, 11:11 a.m. OK Java 8 TESTS 57 420 48742400 2400
38012055 wleung_bvg D May 8, 2018, 5:28 a.m. OK Mono C# TESTS 57 654 236441600 2400
15600109 og.kostya D Jan. 26, 2016, 7:07 p.m. OK MS C# TESTS 57 482 44441600 2400
10911968 azukun D April 27, 2015, 5:42 p.m. OK MS C# TESTS 57 576 69324800 2400
51856352 vjudge3 D March 26, 2019, 11:18 a.m. OK MS C++ TESTS 57 108 9216000 2400
10861100 Alex7 D April 25, 2015, 3:35 p.m. OK MS C++ TESTS 57 155 12492800 2400
15752702 TillEnd D Feb. 2, 2016, 3:04 p.m. OK MS C++ TESTS 57 156 10444800 2400
18781733 Filyan D June 29, 2016, 10:52 a.m. OK MS C++ TESTS 57 156 10854400 2400
37344338 LLI_E_P_JI_O_K D April 15, 2018, 5:38 a.m. OK MS C++ TESTS 57 156 24985600 2400
18171431 canxue123 D May 31, 2016, 4:13 p.m. OK MS C++ TESTS 57 171 12492800 2400
11086579 polequoll D May 13, 2015, 8:43 a.m. OK MS C++ TESTS 57 171 17612800 2400
5818303 AleksanderBalobanov D Jan. 27, 2014, 9:52 a.m. OK MS C++ TESTS 57 171 18022400 2400
48990067 vjudge2 D Jan. 26, 2019, 2 p.m. OK MS C++ TESTS 57 186 10035200 2400
54518121 vjudge3 D May 23, 2019, 11 a.m. OK MS C++ TESTS 57 186 10444800 2400
62206749 vjudge2 D Oct. 9, 2019, 1:26 p.m. OK MS C++ 2017 TESTS 57 202 11673600 2400
70005193 vjudge3 D Feb. 2, 2020, 4:26 a.m. OK MS C++ 2017 TESTS 57 202 16076800 2400
56776666 C20191522 D July 10, 2019, 3:05 a.m. OK MS C++ 2017 TESTS 57 218 10444800 2400
63102161 vjudge4 D Oct. 22, 2019, 1:38 a.m. OK MS C++ 2017 TESTS 57 296 23654400 2400

remove filters

Back to search problems