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 coordinate axis OX . The i -th segment has borders [l_i; r_i] . All points x , for which l_i <= x <= r_i holds, belong to the i -th segment. Your task is to choose the maximum by size (the number of segments) subset of the given set of segments such that each pair of segments in this subset either non-intersecting or one of them lies inside the other one. Two segments [l_i; r_i] and [l_j; r_j] are non-intersecting if they have no common points. For example, segments [1; 2] and [3; 4] , [1; 3] and [5; 5] are non-intersecting, while segments [1; 2] and [2; 3] , [1; 2] and [2; 2] are intersecting. The segment [l_i; r_i] lies inside the segment [l_j; r_j] if l_j <= l_i and r_i <= r_j . For example, segments [2; 2] , [2, 3] , [3; 4] and [2; 4] lie inside the segment [2; 4] , while [2; 5] and [1; 4] are not. You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 1000 ) -- the number of test cases. Then t test cases follow. The first line of the test case contains one integer n ( 1 <= n <= 3000 ) -- the number of segments. The next n lines describe segments. The i -th segment is given as two integers l_i and r_i ( 1 <= l_i <= r_i <= 2 cdot 10^5 ), where l_i is the left border of the i -th segment and r_i is the right border of the i -th segment. Additional constraint on the input: there are no duplicates in the list of segments. It is guaranteed that the sum of n does not exceed 3000 ( sum n <= 3000 ). For each test case, print the answer: the maximum possible size of the subset of the given set of segments such that each pair of segments in this subset either non-intersecting or one of them lies inside the other one'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91529401 |
KalznAsawind |
F |
Sept. 1, 2020, 12:59 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
46 |
204800 |
|
|
91259279 |
tanxi |
F |
Aug. 29, 2020, 5:56 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
62 |
102400 |
|
|
91295531 |
Vedanshu |
F |
Aug. 29, 2020, 3:29 p.m. |
OK |
GNU C++11 |
TESTS |
24 |
186 |
145305600 |
|
|
91454844 |
WaluntOvO |
F |
Aug. 31, 2020, 4:28 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
187 |
149196800 |
|
|
90722657 |
huanggs |
F |
Aug. 23, 2020, 2:11 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
202 |
32153600 |
|
|
91454773 |
WaluntOvO |
F |
Aug. 31, 2020, 4:27 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
202 |
149196800 |
|
|
91048626 |
SANJIN |
F |
Aug. 26, 2020, 12:08 p.m. |
OK |
GNU C++11 |
TESTS |
24 |
218 |
145510400 |
|
|
90747258 |
Hpnes |
F |
Aug. 23, 2020, 10:37 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
218 |
148582400 |
|
|
90211520 |
ybw051114 |
F |
Aug. 17, 2020, 9 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
233 |
145100800 |
|
|
90211638 |
ybw051114 |
F |
Aug. 17, 2020, 9:01 a.m. |
OK |
GNU C++11 |
TESTS |
24 |
248 |
145203200 |
|
|
90698048 |
HynDuf |
F |
Aug. 22, 2020, 3:08 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
46 |
3891200 |
|
|
90059485 |
xwd456 |
F |
Aug. 16, 2020, 5:55 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
62 |
614400 |
|
|
90059571 |
xwd456 |
F |
Aug. 16, 2020, 5:57 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
77 |
512000 |
|
|
90297133 |
theNitesh |
F |
Aug. 18, 2020, 10:10 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
77 |
12902400 |
|
|
89994563 |
K0u1e |
F |
Aug. 15, 2020, 7 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
93 |
102400 |
|
|
90706131 |
Zoli9 |
F |
Aug. 22, 2020, 5:09 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
108 |
77107200 |
|
|
90324437 |
rfpermen |
F |
Aug. 18, 2020, 3:49 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
109 |
73011200 |
|
|
90317622 |
TheLethalCode |
F |
Aug. 18, 2020, 2:39 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
124 |
27750400 |
|
|
90530192 |
nayeon_im |
F |
Aug. 21, 2020, 12:15 p.m. |
OK |
GNU C++14 |
TESTS |
24 |
171 |
76083200 |
|
|
91481752 |
bharath. |
F |
Aug. 31, 2020, 10:31 a.m. |
OK |
GNU C++14 |
TESTS |
24 |
171 |
148582400 |
|
|
90065663 |
Akiha |
F |
Aug. 16, 2020, 7:45 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
61 |
102400 |
|
|
90709976 |
is_ffacs |
F |
Aug. 22, 2020, 6:11 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
61 |
3891200 |
|
|
90708261 |
is_ffacs |
F |
Aug. 22, 2020, 5:43 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
61 |
3891200 |
|
|
90649781 |
yzyz |
F |
Aug. 22, 2020, 3:34 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
61 |
4096000 |
|
|
90709630 |
is_ffacs |
F |
Aug. 22, 2020, 6:06 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
61 |
4096000 |
|
|
90514433 |
seekluna_xrc |
F |
Aug. 21, 2020, 8:21 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
62 |
3788800 |
|
|
90709313 |
is_ffacs |
F |
Aug. 22, 2020, 6 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
62 |
3891200 |
|
|
91157021 |
uryuuu |
F |
Aug. 27, 2020, 5:30 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
78 |
102400 |
|
|
91599880 |
Mdominykas |
F |
Sept. 1, 2020, 9:15 p.m. |
OK |
GNU C++17 |
TESTS |
24 |
93 |
1126400 |
|
|
90057026 |
Raiden |
F |
Aug. 16, 2020, 4:54 a.m. |
OK |
GNU C++17 |
TESTS |
24 |
93 |
73011200 |
|
|
90065648 |
feiko |
F |
Aug. 16, 2020, 7:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
62 |
102400 |
|
|
89995471 |
ILLLZKQF |
F |
Aug. 15, 2020, 7:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
77 |
716800 |
|
|
90328794 |
dynam1c |
F |
Aug. 18, 2020, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
93 |
102400 |
|
|
90691382 |
SSYernar |
F |
Aug. 22, 2020, 1:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
109 |
185139200 |
|
|
90202587 |
tanzilidrisi68 |
F |
Aug. 17, 2020, 7 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
187 |
72499200 |
|
|
90182125 |
hackermub |
F |
Aug. 17, 2020, 12:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
280 |
144281600 |
|
|
91680002 |
otera |
F |
Sept. 3, 2020, 12:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
280 |
146739200 |
|
|
90200887 |
harshit15 |
F |
Aug. 17, 2020, 6:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
295 |
145715200 |
|
|
91679978 |
otera |
F |
Sept. 3, 2020, 12:49 a.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
296 |
145715200 |
|
|
90249994 |
vjudge4 |
F |
Aug. 17, 2020, 4:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
24 |
311 |
145612800 |
|
|
90004630 |
tusharjape007 |
F |
Aug. 15, 2020, 9:09 a.m. |
OK |
Java 11 |
TESTS |
24 |
1122 |
260096000 |
|
|
91194998 |
agcom |
F |
Aug. 28, 2020, 9:17 a.m. |
OK |
Java 8 |
TESTS |
24 |
498 |
81612800 |
|
|
90205142 |
ali.gh2236 |
F |
Aug. 17, 2020, 7:35 a.m. |
OK |
Java 8 |
TESTS |
24 |
873 |
262144000 |
|
|
90173264 |
Mosyagin |
F |
Aug. 16, 2020, 7:40 p.m. |
OK |
Mono C# |
TESTS |
24 |
405 |
153190400 |
|
|
90173181 |
Mosyagin |
F |
Aug. 16, 2020, 7:39 p.m. |
OK |
Mono C# |
TESTS |
24 |
935 |
153292800 |
|
|
90115208 |
multimuvies |
F |
Aug. 16, 2020, 3:08 p.m. |
OK |
MS C++ 2017 |
TESTS |
24 |
311 |
146124800 |
|
|
91233246 |
omerb.zeybek |
F |
Aug. 28, 2020, 5:35 p.m. |
OK |
MS C++ 2017 |
TESTS |
24 |
1622 |
26931200 |
|
|
90324911 |
NocturneBflat |
F |
Aug. 18, 2020, 3:54 p.m. |
OK |
PyPy 3 |
TESTS |
24 |
1528 |
148377600 |
|
|
90312250 |
gazaan |
F |
Aug. 18, 2020, 1:35 p.m. |
OK |
Scala |
TESTS |
24 |
1201 |
63897600 |
|
|
remove filters
Back to search problems