#include<bits/stdc++.h>
#define meta int tm = tl + (tr - tl) / 2, x = (i << 1) + 1, y = x + 1
using namespace std;
const int maxn = 1e5 + 1;
int st[maxn * 4 + 1] {}, mn[maxn * 4 + 1] {}, mx[maxn * 4 + 1] {};
void update(int i, int tl, int tr, int X, int v) {
if(tl == tr) {
st[i] = mn[i] = mx[i] = v;
return;
}
meta;
if(X <= tm) update(x, tl, tm, X, v);
else update(y, tm + 1, tr, X, v);
st[i] = st[x] + st[y];
mn[i] = min(mn[x] + st[y], mn[y]);
mx[i] = max(mx[x] + st[y], mx[y]);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for(int i = 0; i < n; i++) {
int a, t;
cin >> a >> t;
a--;
if(t == 1) update(0, 0, n - 1, a, 1);
else update(0, 0, n - 1, a, -1);
if(mx[0] <= 0) cout << '<' << '\n';
else if(mn[0] >= 0) cout << '>' << '\n';
else cout << '?' << '\n';
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
4432 KB |
Output is correct |
2 |
Correct |
1 ms |
4432 KB |
Output is correct |
3 |
Correct |
1 ms |
4432 KB |
Output is correct |
4 |
Correct |
1 ms |
4432 KB |
Output is correct |
5 |
Correct |
1 ms |
4432 KB |
Output is correct |
6 |
Correct |
1 ms |
4432 KB |
Output is correct |
7 |
Correct |
1 ms |
4432 KB |
Output is correct |
8 |
Correct |
1 ms |
4432 KB |
Output is correct |
9 |
Correct |
1 ms |
4432 KB |
Output is correct |
10 |
Correct |
4 ms |
4856 KB |
Output is correct |
11 |
Correct |
17 ms |
5124 KB |
Output is correct |
12 |
Correct |
27 ms |
5456 KB |
Output is correct |
13 |
Correct |
24 ms |
5712 KB |
Output is correct |
14 |
Correct |
25 ms |
5880 KB |
Output is correct |
15 |
Correct |
30 ms |
5636 KB |
Output is correct |
16 |
Correct |
25 ms |
5704 KB |
Output is correct |
17 |
Correct |
25 ms |
5700 KB |
Output is correct |
18 |
Correct |
26 ms |
5712 KB |
Output is correct |
19 |
Correct |
30 ms |
5712 KB |
Output is correct |
20 |
Correct |
25 ms |
5712 KB |
Output is correct |
21 |
Correct |
25 ms |
5716 KB |
Output is correct |
22 |
Correct |
26 ms |
5696 KB |
Output is correct |
23 |
Correct |
25 ms |
5712 KB |
Output is correct |
24 |
Correct |
25 ms |
5712 KB |
Output is correct |
25 |
Correct |
25 ms |
5704 KB |
Output is correct |