-
Notifications
You must be signed in to change notification settings - Fork 0
/
D.cpp
44 lines (42 loc) · 862 Bytes
/
D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
int main()
{
fastio;
long long q,l,r,i,cnt=0;
char op;
map<pair<long long,long long>,long long> mp;
multiset<long long> ml,mr;
cin>>q;
while(q--)
{
cin>>op>>l>>r;
if(op=='+')
{
mp[{l,r}]++;
if(mp[{l,r}]==1)
cnt++;
ml.insert(l);
mr.insert(r);
}
else
{
mp[{l,r}]--;
if(mp[{l,r}]==0)
cnt--;
ml.erase(ml.find(l));
mr.erase(mr.find(r));
}
if(cnt<=1)
{
cout<<"NO\n";
continue;
}
if(*(mr.begin())<*(ml.rbegin()))
cout<<"YES\n";
else
cout<<"NO\n";
}
return 0;
}