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'After returning to shore, uncle Bogdan usually visits the computer club "The Rock", to solve tasks in a pleasant company. One day, uncle Bogdan met his good old friend who told him one unusual task... There are n non-intersecting horizontal segments with ends in integers points on the plane with the standard cartesian coordinate system. All segments are strictly above the OX axis. You can choose an arbitrary vector ( a , b ), where b < 0 and coordinates are real numbers, and project all segments to OX axis along this vector. The projections shouldn 't intersect but may touch each other. Find the minimum possible difference between x coordinate of the right end of the rightmost projection and x coordinate of the left end of the leftmost projection. The first line contains the single integer n ( 1 <= n <= 2000 ) -- the number of segments. The i -th of the next n lines contains three integers xl_i , xr_i and y_i ( -10^6 <= xl_i < xr_i <= 10^6 ; 1 <= y_i <= 10^6 ) -- coordinates of the corresponding segment. It 's guaranteed that the segments don 't intersect or touch. Print the minimum possible difference you can get. Your answer will be considered correct if its absolute or relative error doesn 't exceed 10^{-6} . Formally, if your answer is a and jury 's answer is b then your answer will be considered correct if frac{|a - b|}{ max{(1, |b|)}} <= 10^{-6} . In the first example if we project segments along the vector (1, -1) then we get an answer 12-3=9 and (it can be proven) it is impossible to get less. It is optimal to project along the vector (1, -3) in the second example. The answer is 8 frac{2}{3}-2 frac{1}{3}=6 frac{1}{3} '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91661235 |
cnMember |
E |
Sept. 2, 2020, 4:56 p.m. |
OK |
GNU C++11 |
TESTS |
45 |
343 |
59187200 |
|
2700 |
91010678 |
mwlc |
E |
Aug. 26, 2020, 2:19 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
452 |
192409600 |
|
2700 |
88844447 |
daidao |
E |
Aug. 4, 2020, 5:58 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
499 |
63283200 |
|
2700 |
91264241 |
pantw |
E |
Aug. 29, 2020, 7:21 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
514 |
100966400 |
|
2700 |
89513705 |
LJF007 |
E |
Aug. 10, 2020, 1:34 p.m. |
OK |
GNU C++11 |
TESTS |
45 |
655 |
132198400 |
|
2700 |
90515141 |
ws_zzyer |
E |
Aug. 21, 2020, 8:30 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
764 |
52736000 |
|
2700 |
88829529 |
ChocolatePotato |
E |
Aug. 3, 2020, 9:23 p.m. |
OK |
GNU C++11 |
TESTS |
45 |
810 |
155340800 |
|
2700 |
90379659 |
andrew704 |
E |
Aug. 19, 2020, 10:33 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
951 |
58880000 |
|
2700 |
91272165 |
ympc |
E |
Aug. 29, 2020, 9:25 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
1138 |
201830400 |
|
2700 |
88859886 |
Zars19 |
E |
Aug. 4, 2020, 9:52 a.m. |
OK |
GNU C++11 |
TESTS |
45 |
1544 |
110899200 |
|
2700 |
88763795 |
froggyzhang |
E |
Aug. 2, 2020, 11:44 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
327 |
62668800 |
|
2700 |
88946429 |
naina_gupta |
E |
Aug. 5, 2020, 12:41 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
404 |
92057600 |
|
2700 |
89085404 |
2018LZY |
E |
Aug. 6, 2020, 4:13 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
452 |
117145600 |
|
2700 |
90381252 |
lavenderwithbluish |
E |
Aug. 19, 2020, 10:56 a.m. |
OK |
GNU C++14 |
TESTS |
45 |
467 |
192409600 |
|
2700 |
89366718 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 11:54 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
498 |
54476800 |
|
2700 |
89365034 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 10:16 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
499 |
54476800 |
|
2700 |
89361425 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 8:11 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
499 |
54476800 |
|
2700 |
89360781 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 7:54 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
499 |
54476800 |
|
2700 |
89362807 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 8:51 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
499 |
54579200 |
|
2700 |
89361534 |
ShubhamAvasthi |
E |
Aug. 8, 2020, 8:13 p.m. |
OK |
GNU C++14 |
TESTS |
45 |
499 |
54579200 |
|
2700 |
89304569 |
WJMDBMR |
E |
Aug. 8, 2020, 4:38 a.m. |
OK |
GNU C++17 |
TESTS |
45 |
280 |
62771200 |
|
2700 |
89304304 |
WJMDBMR |
E |
Aug. 8, 2020, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
45 |
280 |
62976000 |
|
2700 |
90538279 |
just-kidding |
E |
Aug. 21, 2020, 2:03 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
296 |
80179200 |
|
2700 |
90328101 |
VodkaInTheJar |
E |
Aug. 18, 2020, 4:29 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
311 |
58880000 |
|
2700 |
89594965 |
__Wind__ |
E |
Aug. 11, 2020, 4:30 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
327 |
62873600 |
|
2700 |
91612159 |
seekluna_xrc |
E |
Sept. 2, 2020, 5:04 a.m. |
OK |
GNU C++17 |
TESTS |
45 |
343 |
160768000 |
|
2700 |
88891770 |
bgrm |
E |
Aug. 4, 2020, 5:11 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
405 |
82636800 |
|
2700 |
88892672 |
bgrm |
E |
Aug. 4, 2020, 5:24 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
421 |
82944000 |
|
2700 |
89469146 |
proofbycontradiction |
E |
Aug. 9, 2020, 10:47 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
514 |
117452800 |
|
2700 |
89469030 |
proofbycontradiction |
E |
Aug. 9, 2020, 10:40 p.m. |
OK |
GNU C++17 |
TESTS |
45 |
514 |
117657600 |
|
2700 |
89525608 |
iaNTU |
E |
Aug. 10, 2020, 4:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
265 |
96256000 |
|
2700 |
89525210 |
iaNTU |
E |
Aug. 10, 2020, 4:05 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
265 |
96358400 |
|
2700 |
89524317 |
iaNTU |
E |
Aug. 10, 2020, 3:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
265 |
96358400 |
|
2700 |
88912746 |
devillove084 |
E |
Aug. 5, 2020, 3:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
265 |
196710400 |
|
2700 |
89464942 |
hitonanode |
E |
Aug. 9, 2020, 8 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
343 |
106291200 |
|
2700 |
88930567 |
oskarfiuk1 |
E |
Aug. 5, 2020, 8:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
514 |
64204800 |
|
2700 |
88910956 |
wwdd |
E |
Aug. 5, 2020, 2:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
561 |
156057600 |
|
2700 |
88818518 |
Juzek |
E |
Aug. 3, 2020, 5:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
654 |
131481600 |
|
2700 |
89523827 |
iaNTU |
E |
Aug. 10, 2020, 3:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
1107 |
187187200 |
|
2700 |
89811085 |
pikmike |
E |
Aug. 13, 2020, 4:08 p.m. |
OK |
GNU C++17 (64) |
TESTS |
45 |
1138 |
193945600 |
|
2700 |
88929326 |
Ivan_Frost |
E |
Aug. 5, 2020, 8:37 a.m. |
OK |
MS C++ 2017 |
TESTS |
45 |
2184 |
304742400 |
|
2700 |
remove filters
Back to search problems