The University of Iceland, being such a large and complicated establishment, frequently has to hold meetings. Tremendously many meetings take place on the university’s grounds and thus having a good system to plan all the meetings is critical. This is to make sure no one is double booked, since the medical department at the university unfortunately hasn’t quite gotten around to figuring out cloning yet. This system has to reject all booking requests that would create a conflict. The computer science department at the university had warned the ones in charge of planning this new planning system that anything to do with dates and computers is an absolute travesty to deal with, so they managed to convince them to measure all times in the system in the number of seconds since the system got booted.

Can you implement such a system?


The first line of the input contains one integer, $1 \leq q \leq 10^5$, the number of booking requests made. Next there are $q$ lines each containing a booking request. Each line contains three integers $1 \leq s, t_1, t_2 \leq 10^{18}$. This means the request is to invite the employee with identification number $s$ to a meeting from time $t1$ to time $t2$, both times being inclusive.


One line for each booking request, ‘Fundur bokadur’ (‘Meeting requested’ in Icelandic) if the employee is not already requested for a different meeting at that time or ‘Starfsmadur thegar a fundi’ (‘Employee already at a meeting’ in Icelandic) otherwise.

Sample Input 1 Sample Output 1
1 1000 5000
1 6000 10000
1 4000 7000
Fundur bokadur
Fundur bokadur
Starfsmadur er thegar a fundi
Sample Input 2 Sample Output 2
1 1000 10000
2 1000 10000
1 14000 16000
1 12000 18000
2 10001 20000
Fundur bokadur
Fundur bokadur
Fundur bokadur
Starfsmadur er thegar a fundi
Fundur bokadur
CPU Time limit 1 second
Memory limit 1024 MB
Languages English, Íslenska
Bergur Snorrason and Atli Fannar Franklín
Source Forritunarkeppni Háskóla Íslands 2019
License Creative Commons License (cc by-sa)

Please log in to submit a solution to this problem

Log in