https://www.codechef.com/problems/FGFS Bon appetit problem codechef


here is my solution .
why i am getting wrong answer

@Avishek-Kumar-2445349249011561
I was unable to understand your approach but this is a simple multi activity selection problem. Please explain your approach so that I can understand it better.

giving prefrence to customer whose deparature time is less.

for this first of all sorting array of restaurant(as per my code) according to compare function,in which if desired compartment is same then the customer with less deparature time is coming first after other and if compartment is different then customer whose compartment value is less coming first after other after sorting

after sorting traversing through out the array and if compartment is same and if deparature time of ith customer is less than or equal to arrival time of i+1 th customer then increasing the count value by one

@Avishek-Kumar-2445349249011561
Your code and logic both seem perfect
Still getting WA and unfortunately I was unable to figure out the error
I have this code which is very similar to yours
So please cross verify your approach with this once
https://www.codechef.com/viewsolution/15589079

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.