#include<bits/stdc++.h>
using namespace std;
const int N = 1e5 + 1;
int n;
vector<string> u = {">" , "<" , "?"};
struct node{
int mn = 0 , mx = 0 , lz = 0;
};
vector<node> t(4 * N);
void push(int u){
t[u * 2].mn += t[u].lz;
t[u * 2 + 1].mn += t[u].lz;
t[u * 2].mx += t[u].lz;
t[u * 2 + 1].mx += t[u].lz;
t[u * 2].lz += t[u].lz;
t[u * 2 + 1].lz += t[u].lz;
t[u].lz = 0;
}
void update(int u , int l , int r , int L , int R , int x){
if(l > r || r < L || l > R){
return;
}
if(L <= l && r <= R){
t[u].mn += x;
t[u].mx += x;
t[u].lz += x;
return;
}
push(u);
int m = (l + r) / 2;
update(u * 2 , l , m , L , R , x);
update(u * 2 + 1 , m + 1 , r , L , R , x);
t[u].mn = min(t[u * 2].mn , t[u * 2 + 1].mn);
t[u].mx = max(t[u * 2].mx , t[u * 2 + 1].mx);
}
int main(){
cin >> n;
for(int i = 1;i <= n;i ++){
int r , x;
cin >> r >> x;
update(1 , 1 , n , 1 , r , x == 1 ? 1 : -1);
if(t[1].mn >= 0){
cout << u[0] << endl;
continue;
}
if(t[1].mx <= 0){
cout << u[1] << endl;
continue;
}
cout << u[2] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
4956 KB |
Output is correct |
2 |
Correct |
1 ms |
4956 KB |
Output is correct |
3 |
Correct |
2 ms |
4956 KB |
Output is correct |
4 |
Correct |
1 ms |
5212 KB |
Output is correct |
5 |
Correct |
2 ms |
4956 KB |
Output is correct |
6 |
Correct |
2 ms |
4956 KB |
Output is correct |
7 |
Correct |
3 ms |
4956 KB |
Output is correct |
8 |
Correct |
3 ms |
5028 KB |
Output is correct |
9 |
Correct |
3 ms |
4956 KB |
Output is correct |
10 |
Correct |
14 ms |
5212 KB |
Output is correct |
11 |
Correct |
90 ms |
5468 KB |
Output is correct |
12 |
Correct |
136 ms |
5956 KB |
Output is correct |
13 |
Correct |
143 ms |
5968 KB |
Output is correct |
14 |
Correct |
144 ms |
5968 KB |
Output is correct |
15 |
Correct |
146 ms |
5968 KB |
Output is correct |
16 |
Correct |
147 ms |
5968 KB |
Output is correct |
17 |
Correct |
133 ms |
5908 KB |
Output is correct |
18 |
Correct |
151 ms |
5968 KB |
Output is correct |
19 |
Correct |
142 ms |
5968 KB |
Output is correct |
20 |
Correct |
148 ms |
5972 KB |
Output is correct |
21 |
Correct |
144 ms |
5972 KB |
Output is correct |
22 |
Correct |
143 ms |
5972 KB |
Output is correct |
23 |
Correct |
141 ms |
5968 KB |
Output is correct |
24 |
Correct |
150 ms |
6228 KB |
Output is correct |
25 |
Correct |
135 ms |
6032 KB |
Output is correct |