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"You are given n segments on a number line, numbered from 1 to n . The i -th segments covers all integer points from l_i to r_i and has a value w_i . You are asked to select a subset of these segments (possibly, all of them). Once the subset is selected, it's possible to travel between two integer points if there exists a selected segment that covers both of them. A subset is good if it's possible to reach point m starting from point 1 in arbitrary number of moves. The cost of the subset is the difference between the maximum and the minimum values of segments in it. Find the minimum cost of a good subset. In every test there exists at least one good subset. The first line contains two integers n and m ( 1 <= n <= 3 cdot 10^5 ; 2 <= m <= 10^6 ) -- the number of segments and the number of integer points. Each of the next n lines contains three integers l_i , r_i and w_i ( 1 <= l_i < r_i <= m ; 1 <= w_i <= 10^6 ) -- the description of the i -th segment. In every test there exists at least one good subset. Print a single integer -- the minimum cost of a good subset. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
124387941 |
gxlois |
E |
July 31, 2021, 5:16 a.m. |
OK |
D |
TESTS |
61 |
1107 |
86732800 |
|
2100 |
124388638 |
gxlois |
E |
July 31, 2021, 5:27 a.m. |
OK |
D |
TESTS |
61 |
1154 |
86732800 |
|
2100 |
124384900 |
gxlois |
E |
July 31, 2021, 4:30 a.m. |
OK |
D |
TESTS |
61 |
1154 |
86732800 |
|
2100 |
124385007 |
gxlois |
E |
July 31, 2021, 4:31 a.m. |
OK |
D |
TESTS |
61 |
1201 |
86732800 |
|
2100 |
124387579 |
gxlois |
E |
July 31, 2021, 5:11 a.m. |
OK |
D |
TESTS |
61 |
1216 |
100864000 |
|
2100 |
124387422 |
gxlois |
E |
July 31, 2021, 5:09 a.m. |
OK |
D |
TESTS |
61 |
1248 |
100864000 |
|
2100 |
124382015 |
gxlois |
E |
July 31, 2021, 3:38 a.m. |
OK |
D |
TESTS |
61 |
1278 |
100864000 |
|
2100 |
124385536 |
gxlois |
E |
July 31, 2021, 4:40 a.m. |
OK |
D |
TESTS |
61 |
1325 |
100864000 |
|
2100 |
124381161 |
gxlois |
E |
July 31, 2021, 3:22 a.m. |
OK |
D |
TESTS |
61 |
1466 |
100864000 |
|
2100 |
124381349 |
gxlois |
E |
July 31, 2021, 3:25 a.m. |
OK |
D |
TESTS |
61 |
1497 |
100864000 |
|
2100 |
124344851 |
Akoasm_X |
E |
July 30, 2021, 4:44 p.m. |
OK |
GNU C++11 |
TESTS |
61 |
218 |
48025600 |
|
2100 |
124377363 |
uuku |
E |
July 31, 2021, 2:08 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
233 |
64204800 |
|
2100 |
124377949 |
RE_night |
E |
July 31, 2021, 2:21 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
295 |
64000000 |
|
2100 |
124377653 |
dingdingsb |
E |
July 31, 2021, 2:14 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
296 |
48025600 |
|
2100 |
124372376 |
moyujiang |
E |
July 30, 2021, 11:33 p.m. |
OK |
GNU C++11 |
TESTS |
61 |
296 |
48025600 |
|
2100 |
124389982 |
li0201 |
E |
July 31, 2021, 5:44 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
311 |
39628800 |
|
2100 |
124386307 |
wangyian2022 |
E |
July 31, 2021, 4:52 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
311 |
41472000 |
|
2100 |
124390816 |
No-Rain |
E |
July 31, 2021, 5:55 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
311 |
48025600 |
|
2100 |
124384825 |
li0201 |
E |
July 31, 2021, 4:29 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
312 |
39628800 |
|
2100 |
124381832 |
mao_zx |
E |
July 31, 2021, 3:35 a.m. |
OK |
GNU C++11 |
TESTS |
61 |
327 |
48025600 |
|
2100 |
124373358 |
whiteedu |
E |
July 31, 2021, 12:09 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
343 |
244224000 |
|
2100 |
124375808 |
meopass_QAQ |
E |
July 31, 2021, 1:33 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
421 |
45260800 |
|
2100 |
124344039 |
laplmbaithoi |
E |
July 30, 2021, 4:40 p.m. |
OK |
GNU C++14 |
TESTS |
61 |
421 |
54169600 |
|
2100 |
124374665 |
whiteedu |
E |
July 31, 2021, 12:59 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
467 |
32563200 |
|
2100 |
124365299 |
qwerty190 |
E |
July 30, 2021, 8:30 p.m. |
OK |
GNU C++14 |
TESTS |
61 |
467 |
39424000 |
|
2100 |
124388778 |
DonG__Lee |
E |
July 31, 2021, 5:29 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
498 |
24166400 |
|
2100 |
124388620 |
fangt |
E |
July 31, 2021, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
499 |
71475200 |
|
2100 |
124358888 |
MYNAMEISSHARIFUL |
E |
July 30, 2021, 7:05 p.m. |
OK |
GNU C++14 |
TESTS |
61 |
529 |
39424000 |
|
2100 |
124379028 |
zstuycz |
E |
July 31, 2021, 2:42 a.m. |
OK |
GNU C++14 |
TESTS |
61 |
530 |
55808000 |
|
2100 |
124342298 |
tuliwei |
E |
July 30, 2021, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
61 |
546 |
71475200 |
|
2100 |
124346547 |
XeroxAuto |
E |
July 30, 2021, 4:54 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
342 |
41472000 |
|
2100 |
124345498 |
XeroxAuto |
E |
July 30, 2021, 4:48 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
389 |
41472000 |
|
2100 |
124352444 |
vito1036 |
E |
July 30, 2021, 5:47 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
405 |
25292800 |
|
2100 |
124347885 |
Jeff_Lee |
E |
July 30, 2021, 5:04 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
405 |
47820800 |
|
2100 |
124356769 |
t4c0 |
E |
July 30, 2021, 6:37 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
420 |
24166400 |
|
2100 |
124369779 |
arjitkansal |
E |
July 30, 2021, 10 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
420 |
45260800 |
|
2100 |
124348011 |
HAUT_Xjl |
E |
July 30, 2021, 5:05 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
420 |
63897600 |
|
2100 |
124362273 |
Crescendo |
E |
July 30, 2021, 7:48 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
436 |
19353600 |
|
2100 |
124380094 |
pvzelyyds |
E |
July 31, 2021, 3:03 a.m. |
OK |
GNU C++17 |
TESTS |
61 |
436 |
39424000 |
|
2100 |
124357837 |
nguyentra |
E |
July 30, 2021, 6:51 p.m. |
OK |
GNU C++17 |
TESTS |
61 |
436 |
47820800 |
|
2100 |
124385147 |
Newtech66 |
E |
July 31, 2021, 4:34 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
327 |
19968000 |
|
2100 |
124376856 |
icey_z |
E |
July 31, 2021, 1:57 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
374 |
41164800 |
|
2100 |
124380315 |
PaliLo |
E |
July 31, 2021, 3:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
389 |
31948800 |
|
2100 |
124380469 |
shxgun |
E |
July 31, 2021, 3:10 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
389 |
39936000 |
|
2100 |
124374901 |
AnNotShy |
E |
July 31, 2021, 1:08 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
389 |
40140800 |
|
2100 |
124350391 |
Noxus |
E |
July 30, 2021, 5:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
389 |
46387200 |
|
2100 |
124372953 |
Akib_12 |
E |
July 30, 2021, 11:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
390 |
23961600 |
|
2100 |
124363176 |
onsen_manjuuu |
E |
July 30, 2021, 8 p.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
405 |
24576000 |
|
2100 |
124391108 |
anmichi |
E |
July 31, 2021, 6 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
405 |
24678400 |
|
2100 |
124389113 |
Kodaman |
E |
July 31, 2021, 5:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
61 |
405 |
44748800 |
|
2100 |
124357417 |
meooow |
E |
July 30, 2021, 6:45 p.m. |
OK |
Haskell |
TESTS |
61 |
2667 |
262758400 |
|
2100 |
124370824 |
AhmedZ |
E |
July 30, 2021, 10:34 p.m. |
OK |
Java 11 |
TESTS |
61 |
1060 |
50790400 |
|
2100 |
124346858 |
saptarshi1729 |
E |
July 30, 2021, 4:57 p.m. |
OK |
Java 11 |
TESTS |
61 |
1497 |
223232000 |
|
2100 |
124356267 |
Restricted |
E |
July 30, 2021, 6:30 p.m. |
OK |
Java 11 |
TESTS |
61 |
1747 |
130969600 |
|
2100 |
124354723 |
Restricted |
E |
July 30, 2021, 6:13 p.m. |
OK |
Java 11 |
TESTS |
61 |
1809 |
130969600 |
|
2100 |
124372962 |
qwerty12345qwerty |
E |
July 30, 2021, 11:56 p.m. |
OK |
Java 11 |
TESTS |
61 |
2152 |
166297600 |
|
2100 |
124390150 |
yaoct |
E |
July 31, 2021, 5:47 a.m. |
OK |
Java 8 |
TESTS |
61 |
1528 |
126668800 |
|
2100 |
124366555 |
Katushechka |
E |
July 30, 2021, 8:50 p.m. |
OK |
Java 8 |
TESTS |
61 |
2995 |
268390400 |
|
2100 |
124358482 |
r57shell |
E |
July 30, 2021, 7 p.m. |
OK |
MS C++ |
TESTS |
61 |
561 |
24268800 |
|
2100 |
124358150 |
r57shell |
E |
July 30, 2021, 6:55 p.m. |
OK |
MS C++ |
TESTS |
61 |
576 |
24268800 |
|
2100 |
124346247 |
danilgrig |
E |
July 30, 2021, 4:53 p.m. |
OK |
MS C++ 2017 |
TESTS |
61 |
1107 |
24166400 |
|
2100 |
124348682 |
danilgrig |
E |
July 30, 2021, 5:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
61 |
1154 |
24166400 |
|
2100 |
124344493 |
terry_u16 |
E |
July 30, 2021, 4:42 p.m. |
OK |
.NET Core C# |
TESTS |
61 |
576 |
43724800 |
|
2100 |
124357021 |
titia |
E |
July 30, 2021, 6:40 p.m. |
OK |
PyPy 3 |
TESTS |
61 |
2526 |
76902400 |
|
2100 |
124354673 |
jaglike_makkar |
E |
July 30, 2021, 6:12 p.m. |
OK |
PyPy 3 |
TESTS |
61 |
2527 |
112230400 |
|
2100 |
124390949 |
The_Apurv_Rathore |
E |
July 31, 2021, 5:57 a.m. |
OK |
PyPy 3 |
TESTS |
61 |
2683 |
111001600 |
|
2100 |
124390409 |
TheNoOneCoder |
E |
July 31, 2021, 5:50 a.m. |
OK |
PyPy 3 |
TESTS |
61 |
2683 |
111001600 |
|
2100 |
124352642 |
anishde85 |
E |
July 30, 2021, 5:50 p.m. |
OK |
PyPy 3 |
TESTS |
61 |
2760 |
155852800 |
|
2100 |
124349733 |
manish.17 |
E |
July 30, 2021, 5:19 p.m. |
OK |
PyPy 3 |
TESTS |
61 |
2760 |
155852800 |
|
2100 |
124390068 |
shotoyoo |
E |
July 31, 2021, 5:46 a.m. |
OK |
PyPy 3 |
TESTS |
61 |
2776 |
220876800 |
|
2100 |
124390211 |
shotoyoo |
E |
July 31, 2021, 5:47 a.m. |
OK |
PyPy 3 |
TESTS |
61 |
2885 |
223436800 |
|
2100 |
124390271 |
nicku123 |
E |
July 31, 2021, 5:48 a.m. |
OK |
PyPy 3 |
TESTS |
61 |
2948 |
103936000 |
|
2100 |
124347159 |
apilat |
E |
July 30, 2021, 4:59 p.m. |
OK |
Rust |
TESTS |
61 |
655 |
43110400 |
|
2100 |
remove filters
Back to search problems