#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
int n, v[4*N][3], c[4*N];
void upd(int nd, int l, int r, int x, int y){
if(v[nd/2][2]!=0)
v[nd][2]+=v[nd/2][2], v[nd][1]+=v[nd/2][2], c[nd]+=v[nd/2][2];
if(l>x)
return;
if(r<=x){
v[nd][2]+=y;
v[nd][1]+=y, c[nd]+=y;
return;
}
int md=(l+r)/2;
upd(nd*2, l, md, x, y);
upd(nd*2+1, md+1, r, x, y);
v[nd][1]=max(v[nd*2][1], v[nd*2+1][1]);
c[nd]=min(c[nd*2], c[nd*2+1]);
v[nd][2]=0;
}
int main(){
cin>>n;
for(int i=1; i<=n; i++){
int x, y;
cin>>x>>y;
if(y==1)
upd(1, 1, n, x, -1);
else
upd(1, 1, n, x, 1);
if (v[1][1] <= 0)
cout<<">\n";
else if (c[1] >= 0)
cout<<"<\n";
else
cout<<"?\n";
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
6 ms |
376 KB |
Output is correct |
7 |
Correct |
6 ms |
248 KB |
Output is correct |
8 |
Correct |
7 ms |
368 KB |
Output is correct |
9 |
Correct |
7 ms |
376 KB |
Output is correct |
10 |
Correct |
37 ms |
888 KB |
Output is correct |
11 |
Correct |
219 ms |
2880 KB |
Output is correct |
12 |
Correct |
361 ms |
5456 KB |
Output is correct |
13 |
Correct |
376 ms |
5368 KB |
Output is correct |
14 |
Correct |
378 ms |
5412 KB |
Output is correct |
15 |
Correct |
394 ms |
5464 KB |
Output is correct |
16 |
Correct |
376 ms |
5496 KB |
Output is correct |
17 |
Correct |
400 ms |
5452 KB |
Output is correct |
18 |
Correct |
499 ms |
5484 KB |
Output is correct |
19 |
Correct |
377 ms |
5488 KB |
Output is correct |
20 |
Correct |
374 ms |
5440 KB |
Output is correct |
21 |
Correct |
371 ms |
5520 KB |
Output is correct |
22 |
Correct |
380 ms |
5368 KB |
Output is correct |
23 |
Correct |
376 ms |
5404 KB |
Output is correct |
24 |
Correct |
377 ms |
5420 KB |
Output is correct |
25 |
Correct |
379 ms |
5628 KB |
Output is correct |