#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
const int mxN=1e5;
int n;
struct {
int mn[1<<18], mx[1<<18], lz[1<<18];
void psh(int u, int l, int r) {
if (lz[u]) {
mn[u]+=lz[u], mx[u]+=lz[u];
if (l!=r)
lz[2*u]+=lz[u], lz[2*u+1]+=lz[u];
lz[u]=0;
}
}
void upd(int ql, int qr, int x, int u=1, int l=0, int r=n-1) {
psh(u, l, r);
if (l>qr||r<ql)
return;
if (ql<=l&&r<=qr) {
lz[u]+=x;
psh(u, l, r);
return;
}
int mid=(l+r)/2;
upd(ql, qr, x, 2*u, l, mid);
upd(ql, qr, x, 2*u+1, mid+1, r);
mn[u]=min(mn[2*u], mn[2*u+1]);
mx[u]=max(mx[2*u], mx[2*u+1]);
}
} st;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int q=0; q<n; ++q) {
int i, t;
cin >> i >> t, --i;
st.upd(0, i, t==1?1:-1);
//cout << st.mx[1] << " " << st.mn[1] << "\n";
cout << (st.mx[1]>0?st.mn[1]<0?'?':'>':'<') << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Correct |
1 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
396 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
6 ms |
720 KB |
Output is correct |
11 |
Correct |
28 ms |
2388 KB |
Output is correct |
12 |
Correct |
45 ms |
4196 KB |
Output is correct |
13 |
Correct |
38 ms |
4300 KB |
Output is correct |
14 |
Correct |
40 ms |
4256 KB |
Output is correct |
15 |
Correct |
41 ms |
4328 KB |
Output is correct |
16 |
Correct |
41 ms |
4252 KB |
Output is correct |
17 |
Correct |
40 ms |
4264 KB |
Output is correct |
18 |
Correct |
40 ms |
4320 KB |
Output is correct |
19 |
Correct |
40 ms |
4300 KB |
Output is correct |
20 |
Correct |
40 ms |
4240 KB |
Output is correct |
21 |
Correct |
40 ms |
4252 KB |
Output is correct |
22 |
Correct |
42 ms |
4308 KB |
Output is correct |
23 |
Correct |
40 ms |
4280 KB |
Output is correct |
24 |
Correct |
42 ms |
4344 KB |
Output is correct |
25 |
Correct |
42 ms |
4264 KB |
Output is correct |