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'There is a fun game where you need to feed cats that come and go. The level of the game consists of n steps. There are m cats; the cat i is present in steps from l_i to r_i , inclusive. In each step, you can feed all the cats that are currently present or do nothing. If you feed the same cat more than once, it will overeat, and you will immediately lose the game. Your goal is to feed as many cats as possible without causing any cat to overeat. Find the maximum number of cats you can feed. Formally, you need to select several integer points from the segment from 1 to n in such a way that among given segments, none covers two or more of the selected points, and as many segments as possible cover one of the selected points. The first line of input contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. Then the descriptions of the test cases follow. The first line of each test case contains two integers n and m ( 1 <= n <= 10^6 , 1 <= m <= 2 cdot 10^5 ). The i -th of the next m lines contains a pair of integers l_i and r_i ( 1 <= l_i <= r_i <= n ). The sum of n for all tests does not exceed 10^6 , the sum of m for all tests does not exceed 2 cdot 10^5 . For each test case, print a single integer, the maximum number of cats you can feed. In the first example, one of the ways to feed five cats is to feed at steps 4 and 11 . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
247213356 |
mban259 |
F |
Feb. 19, 2024, 1:43 p.m. |
OK |
C# 10 |
TESTS |
25 |
608 |
75468800 |
|
|
247415403 |
BBD186587 |
F |
Feb. 20, 2024, 2:39 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
108 |
28057600 |
|
|
247195165 |
mr.tj.mr |
F |
Feb. 19, 2024, 11:23 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
109 |
16076800 |
|
|
247183174 |
hht2005 |
F |
Feb. 19, 2024, 9:37 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
109 |
20070400 |
|
|
247412795 |
tnakao |
F |
Feb. 20, 2024, 1:57 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
124 |
11980800 |
|
|
247187108 |
Rhyme3 |
F |
Feb. 19, 2024, 10:10 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
140 |
11980800 |
|
|
247210400 |
jahid_hridoy |
F |
Feb. 19, 2024, 1:23 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
140 |
12083200 |
|
|
247189801 |
_winprn |
F |
Feb. 19, 2024, 10:33 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
140 |
13619200 |
|
|
247184318 |
jhdonghj112 |
F |
Feb. 19, 2024, 9:46 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
155 |
13926400 |
|
|
247202025 |
snavneet561 |
F |
Feb. 19, 2024, 12:21 p.m. |
OK |
GNU C++17 |
TESTS |
25 |
155 |
24064000 |
|
|
247155608 |
Pankaj777 |
F |
Feb. 19, 2024, 4:46 a.m. |
OK |
GNU C++17 |
TESTS |
25 |
155 |
27238400 |
|
|
247186647 |
a999999 |
F |
Feb. 19, 2024, 10:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
46 |
13004800 |
|
|
247426074 |
Marve197 |
F |
Feb. 20, 2024, 5:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
12083200 |
|
|
247218573 |
Tiny_Snow |
F |
Feb. 19, 2024, 2:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
13619200 |
|
|
247414265 |
OneSheeep |
F |
Feb. 20, 2024, 2:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
16076800 |
|
|
247186580 |
oloy |
F |
Feb. 19, 2024, 10:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
17612800 |
|
|
247408018 |
itsQuang |
F |
Feb. 20, 2024, 12:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
24064000 |
|
|
247178902 |
Yshanqian |
F |
Feb. 19, 2024, 9:04 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
93 |
24064000 |
|
|
247179861 |
Camellia_Tsubaki |
F |
Feb. 19, 2024, 9:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
108 |
6656000 |
|
|
247407853 |
itsQuang |
F |
Feb. 20, 2024, 12:23 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
108 |
24064000 |
|
|
247150489 |
Chrisedyong |
F |
Feb. 19, 2024, 3:37 a.m. |
OK |
GNU C++17 (64) |
TESTS |
25 |
109 |
11980800 |
|
|
247277334 |
Shrut1nayak |
F |
Feb. 19, 2024, 3:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
62 |
16998400 |
|
|
247208560 |
TaoTaoYa |
F |
Feb. 19, 2024, 1:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
62 |
20070400 |
|
|
247207734 |
huanhuanonly |
F |
Feb. 19, 2024, 1:04 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
77 |
12083200 |
|
|
247407762 |
TimZheng |
F |
Feb. 20, 2024, 12:21 a.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
77 |
16076800 |
|
|
247419638 |
lingyaoluo |
F |
Feb. 20, 2024, 3:35 a.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
12083200 |
|
|
247385518 |
Ali_Sensei |
F |
Feb. 19, 2024, 6:53 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
12083200 |
|
|
247180591 |
ttamx |
F |
Feb. 19, 2024, 9:17 a.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
12083200 |
|
|
247171758 |
Sjwen |
F |
Feb. 19, 2024, 8:08 a.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
12083200 |
|
|
247312183 |
xpact_chaos |
F |
Feb. 19, 2024, 3:37 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
16076800 |
|
|
247238638 |
tlsgusrb314 |
F |
Feb. 19, 2024, 2:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
25 |
78 |
16998400 |
|
|
247159863 |
0x3F |
F |
Feb. 19, 2024, 5:30 a.m. |
OK |
Go |
TESTS |
25 |
249 |
55193600 |
|
|
247160089 |
0x3F |
F |
Feb. 19, 2024, 5:32 a.m. |
OK |
Go |
TESTS |
25 |
264 |
55193600 |
|
|
247210118 |
black_rise |
F |
Feb. 19, 2024, 1:21 p.m. |
OK |
Java 21 |
TESTS |
25 |
296 |
10240000 |
|
|
247131460 |
Utsav82 |
F |
Feb. 18, 2024, 6:33 p.m. |
OK |
Java 21 |
TESTS |
25 |
358 |
49868800 |
|
|
247405126 |
cpp10 |
F |
Feb. 19, 2024, 11:16 p.m. |
OK |
Java 21 |
TESTS |
25 |
405 |
21504000 |
|
|
247405156 |
cpp10 |
F |
Feb. 19, 2024, 11:16 p.m. |
OK |
Java 21 |
TESTS |
25 |
421 |
21299200 |
|
|
247132140 |
vaibhav_1710 |
F |
Feb. 18, 2024, 6:41 p.m. |
OK |
Java 21 |
TESTS |
25 |
436 |
9728000 |
|
|
247139687 |
SweetAsCocaine |
F |
Feb. 18, 2024, 8:01 p.m. |
OK |
Java 21 |
TESTS |
25 |
436 |
13004800 |
|
|
247131686 |
AKhacks |
F |
Feb. 18, 2024, 6:36 p.m. |
OK |
Java 21 |
TESTS |
25 |
576 |
21196800 |
|
|
247126081 |
BlizGale |
F |
Feb. 18, 2024, 5:47 p.m. |
OK |
Java 21 |
TESTS |
25 |
592 |
12902400 |
|
|
247201888 |
santanu021 |
F |
Feb. 19, 2024, 12:20 p.m. |
OK |
Java 21 |
TESTS |
25 |
732 |
32460800 |
|
|
247189880 |
KYNick |
F |
Feb. 19, 2024, 10:34 a.m. |
OK |
Java 21 |
TESTS |
25 |
967 |
86220800 |
|
|
247417125 |
RahulAhuja2901 |
F |
Feb. 20, 2024, 3:03 a.m. |
OK |
Java 8 |
TESTS |
25 |
311 |
31334400 |
|
|
247417201 |
RahulAhuja2901 |
F |
Feb. 20, 2024, 3:04 a.m. |
OK |
Java 8 |
TESTS |
25 |
358 |
31334400 |
|
|
247202019 |
wat2 |
F |
Feb. 19, 2024, 12:21 p.m. |
OK |
Java 8 |
TESTS |
25 |
421 |
59596800 |
|
|
247211313 |
ygming |
F |
Feb. 19, 2024, 1:29 p.m. |
OK |
Java 8 |
TESTS |
25 |
530 |
71884800 |
|
|
247132406 |
MintCat |
F |
Feb. 18, 2024, 6:43 p.m. |
OK |
Java 8 |
TESTS |
25 |
623 |
35840000 |
|
|
247419270 |
GR1ZLER |
F |
Feb. 20, 2024, 3:30 a.m. |
OK |
Java 8 |
TESTS |
25 |
1279 |
85094400 |
|
|
247125527 |
formidablechief27 |
F |
Feb. 18, 2024, 5:41 p.m. |
OK |
Java 8 |
TESTS |
25 |
1965 |
205004800 |
|
|
247180484 |
Sumitsingh7 |
F |
Feb. 19, 2024, 9:17 a.m. |
OK |
Java 8 |
TESTS |
25 |
2074 |
484454400 |
|
|
247135428 |
YMSeah |
F |
Feb. 18, 2024, 7:14 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1138 |
122777600 |
|
|
247135339 |
YMSeah |
F |
Feb. 18, 2024, 7:13 p.m. |
OK |
PyPy 3 |
TESTS |
25 |
1606 |
122982400 |
|
|
247426967 |
find |
F |
Feb. 20, 2024, 5:12 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
186 |
28672000 |
|
|
247425694 |
sushmanth.dampur8780 |
F |
Feb. 20, 2024, 4:58 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
218 |
29081600 |
|
|
247172624 |
Little_Sheep_Yawn |
F |
Feb. 19, 2024, 8:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
295 |
34816000 |
|
|
247134802 |
zouyu9631 |
F |
Feb. 18, 2024, 7:08 p.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
296 |
35532800 |
|
|
247150426 |
mikeac |
F |
Feb. 19, 2024, 3:35 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
530 |
84377600 |
|
|
247153348 |
hushbek_2009 |
F |
Feb. 19, 2024, 4:15 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
546 |
101376000 |
|
|
247158842 |
StanMarsh-SP |
F |
Feb. 19, 2024, 5:19 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
576 |
102400000 |
|
|
247158565 |
StanMarsh-SP |
F |
Feb. 19, 2024, 5:16 a.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
624 |
101888000 |
|
|
247133042 |
Quick-One |
F |
Feb. 18, 2024, 6:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
935 |
84480000 |
|
|
247226059 |
Sam_Jiang |
F |
Feb. 19, 2024, 2:37 p.m. |
OK |
PyPy 3-64 |
TESTS |
25 |
935 |
104448000 |
|
|
247130119 |
OLOGY |
F |
Feb. 18, 2024, 6:21 p.m. |
OK |
Python 2 |
TESTS |
25 |
1122 |
51200000 |
|
|
247128149 |
OLOGY |
F |
Feb. 18, 2024, 6:05 p.m. |
OK |
Python 2 |
TESTS |
25 |
1185 |
55193600 |
|
|
247136605 |
MehraSaurav |
F |
Feb. 18, 2024, 7:26 p.m. |
OK |
Python 3 |
TESTS |
25 |
1496 |
64102400 |
|
|
247199945 |
robostac |
F |
Feb. 19, 2024, 12:03 p.m. |
OK |
Rust 2021 |
TESTS |
25 |
77 |
25292800 |
|
|
247148239 |
snamy520 |
F |
Feb. 18, 2024, 10:14 p.m. |
OK |
Rust 2021 |
TESTS |
25 |
187 |
21913600 |
|
|
247129199 |
red_tree |
F |
Feb. 18, 2024, 6:13 p.m. |
OK |
Rust 2021 |
TESTS |
25 |
218 |
67686400 |
|
|
remove filters
Back to search problems