+ محدودیت زمان: ۱ ثانیه
+ محدودیت حافظه: ۲۵۶ مگابایت
----------
Fast-forward to 2031, when (fingers-crossed!) UTCPC has long been a competition that happens in a real physical location, and not just a boring online contest anymore. Shayan and Soroush are thinking about the logistics of organizing next year’s UTCPC 2032: among many other things, they have to rent a building big enough to accommodate everyone!
In order to rent a space of the right size, they want to know the maximum number of people who will be present at the same time on that day. Since they cannot predict the future, they decide to look at data from last year’s event. Unfortunately, no one recorded this exact information, but luckily, at the entrance, there was a turnstile that continuously logged the entry and exit of the people (without authenticating them).
Because of a timezone bug on the turnstiles, the events log is in a weird random order. However, the raw timestamp of each event was preserved correctly. Help organize a successful UTCPC 2032 by calculating, starting from this raw data, the maximum number of people that were in the building at any given time during the last UTCPC!
# input
The first line contains the integer $n$, the total number of events registered by the turnstiles.
The next $n$ lines contain two integers $x_i$ and $y_i$ respectively: the type of event('1' if a person enters, and '-1' if a person exits) and the exact second at which the event was registered.
$$1 \leq n \leq 10^5$$
$$0 \leq y_i \leq 10^6$$
+ $n$ is always even: no one can leave before entering, and all attendees will leave before the end of the event.
+ If a person leaves the building at the exact same second when another person is entering, they
are not counted as being at the event at the same time.
# output
You need to write a single line containing the maximum number of people who were present at the event at the same time that day
# example
### sample input 1
```
4
1 3
1 2
-1 4
-1 5
```
### sample output 1
```
2
```
### sample input 2
```
4
1 0
1 1
-1 1
-1 2
```
### sample output 2
```
1
```
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.