#K13451. Notification Processing
Notification Processing
Notification Processing
You are given a list of notifications along with their timestamps. For each notification, determine whether to send it or ignore it. A notification should be sent if and only if there is no identical notification (i.e. same content) received within the last minutes. Otherwise, the notification should be ignored.
Formally, you are given two integers and , where is the number of notifications and is the time window in minutes. Then, you are given pairs , where is the timestamp (in minutes) and is the content of the notification. For each notification, before processing, remove any notification from memory with timestamp . If there exists a notification in memory with the same content , output "IGNORE"; otherwise, output "SEND" and add this notification into memory.
It is guaranteed that the notifications are given in increasing order of their timestamps.
Input is read from standard input and the output should be printed to standard output.
inputFormat
The first line contains two space-separated integers, and . The next lines each contain an integer and a string , representing the timestamp and the content of the notification.
outputFormat
For each notification, output either "SEND" or "IGNORE" on a separate line, according to the rules described above.## sample
5 10
1 Notification1
5 Notification2
8 Notification1
12 Notification3
15 Notification1
SEND
SEND
IGNORE
SEND
SEND
</p>