Codeforces Round 107 (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
150 Codeforces Round 107 (Div. 1) FINISHED False 7200 446914823 Feb. 17, 2012, 3 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1034 ) E Freezing with Style PROGRAMMING binary search data structures divide and conquer trees 3000

This winter is so... well, you've got the idea :-) The Nvodsk road system can be represented as n junctions connected with n - 1 bidirectional roads so that there is a path between any two junctions. The organizers of some event want to choose a place to accommodate the participants (junction v ), and the place to set up the contests (junction u ). Besides, at the one hand, they want the participants to walk about the city and see the neighbourhood (that's why the distance between v and u should be no less than l ). On the other hand, they don't want the participants to freeze (so the distance between v and u should be no more than r ). Besides, for every street we know its beauty — some integer from 0 to 10 9 . Your task is to choose the path that fits in the length limits and has the largest average beauty. We shall define the average beauty as a median of sequence of the beauties of all roads along the path. We can put it more formally like that: let there be a path with the length k . Let a i be a non-decreasing sequence that contains exactly k elements. Each number occurs there exactly the number of times a road with such beauty occurs along on path. We will represent the path median as number a ⌊ k / 2⌋ , assuming that indexation starting from zero is used. ⌊ x ⌋ — is number х , rounded down to the nearest integer. For example, if a = {0, 5, 12} , then the median equals to 5 , and if a = {0, 5, 7, 12} , then the median is number 7 . It is guaranteed that there will be at least one path with the suitable quantity of roads. The first line contains three integers n , l , r ( 1 ≤ l ≤ r < n ≤ 10 5 ). Next n - 1 lines contain descriptions of roads of the Nvodsk, each line contains three integers a i , b i , c i ( 1 ≤ a i , b i ≤ n , 0 ≤ c i ≤ 10 9 , a i ≠ b i ) — junctions a i and b i are connected with a street whose beauty equals c i . Print two integers — numbers of the junctions, where to accommodate the participants and set up the contests, correspond

Tutorials

Tutorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
1466934 WindIncarnation E April 3, 2012, 5:28 a.m. OK FPC TESTS 118 1190 22937600 3000
1213265 coolinging E Feb. 21, 2012, 5:15 a.m. OK FPC TESTS 118 2940 9523200 3000
1260204 superpear E March 3, 2012, 12:37 p.m. OK FPC TESTS 118 3000 121446400 3000
1213328 coolinging E Feb. 21, 2012, 5:48 a.m. OK FPC TESTS 118 3380 9523200 3000
1358080 object022 E March 15, 2012, 2:30 a.m. OK FPC TESTS 118 6590 13619200 3000
1241633 sillycross E Feb. 28, 2012, 3:30 p.m. OK FPC TESTS 118 6970 13619200 3000
2172566 mishidalu E Sept. 15, 2012, 1:40 p.m. OK GNU C++ TESTS 118 500 12800000 3000
3555617 cp12321 E April 17, 2013, 9:52 a.m. OK GNU C++ TESTS 118 515 10752000 3000
3555603 object022 E April 17, 2013, 9:48 a.m. OK GNU C++ TESTS 118 531 10752000 3000
2172255 mishidalu E Sept. 15, 2012, 12:10 p.m. OK GNU C++ TESTS 118 531 12800000 3000
3555628 cp12321 E April 17, 2013, 9:54 a.m. OK GNU C++ TESTS 118 577 8396800 3000
6201694 I_so_sad E April 1, 2014, 3:12 a.m. OK GNU C++ TESTS 118 592 11673600 3000
40991849 ReaLNero1 E July 31, 2018, 12:55 a.m. OK GNU C++ TESTS 118 624 10649600 3000
2172428 mishidalu E Sept. 15, 2012, 1:06 p.m. OK GNU C++ TESTS 118 640 12800000 3000
3164794 hta E Feb. 21, 2013, 3:13 a.m. OK GNU C++ TESTS 118 656 6963200 3000
1289747 cp12321 E March 5, 2012, 8:57 a.m. OK GNU C++ TESTS 118 720 13414400 3000
2755380 QuadSidedBalloon E Dec. 12, 2012, 4:36 p.m. OK GNU C++0x TESTS 118 1843 11059200 3000
2639787 apia E Nov. 25, 2012, 5 a.m. OK GNU C++0x TESTS 118 3296 12288000 3000
2906916 xlk E Jan. 12, 2013, 7:07 a.m. OK GNU C++0x TESTS 118 3296 12492800 3000
10352250 josdas E March 19, 2015, 6:12 p.m. OK GNU C++0x TESTS 118 3962 20787200 3000
10352230 josdas E March 19, 2015, 6:09 p.m. OK GNU C++0x TESTS 118 4366 115200000 3000
7819186 Monyura E Sept. 17, 2014, 3:06 p.m. OK GNU C++0x TESTS 118 4710 17203200 3000
2794769 dc. E Dec. 19, 2012, 1:20 p.m. OK GNU C++0x TESTS 118 4875 15052800 3000
10352262 josdas E March 19, 2015, 6:13 p.m. OK GNU C++0x TESTS 118 5022 20787200 3000
2807271 bakabakashyoshyo E Dec. 22, 2012, 3:03 p.m. OK GNU C++0x TESTS 118 5093 10137600 3000
2561229 roosephu E Nov. 15, 2012, 2:56 a.m. OK GNU C++0x TESTS 118 6171 12697600 3000
33024092 Nobel_ruettt E Dec. 8, 2017, 1:49 p.m. OK GNU C++11 TESTS 118 780 14950400 3000
19006090 joyfun E July 10, 2016, 10:52 a.m. OK GNU C++11 TESTS 118 810 12083200 3000
18981405 Y_UME E July 9, 2016, 7:57 a.m. OK GNU C++11 TESTS 118 904 12083200 3000
40193933 tienthanh214 E July 11, 2018, 8:06 a.m. OK GNU C++11 TESTS 118 1122 12288000 3000
48023249 little_waxberry E Jan. 6, 2019, 7:19 a.m. OK GNU C++11 TESTS 118 1122 19353600 3000
33036920 Nobel_ruettt E Dec. 8, 2017, 9:44 p.m. OK GNU C++11 TESTS 118 1216 15769600 3000
33037086 Nobel_ruettt E Dec. 8, 2017, 9:57 p.m. OK GNU C++11 TESTS 118 1372 15769600 3000
30869968 EmanuelNrx E Sept. 30, 2017, 3:07 p.m. OK GNU C++11 TESTS 118 1464 14336000 3000
45252250 KCSC E Nov. 3, 2018, 5:18 p.m. OK GNU C++11 TESTS 118 1528 14438400 3000
33036828 Nobel_ruettt E Dec. 8, 2017, 9:36 p.m. OK GNU C++11 TESTS 118 1652 16486400 3000
28364775 xehoth E July 8, 2017, 8:47 a.m. OK GNU C++14 TESTS 118 966 13721600 3000
23670193 Ali.Pi E Jan. 9, 2017, 7:50 p.m. OK GNU C++14 TESTS 118 1652 18329600 3000
36906005 ddpag E April 3, 2018, 3:05 p.m. OK GNU C++14 TESTS 118 1746 19558400 3000
53959067 luogu_bot3 E May 10, 2019, 1:12 p.m. OK GNU C++14 TESTS 118 1840 13312000 3000
33074723 vjudge3 E Dec. 10, 2017, 7:31 a.m. OK GNU C++14 TESTS 118 2184 17203200 3000
58217584 PinkRabbit E Aug. 3, 2019, 11:21 a.m. OK GNU C++14 TESTS 118 2308 12595200 3000
56000301 Scut82 E June 24, 2019, 12:42 p.m. OK GNU C++14 TESTS 118 2650 19046400 3000
61942436 pikmike E Oct. 5, 2019, 8:34 p.m. OK GNU C++14 TESTS 118 2744 267468800 3000
33587959 vjudge1 E Dec. 24, 2017, 8:33 a.m. OK GNU C++14 TESTS 118 2806 17203200 3000
32538435 dujvet E Nov. 22, 2017, 1:40 a.m. OK GNU C++14 TESTS 118 2870 12083200 3000
66612698 saketh E Dec. 10, 2019, 11:40 p.m. OK GNU C++17 TESTS 118 1526 50483200 3000
66610766 saketh E Dec. 10, 2019, 9:25 p.m. OK GNU C++17 TESTS 118 1652 50483200 3000
66609602 saketh E Dec. 10, 2019, 8:32 p.m. OK GNU C++17 TESTS 118 1652 50483200 3000
53960150 Christopher_Liu E May 10, 2019, 1:42 p.m. OK GNU C++17 TESTS 118 1684 12083200 3000
66602331 saketh E Dec. 10, 2019, 5:01 p.m. OK GNU C++17 TESTS 118 1746 50483200 3000
53958904 vjudge1 E May 10, 2019, 1:08 p.m. OK GNU C++17 TESTS 118 1994 12083200 3000
53958846 Christopher_Liu E May 10, 2019, 1:07 p.m. OK GNU C++17 TESTS 118 1994 12083200 3000
66611043 saketh E Dec. 10, 2019, 9:42 p.m. OK GNU C++17 TESTS 118 2556 50073600 3000
66611013 saketh E Dec. 10, 2019, 9:40 p.m. OK GNU C++17 TESTS 118 2620 50073600 3000
66610881 saketh E Dec. 10, 2019, 9:33 p.m. OK GNU C++17 TESTS 118 2650 50483200 3000
2419793 moreD E Oct. 24, 2012, 3:26 a.m. OK MS C++ TESTS 118 4562 12185600 3000
3638935 fatsheep_LF E April 26, 2013, 9:53 p.m. OK MS C++ TESTS 118 5921 17510400 3000
1422150 NALP E March 27, 2012, 9:14 a.m. OK MS C++ TESTS 118 6970 27238400 3000

remove filters

Back to search problems