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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
1533
|
Kotlin Heroes: Episode 7 |
FINISHED |
False |
9000 |
106845899 |
June 29, 2021, 2:35 p.m. |
Problems
B"Vika has decided to go on a trip to Bertown. She comes to Bertown on the k -th day. Vika does not want to spend money on hotels, fortunately she has n friends who live in Bertown and allow Vika to stay at their houses. The i -th friend told Vika that she could stay at their house from the l_i -th day till the r_i -th day, inclusive. Vika decided that she would stay at no more than one friend's house. Help Vika determine the maximum number of days that she will be able to stay in Bertown. The first line contains a single integer t ( 1 <= t <= 500 ) -- the number of test cases. The first line of each test case contains two integers n and k ( 1 <= n, k <= 100 ) -- the number of Vika's friends and the day when Vika comes to Bertown. Then follow n lines, each containing two integers l_i and r_i ( 1 <= l_i <= r_i <= 100 ) denoting the period when Vika can stay at the i -th friend's house. For each test case, output a single integer -- the maximum number of days that Vika can stay in Bertown (or 0 if none of Vika's friends can host her on day k ). In the first example, Vika can stay at the 2 -nd friend's house from 3 -rd to 6 -th day. In the second example, none of Vika's friends can host her on the 4 -th day. In the third example, Vika can stay at the 1 -st friend's house, but only for the 4 -th day. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
120884308 |
Egor |
A |
June 29, 2021, 2:42 p.m. |
OK |
Kotlin |
TESTS |
5 |
93 |
0 |
|
|
120921354 |
Killer45 |
A |
June 30, 2021, 4:33 a.m. |
OK |
Kotlin |
TESTS |
5 |
108 |
0 |
|
|
120892910 |
skittles1412 |
A |
June 29, 2021, 4:03 p.m. |
OK |
Kotlin |
TESTS |
5 |
108 |
0 |
|
|
120884184 |
nuip |
A |
June 29, 2021, 2:41 p.m. |
OK |
Kotlin |
TESTS |
5 |
108 |
0 |
|
|
120884003 |
PugachAG |
A |
June 29, 2021, 2:40 p.m. |
OK |
Kotlin |
TESTS |
5 |
108 |
0 |
|
|
120896792 |
son8bon |
A |
June 29, 2021, 4:47 p.m. |
OK |
Kotlin |
TESTS |
5 |
109 |
0 |
|
|
120889668 |
EgorkA_82 |
A |
June 29, 2021, 3:28 p.m. |
OK |
Kotlin |
TESTS |
5 |
109 |
0 |
|
|
120888138 |
igm |
A |
June 29, 2021, 3:13 p.m. |
OK |
Kotlin |
TESTS |
5 |
109 |
0 |
|
|
120887315 |
zeptolab |
A |
June 29, 2021, 3:06 p.m. |
OK |
Kotlin |
TESTS |
5 |
109 |
0 |
|
|
120884653 |
alpha_107 |
A |
June 29, 2021, 2:44 p.m. |
OK |
Kotlin |
TESTS |
5 |
109 |
0 |
|
|
remove filters
Back to search problems