#K13451. Notification Processing

    ID: 23915 Type: Default 1000ms 256MiB

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 MM minutes. Otherwise, the notification should be ignored.

Formally, you are given two integers NN and MM, where NN is the number of notifications and MM is the time window in minutes. Then, you are given NN pairs (ti,si)(t_i, s_i), where tit_i is the timestamp (in minutes) and sis_i is the content of the notification. For each notification, before processing, remove any notification from memory with timestamp tiM\leq t_i - M. If there exists a notification in memory with the same content sis_i, 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, NN and MM. The next NN lines each contain an integer tit_i and a string sis_i, 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>