#include<bits/stdc++.h>
using namespace std;
int maxi[400001];
int mini[400001];
int lp[400001];
const int k=(1<<17);
void pushlazy(int cur) {
if(cur>=k) {
return;
}
maxi[cur*2]+=lp[cur];
maxi[cur*2+1]+=lp[cur];
mini[cur*2]+=lp[cur];
mini[cur*2+1]+=lp[cur];
lp[cur*2]+=lp[cur];
lp[cur*2+1]+=lp[cur];
lp[cur]=0;
return;
}
void upd(int from,int to,int val,int cur=1,int beg=0,int en=k-1) {
pushlazy(cur);
if(to<beg || from>en)return;
if(from<=beg && en<=to) {
lp[cur]+=val;
maxi[cur]+=val;
mini[cur]+=val;
pushlazy(cur);
return;
}
int mid=(beg+en)/2;
upd(from,to,val,cur*2,beg,mid);
upd(from,to,val,cur*2+1,mid+1,en);
mini[cur]=min(mini[cur*2],mini[cur*2+1]);
maxi[cur]=max(maxi[cur*2],maxi[cur*2+1]);
return;
}
int main() {
int n;cin>>n;
for(int i=0;i<n;i++) {
int x,r;cin>>x>>r;
if(r==1)upd(0,x,1);
else upd(0,x,-1);
if(maxi[1]<=0)cout<<"<"<<endl;
else if(mini[1]>=0)cout<<">"<<endl;
else cout<<"?"<<endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
2 ms |
340 KB |
Output is correct |
7 |
Correct |
3 ms |
340 KB |
Output is correct |
8 |
Correct |
3 ms |
468 KB |
Output is correct |
9 |
Correct |
2 ms |
468 KB |
Output is correct |
10 |
Correct |
18 ms |
688 KB |
Output is correct |
11 |
Correct |
109 ms |
2252 KB |
Output is correct |
12 |
Correct |
176 ms |
3288 KB |
Output is correct |
13 |
Correct |
191 ms |
3660 KB |
Output is correct |
14 |
Correct |
188 ms |
3688 KB |
Output is correct |
15 |
Correct |
189 ms |
3592 KB |
Output is correct |
16 |
Correct |
200 ms |
3668 KB |
Output is correct |
17 |
Correct |
188 ms |
3680 KB |
Output is correct |
18 |
Correct |
187 ms |
3652 KB |
Output is correct |
19 |
Correct |
200 ms |
3696 KB |
Output is correct |
20 |
Correct |
190 ms |
3676 KB |
Output is correct |
21 |
Correct |
193 ms |
3648 KB |
Output is correct |
22 |
Correct |
195 ms |
3732 KB |
Output is correct |
23 |
Correct |
277 ms |
3660 KB |
Output is correct |
24 |
Correct |
189 ms |
3688 KB |
Output is correct |
25 |
Correct |
193 ms |
3676 KB |
Output is correct |