#C1687. Unique Users in an Interval

    ID: 44919 Type: Default 1000ms 256MiB

Unique Users in an Interval

Unique Users in an Interval

You are given a list of events. Each event is represented by a user identifier (a string) and a timestamp (an integer). Your task is to count the number of unique users that have performed events within a specified time interval \([S, E)\).

Input Format: The first line contains an integer \(n\) representing the number of events. Each of the following \(n\) lines contains a user identifier and a timestamp separated by a space. The last line contains two integers \(S\) and \(E\), where \(S\) (inclusive) and \(E\) (exclusive) define the interval.

Output Format: Print a single integer, the count of distinct users whose event occurred in the interval \([S, E)\).

Note: An event is considered within the interval if its timestamp \(t\) satisfies \(S \leq t < E\).

inputFormat

The first line contains an integer \(n\), the number of events. The next \(n\) lines each contain a string and an integer separated by a space representing the user identifier and the timestamp of the event. The last line contains two integers \(S\) and \(E\) representing the start (inclusive) and end (exclusive) of the interval.

outputFormat

Output a single integer: the number of unique users who performed an event with a timestamp in the interval \([S, E)\).

## sample
5
user1 60
user2 120
user3 180
user1 240
user4 150
100 200
3