AlgoUniversity
  • Go Back
Discussion
Minimum User Log :

Author

Manas

Difficulty Level : Medium

Submissions : 503

Asked In : PayPal

Marks :10

: 2 | : 0

Given list of strings which are logs and an integer representing maximum time, determine which user has activity time of less than or equal to the maximum time. Sort and return those list of users. (sort by user id).

Note:

- a user can have multiple sign in an sign-outs, however a sign out will occur only after a sign-in.

- The logs of users can be mixed, however for a given user the sign-out will occur after a corresponding sign-in in the lists

Input Example

logs : ["12 10 sign-in", "5 10 sign-in", "5 100 sign-out", "12 20 sign-out", "8 20 sign-in", "8 50 sign-out"]

maximumTime : 30

Constraints :

2 <= Size of log array (n) <= 2*10^5 (will be an even number)

1<= user_id <= n

1 <= time <= 10^9

1 <= maxTime <= 10^9

Input

First line contains an integer n and k denoting number of entries in the logs array and the maximumTime. The next n lines denote three space serrated values user_id (int) time (int) and a string (sign-in/sign-out) For any given user the sign-in time <= sign-out time

Output

output space separated integers denoting the user id's (in sorted order) who have a total activity time less than or equal to the maximumTIme. if there are no such users, print -1.

Example

Input
6 30
12 10 sign-in
5 10 sign-in
12 20 sign-out
5 100 sign-out
8 20 sign-in
8 20 sign-out
Output
8 12 

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.