#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
const int N = 1e5 + 5;
int n;
int s[4 * N], mn[4 * N], mx[4 * N];
void upd(int i, int x, int id = 1, int l = 1, int r = n) {
if (l == r) {
s[id] = mn[id] = mx[id] = x;
return;
}
int m = (l + r) / 2;
if (i <= m) {
upd(i, x, id * 2, l, m);
} else {
upd(i, x, id * 2 + 1, m + 1, r);
}
s[id] = s[id * 2] + s[id * 2 + 1];
mn[id] = min(mn[id * 2] + s[id * 2 + 1], mn[id * 2 + 1]);
mx[id] = max(mx[id * 2] + s[id * 2 + 1], mx[id * 2 + 1]);
}
int main() {
ios::sync_with_stdio(false); cin.tie(nullptr);
cin >> n;
for (int i = 0; i < n; ++i) {
int r, s; cin >> r >> s;
upd(r, s == 1 ? 1 : -1);
cout << (mx[1] <= 0 ? '<' : (mn[1] >= 0 ? '>' : '?')) << "\n";
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
464 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
2 ms |
860 KB |
Output is correct |
11 |
Correct |
16 ms |
2396 KB |
Output is correct |
12 |
Correct |
27 ms |
4372 KB |
Output is correct |
13 |
Correct |
24 ms |
4444 KB |
Output is correct |
14 |
Correct |
25 ms |
4436 KB |
Output is correct |
15 |
Correct |
27 ms |
4436 KB |
Output is correct |
16 |
Correct |
27 ms |
4432 KB |
Output is correct |
17 |
Correct |
23 ms |
4436 KB |
Output is correct |
18 |
Correct |
27 ms |
4436 KB |
Output is correct |
19 |
Correct |
25 ms |
4252 KB |
Output is correct |
20 |
Correct |
23 ms |
4436 KB |
Output is correct |
21 |
Correct |
26 ms |
4460 KB |
Output is correct |
22 |
Correct |
24 ms |
4436 KB |
Output is correct |
23 |
Correct |
23 ms |
4444 KB |
Output is correct |
24 |
Correct |
24 ms |
4356 KB |
Output is correct |
25 |
Correct |
23 ms |
4448 KB |
Output is correct |