Codeforces Round 199 (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
342 Codeforces Round 199 (Div. 2) FINISHED False 7200 353282399 Sept. 7, 2013, 8 a.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8568 ) E Xenia and Tree PROGRAMMING data structures divide and conquer trees 2200

B'Xenia the programmer has a tree consisting of n nodes. We will consider the tree nodes indexed from 1 to n. We will also consider the first node to be initially painted red, and the other nodes -- to be painted blue. The distance between two tree nodes v and u is the number of edges in the shortest path between v and u. Xenia needs to learn how to quickly execute queries of two types: Your task is to write a program which will execute the described queries. 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, xe2 x80 x891 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- the number of nodes in the tree and the number of queries. Next n xe2 x80 x89- xe2 x80 x891 lines contain the tree edges, the i-th line contains a pair of integers 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, xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89bi) -- an edge of the tree. Next m lines contain queries. Each query is specified as a pair of integers ti, xe2 x80 x89vi (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ti xe2 x80 x89 xe2 x89 xa4 xe2 x80 x892, xe2 x80 x891 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89vi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n). If ti xe2 x80 x89= xe2 x80 x891, then as a reply to the query we need to paint a blue node vi in red. If ti xe2 x80 x89= xe2 x80 x892, then we should reply to the query by printing the shortest distance from some red node to node vi. It is guaranteed that the given graph is a tree and that all queries are correct. For each second type query print the reply in a single line.'...

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
18916911 rais.fathin38 E July 6, 2016, 10:50 a.m. OK D TESTS 23 374 28262400 2200
4481205 agh E Sept. 16, 2013, 3:45 a.m. OK Delphi TESTS 23 374 31027200 2200
37284777 NikNag E April 13, 2018, 12:56 p.m. OK FPC TESTS 23 389 31027200 2200
15613913 Valerich E Jan. 27, 2016, 3:02 p.m. OK FPC TESTS 23 467 126361600 2200
15613893 Valerich E Jan. 27, 2016, 3:01 p.m. OK FPC TESTS 23 607 126361600 2200
25067712 heklo E Feb. 27, 2017, 2:31 a.m. OK FPC TESTS 23 608 16588800 2200
21339879 heklo E Oct. 10, 2016, 2:22 p.m. OK FPC TESTS 23 733 16281600 2200
25078184 s34vv1nd E Feb. 27, 2017, 1:16 p.m. OK FPC TESTS 23 779 24576000 2200
25079091 NormalCoder E Feb. 27, 2017, 1:56 p.m. OK FPC TESTS 23 1153 24268800 2200
15613905 Valerich E Jan. 27, 2016, 3:02 p.m. OK FPC TESTS 23 1388 126361600 2200
5915342 Reventon1 E Feb. 7, 2014, 8:41 a.m. OK FPC TESTS 23 1560 29184000 2200
25072488 ngattaro1 E Feb. 27, 2017, 9:08 a.m. OK FPC TESTS 23 2245 15667200 2200
12150226 sanketM E July 21, 2015, 3:19 p.m. OK GNU C TESTS 23 373 18636800 2200
18576332 ruebenk E June 18, 2016, 10:02 a.m. OK GNU C TESTS 23 639 18636800 2200
12014382 hadrori E July 12, 2015, 2:42 a.m. OK GNU C TESTS 23 1419 17203200 2200
12010712 hadrori E July 11, 2015, 4:32 p.m. OK GNU C TESTS 23 1653 17203200 2200
14814014 pooyankhan E Dec. 15, 2015, 10:57 a.m. OK GNU C++ TESTS 23 155 15667200 2200
13347510 vnocyzarc E Oct. 2, 2015, 5:21 p.m. OK GNU C++ TESTS 23 156 15872000 2200
40223303 vjudge5 E July 12, 2018, 7:37 a.m. OK GNU C++ TESTS 23 156 18636800 2200
5409648 a654889339 E Dec. 11, 2013, 1:40 p.m. OK GNU C++ TESTS 23 156 18739200 2200
4836695 dashuiren E Oct. 21, 2013, 8:55 a.m. OK GNU C++ TESTS 23 156 18739200 2200
18503177 burning_mind E June 15, 2016, 5:30 p.m. OK GNU C++ TESTS 23 156 22016000 2200
13347684 vnocyzarc E Oct. 2, 2015, 5:32 p.m. OK GNU C++ TESTS 23 171 13619200 2200
13347568 vnocyzarc E Oct. 2, 2015, 5:25 p.m. OK GNU C++ TESTS 23 171 13619200 2200
13347539 vnocyzarc E Oct. 2, 2015, 5:23 p.m. OK GNU C++ TESTS 23 171 13619200 2200
18576614 ruebenk E June 18, 2016, 10:16 a.m. OK GNU C++ TESTS 23 171 15667200 2200
6999318 kllp E July 2, 2014, 7:23 p.m. OK GNU C++0x TESTS 23 155 20582400 2200
7553499 woyeshizuile E Aug. 22, 2014, 3:18 p.m. OK GNU C++0x TESTS 23 187 20582400 2200
6999326 kllp E July 2, 2014, 7:25 p.m. OK GNU C++0x TESTS 23 326 20582400 2200
4427516 MinakoKojima E Sept. 7, 2013, 12:44 p.m. OK GNU C++0x TESTS 22 374 22118400 2200
7658294 jianmodgqb E Sept. 1, 2014, 4:42 a.m. OK GNU C++0x TESTS 23 405 47718400 2200
4425980 kraskevich E Sept. 7, 2013, 10:34 a.m. OK GNU C++0x TESTS 22 436 34918400 2200
4424820 mrtempo E Sept. 7, 2013, 9:52 a.m. OK GNU C++0x TESTS 22 468 21401600 2200
4450013 Xellos E Sept. 13, 2013, 12:34 a.m. OK GNU C++0x TESTS 23 498 11878400 2200
7541469 aurinegro E Aug. 21, 2014, 8:39 a.m. OK GNU C++0x TESTS 23 576 27443200 2200
10128872 yzyz E March 3, 2015, 6:33 a.m. OK GNU C++0x TESTS 23 608 18227200 2200
68678128 rainboy E Jan. 12, 2020, 7:46 p.m. OK GNU C11 TESTS 23 452 24166400 2200
69146732 rainboy E Jan. 19, 2020, 3:58 p.m. OK GNU C11 TESTS 23 467 24166400 2200
49683736 Justaskeleton E Feb. 10, 2019, 5:28 a.m. OK GNU C11 TESTS 23 514 20377600 2200
49683767 Justaskeleton E Feb. 10, 2019, 5:29 a.m. OK GNU C11 TESTS 23 577 20377600 2200
50428461 sunyukai E Feb. 24, 2019, 12:47 p.m. OK GNU C++11 TESTS 23 124 35225600 2200
51062578 vjudge5 E March 9, 2019, 4:04 a.m. OK GNU C++11 TESTS 23 124 41574400 2200
52319832 raresdanut E April 4, 2019, 7:04 p.m. OK GNU C++11 TESTS 23 140 18329600 2200
50927629 vjudge4 E March 7, 2019, 12:35 p.m. OK GNU C++11 TESTS 23 140 18534400 2200
56952012 vjudge3 E July 13, 2019, 2:38 a.m. OK GNU C++11 TESTS 23 156 4915200 2200
13351747 Live_Forever E Oct. 3, 2015, 1:41 a.m. OK GNU C++11 TESTS 23 156 18534400 2200
13360754 rok_04 E Oct. 3, 2015, 2:20 p.m. OK GNU C++11 TESTS 23 156 20480000 2200
56951981 luogu_bot5 E July 13, 2019, 2:37 a.m. OK GNU C++11 TESTS 23 171 4915200 2200
13351893 Live_Forever E Oct. 3, 2015, 2:04 a.m. OK GNU C++11 TESTS 23 171 18636800 2200
12233867 litiantian E July 27, 2015, 2:39 a.m. OK GNU C++11 TESTS 23 171 21708800 2200
36256369 Marchello E March 13, 2018, 5:01 p.m. OK GNU C++14 TESTS 23 202 18841600 2200
60830871 maxmin E Sept. 19, 2019, 6:51 a.m. OK GNU C++14 TESTS 23 202 41574400 2200
63394048 TigerStar E Oct. 25, 2019, 4:06 p.m. OK GNU C++14 TESTS 23 217 48230400 2200
46298309 boatinw99 E Nov. 28, 2018, 5:32 a.m. OK GNU C++14 TESTS 23 218 18636800 2200
27190587 Marinkovic E May 18, 2017, 5:33 a.m. OK GNU C++14 TESTS 23 218 20480000 2200
65454550 upobir E Nov. 20, 2019, 7:47 p.m. OK GNU C++14 TESTS 23 218 28672000 2200
61585281 vjudge5 E Oct. 1, 2019, 4:35 a.m. OK GNU C++14 TESTS 23 218 131788800 2200
49210267 dvdg6566 E Jan. 30, 2019, 3:19 p.m. OK GNU C++14 TESTS 23 233 14233600 2200
48308722 lcs147 E Jan. 12, 2019, 10:13 p.m. OK GNU C++14 TESTS 23 233 20172800 2200
42137051 pxh612__________________ E Aug. 27, 2018, 1:12 a.m. OK GNU C++14 TESTS 23 233 20582400 2200
49926136 oremor E Feb. 14, 2019, 10:49 p.m. OK GNU C++17 TESTS 23 140 12185600 2200
39871066 cai_lw E July 2, 2018, 2:23 p.m. OK GNU C++17 TESTS 23 202 16179200 2200
52495399 antony191 E April 8, 2019, 1:28 p.m. OK GNU C++17 TESTS 23 218 16691200 2200
60349400 vjudge1 E Sept. 10, 2019, 1:45 p.m. OK GNU C++17 TESTS 23 233 17920000 2200
65713213 chikibambonator E Nov. 25, 2019, 3:17 p.m. OK GNU C++17 TESTS 23 233 19353600 2200
66249204 saketh E Dec. 3, 2019, 11:27 p.m. OK GNU C++17 TESTS 23 233 39321600 2200
57781546 GioChkhaidze E July 26, 2019, 6:10 a.m. OK GNU C++17 TESTS 23 233 43827200 2200
61589357 vjudge2 E Oct. 1, 2019, 6:24 a.m. OK GNU C++17 TESTS 23 233 131788800 2200
62089538 shurongwang E Oct. 8, 2019, 4:48 a.m. OK GNU C++17 TESTS 23 234 13209600 2200
39436166 UnstoppableChillMachine E June 20, 2018, 12:46 p.m. OK GNU C++17 TESTS 23 234 16588800 2200
68678127 Dukkha E Jan. 12, 2020, 7:46 p.m. OK Java 11 TESTS 23 764 27033600 2200
69146731 Dukkha E Jan. 19, 2020, 3:58 p.m. OK Java 11 TESTS 23 764 27852800 2200
65602984 sarthakmanna E Nov. 23, 2019, 7:01 p.m. OK Java 11 TESTS 23 2682 60928000 2200
4548928 isurugieri E Sept. 24, 2013, 1:26 p.m. OK Java 6 TESTS 23 686 3993600 2200
4424142 uwi E Sept. 7, 2013, 9:41 a.m. OK Java 6 TESTS 22 1122 3993600 2200
4835331 hiukim E Oct. 20, 2013, 8:39 p.m. OK Java 6 TESTS 23 2808 44134400 2200
4441126 alibaba E Sept. 11, 2013, 5:42 a.m. OK Java 6 TESTS 23 4086 71782400 2200
4441130 alibaba E Sept. 11, 2013, 5:44 a.m. OK Java 6 TESTS 23 4212 71680000 2200
4441054 alibaba E Sept. 11, 2013, 4:31 a.m. OK Java 6 TESTS 23 4524 71782400 2200
8550676 PlayLikeNeverB4 E Nov. 4, 2014, 6:30 p.m. OK Java 7 TESTS 23 421 44953600 2200
18593989 ruebenk E June 19, 2016, 8:36 a.m. OK Java 7 TESTS 23 529 21299200 2200
5231455 MuratKhayrulin E Nov. 24, 2013, 10:37 p.m. OK Java 7 TESTS 23 1123 45977600 2200
4433106 filo E Sept. 8, 2013, 5:10 p.m. OK Java 7 TESTS 22 1154 11878400 2200
4430874 Azat_Yusupov E Sept. 8, 2013, 7:16 a.m. OK Java 7 TESTS 22 1154 22323200 2200
8552771 PlayLikeNeverB4 E Nov. 4, 2014, 11:40 p.m. OK Java 7 TESTS 23 1231 36864000 2200
15724763 mkirsche E Feb. 1, 2016, 5:09 a.m. OK Java 7 TESTS 23 1435 67481600 2200
9797711 jeoygin E Feb. 11, 2015, 11:35 a.m. OK Java 7 TESTS 23 1934 90214400 2200
9803931 jeoygin E Feb. 12, 2015, 1:49 a.m. OK Java 7 TESTS 23 1965 90214400 2200
13541246 Breaking_Benjamin E Oct. 11, 2015, 6:09 a.m. OK Java 7 TESTS 23 2011 30720000 2200
28369060 coderbond007 E July 8, 2017, 12:36 p.m. OK Java 8 TESTS 23 358 27443200 2200
35982111 donli E March 6, 2018, 5:42 a.m. OK Java 8 TESTS 23 405 49254400 2200
10292321 fetetriste E March 15, 2015, 5:17 p.m. OK Java 8 TESTS 23 421 16281600 2200
31557171 skcusreplehc E Oct. 21, 2017, 8:25 a.m. OK Java 8 TESTS 23 421 34099200 2200
47805086 vjudge3 E Jan. 1, 2019, 6:19 a.m. OK Java 8 TESTS 23 436 24576000 2200
47805029 vjudge5 E Jan. 1, 2019, 6:14 a.m. OK Java 8 TESTS 23 436 24678400 2200
47805017 vjudge3 E Jan. 1, 2019, 6:13 a.m. OK Java 8 TESTS 23 436 24678400 2200
24873122 MazzForces E Feb. 21, 2017, 2:05 p.m. OK Java 8 TESTS 23 436 45772800 2200
53031121 Ahmed_Diab E April 20, 2019, 12:24 a.m. OK Java 8 TESTS 23 452 18329600 2200
28404287 coderbond007 E July 10, 2017, 9:52 a.m. OK Java 8 TESTS 23 498 27443200 2200
38012941 wleung_bvg E May 8, 2018, 6:25 a.m. OK Mono C# TESTS 23 810 243507200 2200
32434416 og.kostya E Nov. 18, 2017, 2:52 p.m. OK MS C# TESTS 23 3509 36966400 2200
32434399 og.kostya E Nov. 18, 2017, 2:50 p.m. OK MS C# TESTS 23 3540 30924800 2200
5815512 NuM E Jan. 26, 2014, 9:12 p.m. OK MS C++ TESTS 23 202 15667200 2200
5814759 NuM E Jan. 26, 2014, 7:34 p.m. OK MS C++ TESTS 23 202 15667200 2200
5815482 NuM E Jan. 26, 2014, 9:05 p.m. OK MS C++ TESTS 23 217 24064000 2200
4427765 suTest E Sept. 7, 2013, 1:12 p.m. OK MS C++ TESTS 22 218 6246400 2200
4435014 AlexandraLi E Sept. 9, 2013, 10:38 a.m. OK MS C++ TESTS 22 248 4300800 2200
4427305 StyleTang E Sept. 7, 2013, 12:16 p.m. OK MS C++ TESTS 22 248 4608000 2200
4431070 likunjk E Sept. 8, 2013, 8:11 a.m. OK MS C++ TESTS 22 248 5017600 2200
4426373 Furko E Sept. 7, 2013, 10:57 a.m. OK MS C++ TESTS 22 248 28364800 2200
4427391 qiukaijia E Sept. 7, 2013, 12:29 p.m. OK MS C++ TESTS 22 280 2867200 2200
4434384 PeakCHAm E Sept. 9, 2013, 6:41 a.m. OK MS C++ TESTS 22 280 4710400 2200
58948685 WLZ E Aug. 17, 2019, 10:04 a.m. OK MS C++ 2017 TESTS 23 623 35840000 2200
67263700 TrickmanOff E Dec. 20, 2019, 5:03 a.m. OK MS C++ 2017 TESTS 23 1606 71270400 2200
67263682 TrickmanOff E Dec. 20, 2019, 5:02 a.m. OK MS C++ 2017 TESTS 23 1965 71475200 2200
65937727 danyclaber E Nov. 29, 2019, 3:40 a.m. OK MS C++ 2017 TESTS 23 3337 4505600 2200
66088012 sansen E Dec. 1, 2019, 6 a.m. OK Rust TESTS 23 295 16076800 2200
66087818 sansen E Dec. 1, 2019, 5:54 a.m. OK Rust TESTS 23 405 15257600 2200
66035719 sansen E Nov. 30, 2019, 11:40 a.m. OK Rust TESTS 23 436 15257600 2200
66001951 sansen E Nov. 29, 2019, 7:30 p.m. OK Rust TESTS 23 499 15872000 2200

remove filters

Back to search problems