include iostream include limits include vector int max int int return

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#include <iostream>
#include <limits>
#include <vector>
int max(int a, int b){
return (a>b)?(a):(b);
}
int min(int a, int b){
return (b>a)?(a):(b);
}
struct triple_t{
int first = 0;
int second = 0;
int third = 0;
triple_t() = default;
};
//constexpr auto neutral = {std::numeric_limits<int>::min(), 0};
class SegmentTree_t {
public:
std::vector<triple_t> tr;
size_t sz;
SegmentTree_t(size_t sz): sz(sz){
tr = std::vector<triple_t>(4*sz);
}
void rec_update(size_t i, size_t q_left_b, size_t q_right_b, size_t n_left_b, size_t n_right_b, int delta){
if (q_right_b < n_left_b || q_left_b > n_right_b){
return;
}
if (q_left_b <= n_left_b && n_right_b <= q_right_b){
(tr[i]).first += delta;
(tr[i].second) += delta;
(tr[i].third) += delta;
return;
}
size_t m = (n_left_b + n_right_b) >> 1;
rec_update(2*i, q_left_b, q_right_b, n_left_b, m, delta);
rec_update(2*i + 1, q_left_b, q_right_b, m + 1, n_right_b, delta);
int min_ = min(tr[2*i].first, tr[2*i + 1].first);
int max_ = max(tr[2*i].second, tr[2*i + 1].second);
tr[i].first = min_ + tr[i].third;
tr[i].second = max_ + tr[i].third;
}
void update(size_t l, int delta){
rec_update(1, l, sz, 1, sz, delta);
}
};
int main(void){
int n = 0;
std::cin >> n;
int num = 0, side = 0;
auto t = SegmentTree_t(n);
for (int i = 0; i < n; ++i){
std::cin >> num >> side;
if (side == 1) t.update(n + 1 - num, 1);
if (side == 2) t.update(n + 1 - num, -1);
if (t.tr[1].first >= 0) std::cout << ">\n";
else if (t.tr[1].second <= 0) std::cout << "<\n";
else std::cout << "?\n";
}
return 0;
}