#include <bits/stdc++.h>
#define lsb(x) (x & (-x))
#define ll long long
#define ull unsigned long long
#define ld long double
// 217
// 44
using namespace std;
const int MAXN = (int) 1e5;
struct Aint {
int mn, mx;
int lazy;
}aint[4 * MAXN + 1];
inline void solve_lazy(int nod) {
if(2 * nod + 1 <= 4 * MAXN) {
aint[2 * nod].lazy += aint[nod].lazy;
aint[2 * nod + 1].lazy += aint[nod].lazy;
}
aint[nod].mn += aint[nod].lazy;
aint[nod].mx += aint[nod].lazy;
aint[nod].lazy = 0;
}
inline void refresh(int nod) {
if(2 * nod + 1 > 4 * MAXN) {
return ;
}
solve_lazy(2 * nod);
solve_lazy(2 * nod + 1);
aint[nod].mn = min(aint[2 * nod].mn, aint[2 * nod + 1].mn);
aint[nod].mx = max(aint[2 * nod].mx, aint[2 * nod + 1].mx);
}
void update(int nod, int left, int right, int l, int r, int val) {
solve_lazy(nod);
if(l <= left && right <= r) {
aint[nod].lazy += val;
solve_lazy(nod);
}
else {
int mid = (left + right) / 2;
if(l <= mid)
update(2 * nod, left, mid, l, r, val);
if(mid < r)
update(2 * nod + 1, mid + 1, right, l, r, val);
}
refresh(nod);
}
int main() {
//ifstream cin("A.in");
//ofstream cout("A.out");
int i, n;
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n;
for(i = 1; i <= n; i++) {
int r, s;
cin >> r >> s;
if(s == 1) {
update(1, 1, n, 1, r, 1);
}
else {
update(1, 1, n, 1, r, -1);
}
if(aint[1].mn >= 0) {
cout << '>';
}
else if(aint[1].mx <= 0) {
cout << '<';
}
else {
cout << '?';
}
cout << "\n";
}
//cin.close();
//cout.close();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
456 KB |
Output is correct |
3 |
Correct |
2 ms |
456 KB |
Output is correct |
4 |
Correct |
2 ms |
456 KB |
Output is correct |
5 |
Correct |
3 ms |
468 KB |
Output is correct |
6 |
Correct |
2 ms |
648 KB |
Output is correct |
7 |
Correct |
3 ms |
648 KB |
Output is correct |
8 |
Correct |
3 ms |
756 KB |
Output is correct |
9 |
Correct |
4 ms |
924 KB |
Output is correct |
10 |
Correct |
11 ms |
2272 KB |
Output is correct |
11 |
Correct |
53 ms |
6148 KB |
Output is correct |
12 |
Correct |
85 ms |
6744 KB |
Output is correct |
13 |
Correct |
74 ms |
7616 KB |
Output is correct |
14 |
Correct |
80 ms |
8356 KB |
Output is correct |
15 |
Correct |
74 ms |
9244 KB |
Output is correct |
16 |
Correct |
77 ms |
10060 KB |
Output is correct |
17 |
Correct |
72 ms |
10688 KB |
Output is correct |
18 |
Correct |
74 ms |
11460 KB |
Output is correct |
19 |
Correct |
74 ms |
12316 KB |
Output is correct |
20 |
Correct |
73 ms |
12960 KB |
Output is correct |
21 |
Correct |
74 ms |
13812 KB |
Output is correct |
22 |
Correct |
74 ms |
14676 KB |
Output is correct |
23 |
Correct |
73 ms |
15364 KB |
Output is correct |
24 |
Correct |
74 ms |
16076 KB |
Output is correct |
25 |
Correct |
74 ms |
16932 KB |
Output is correct |