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.
Problems
B"Sonya likes ice cream very much. She eats it even during programming competitions. That is why the girl decided that she wants to open her own ice cream shops. Sonya lives in a city with n junctions and n-1 streets between them. All streets are two-way and connect two junctions. It is possible to travel from any junction to any other using one or more streets. City Hall allows opening shops only on junctions. The girl cannot open shops in the middle of streets. Sonya has exactly k friends whom she can trust. If she opens a shop, one of her friends has to work there and not to allow anybody to eat an ice cream not paying for it. Since Sonya does not want to skip an important competition, she will not work in shops personally. Sonya wants all her ice cream shops to form a simple path of the length r ( 1 <= r <= k ), i.e. to be located in different junctions f_1, f_2, ... , f_r and there is street between f_i and f_{i+1} for each i from 1 to r-1 . The girl takes care of potential buyers, so she also wants to minimize the maximum distance between the junctions to the nearest ice cream shop. The distance between two junctions a and b is equal to the sum of all the street lengths that you need to pass to get from the junction a to the junction b . So Sonya wants to minimize max_{a} min_{1 <= i <= r} d_{a,f_i} where a takes a value of all possible n junctions, f_i -- the junction where the i -th Sonya's shop is located, and d_{x,y} -- the distance between the junctions x and y . Sonya is not sure that she can find the optimal shops locations, that is why she is asking you to help her to open not more than k shops that will form a simple path and the maximum distance between any junction and the nearest shop would be minimal. The first line contains two integers n and k ( 1 <= q k <= q n <= q 10^5$$"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
40002116 |
VisJiao |
E |
July 5, 2018, 5:49 p.m. |
OK |
GNU C++ |
TESTS |
59 |
62 |
6246400 |
|
2400 |
40005404 |
11101001 |
E |
July 5, 2018, 6:25 p.m. |
OK |
GNU C++ |
TESTS |
59 |
108 |
19763200 |
|
2400 |
40002484 |
EZ_fwtt08 |
E |
July 5, 2018, 5:53 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
140 |
19763200 |
|
2400 |
40004515 |
SirirNicheBirirDokan |
E |
July 5, 2018, 6:16 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
171 |
9318400 |
|
2400 |
39999448 |
wasyl |
E |
July 5, 2018, 5:24 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
280 |
14233600 |
|
2400 |
40001918 |
MrMiroticccc |
E |
July 5, 2018, 5:47 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
296 |
16896000 |
|
2400 |
40004061 |
AntiLeaf |
E |
July 5, 2018, 6:10 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
312 |
14131200 |
|
2400 |
40005176 |
Honour_00 |
E |
July 5, 2018, 6:23 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
312 |
35635200 |
|
2400 |
40004241 |
phoenix71 |
E |
July 5, 2018, 6:12 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
373 |
16588800 |
|
2400 |
40004166 |
paladin |
E |
July 5, 2018, 6:12 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
514 |
5324800 |
|
2400 |
40005192 |
jlohse |
E |
July 5, 2018, 6:23 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
577 |
7475200 |
|
2400 |
40004436 |
samgiz |
E |
July 5, 2018, 6:14 p.m. |
OK |
GNU C++11 |
TESTS |
59 |
670 |
14950400 |
|
2400 |
39999792 |
flower |
E |
July 5, 2018, 5:28 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
124 |
31539200 |
|
2400 |
40005043 |
HackerTina |
E |
July 5, 2018, 6:21 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
140 |
11264000 |
|
2400 |
40006297 |
mangojunior |
E |
July 5, 2018, 6:34 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
155 |
6963200 |
|
2400 |
40005119 |
milisav |
E |
July 5, 2018, 6:22 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
155 |
11059200 |
|
2400 |
40004159 |
DatVu |
E |
July 5, 2018, 6:11 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
155 |
12595200 |
|
2400 |
39999241 |
chpipis |
E |
July 5, 2018, 5:23 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
170 |
13516800 |
|
2400 |
40006167 |
fragusbot |
E |
July 5, 2018, 6:33 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
171 |
7168000 |
|
2400 |
40000650 |
Medeowex |
E |
July 5, 2018, 5:35 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
187 |
12595200 |
|
2400 |
40003263 |
bilau_de_campina |
E |
July 5, 2018, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
202 |
12800000 |
|
2400 |
40006070 |
lessmeaning |
E |
July 5, 2018, 6:32 p.m. |
OK |
GNU C++14 |
TESTS |
59 |
249 |
20480000 |
|
2400 |
40005932 |
attack204 |
E |
July 5, 2018, 6:31 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
171 |
19968000 |
|
2400 |
40003022 |
Taxman |
E |
July 5, 2018, 5:59 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
187 |
22323200 |
|
2400 |
40004612 |
Makcum888 |
E |
July 5, 2018, 6:17 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
218 |
15872000 |
|
2400 |
39999883 |
Jatana |
E |
July 5, 2018, 5:28 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
234 |
18022400 |
|
2400 |
40003768 |
yassin_ |
E |
July 5, 2018, 6:07 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
265 |
21299200 |
|
2400 |
40002856 |
Cams |
E |
July 5, 2018, 5:57 p.m. |
OK |
GNU C++17 |
TESTS |
59 |
358 |
13107200 |
|
2400 |
remove filters
Back to search problems