DCP-64: Friendship Restaurant Back to All Problems

Easy Beginners Problems > Ad-hoc


Samiul and Ansary are best friends . They start catering business together after their graduation . They named their restaurant as Friendship Restaurant an ironic symbol of trust , respect and love between friends . But as a start up they have limited amount of money . Even they need to borrow tables everyday from Abir’s store house. Ansary has an imaginary fairy girlfriend who comes every night and tells him the arrival and leaving time of tomorrow’s customers . Customers don’t like to share a table with others. If there is no empty table when they arrive , they immediately leave the restaurant and may not come here again . So Samiul and Ansary must ensure a minimum number of tables are present in the restaurant so that at least one table is available for him/her on his/her arrival time .The same table can be used for non overlapping customers . Can you help them to ensure the minimum number of tables for tomorrow’s customer. Input: ------ Input starts with an integer **T ( T <= 30 )** denoting the number of test cases . Each case starts with a line containing an integer **n ( n <= 40 )** denoting number of customers . Each of the next n lines containing two integers **Ai and Li ( 1 <= Ai < Li <= 1000 )** denoting arrival time and leaving time of every customer . Output: ------- For each case, print the case number and the minimum number of table needs for tomorrow . Sample Input ------------ 2 2 1 3 3 5 4 1 10 10 20 11 21 3 5 Sample Output ------------- Case 1: 2 Case 2: 2


Problem Setter:

Shakil Ahmed

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 3.00
C++ 3.00
C++14 3.00
C# 5.00
Go 5.00
Java 5.00
JavaScript 5.00
Objective-C 5.00
Perl 5.00
PHP 5.00
Python 5.00
Python3 5.00
Ruby 5.00
VB.Net 5.00

Problem Stats

39/101

Solve/Submission

Ranking

# User Language Timing
01 tariqiitju Cpp14 0.00s
02 emrul Cpp14 0.00s
03 RafiulIslam_bd Cpp 0.00s
04 feodorv C 0.00s
05 rithu Cpp14 0.00s
06 pulak_ict_mbstu Cpp14 0.00s
07 haasib Cpp 0.00s
08 Morass Cpp14 0.00s
09 nazmul_bzs Cpp14 0.01s
10 souravahmed C 0.01s
11 showmic Cpp14 0.01s
12 RafiulIslam Cpp 0.01s
13 mahbub07 Cpp14 0.01s
14 Robbinb1993 Cpp 0.01s
15 devcoder CSharp 0.02s
16 Taj025 CSharp 0.02s
17 RandyWaterhouse Python3 0.06s
18 mhmbd CSharp 0.20s
19 smjlord068 Cpp14 0.25s
20 dmehrab06 Cpp14 0.25s
21 ih_hira Cpp14 0.27s
22 Skyfall009 Cpp14 0.43s
23 Pabon_SEC Cpp14 0.44s
24 SIR_MBSTU Cpp14 0.46s
25 aniscseiu Cpp14 0.47s
26 sohelcseiu Cpp14 0.48s
27 nafistiham Cpp14 0.49s
28 alhelal_cse Cpp14 0.50s
29 codehead Cpp14 0.50s
30 Outrage Cpp14 0.51s
31 murad_al_wajed Cpp14 0.51s
32 math10 Cpp14 0.52s
33 rayhan50001 Cpp14 0.55s
34 Mahmudul_Tushar Cpp14 0.58s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support