#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define sz(x) (int)(x).size()
#define len(x) (int)(x).length()
#define cntbit(x) builtin_popcnt(x)
#define f first
#define s second
#define pb push_back
const int N = 1e5 + 100;
pair <int, int> seg[N * 4];
int laz[N * 4];
void push(int id) {
int t = laz[id];
laz[id * 2] += t;
laz[id * 2 + 1] += t;
seg[id * 2].f += t, seg[id * 2].s += t, seg[id * 2 + 1].f += t, seg[id * 2 + 1].s += t;
laz[id] = 0;
}
void upd(int id, int l, int r, int u, int v, int add) {
if (l > v || r < u)
return;
if (l >= u && r <= v) {
laz[id] += add;
seg[id].f += add, seg[id].s += add;
return;
}
push(id);
int m = (l + r) / 2;
upd(id * 2, l, m, u, v, add);
upd(id * 2 + 1, m + 1, r, u, v, add);
seg[id].f = max(seg[id * 2].f, seg[id * 2 + 1].f);
seg[id].s = min(seg[id * 2].s, seg[id * 2 + 1].s);
}
char check() {
if (seg[1].s >= 0) {
return '>';
}
if (seg[1].f <= 0) {
return '<';
}
return '?';
}
ll solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
int r, s;
cin >> r >> s;
r = n - r + 1;
if (s == 1) {
upd(1, 1, n, r, n, 1);
} else {
upd(1, 1, n, r, n, -1);
}
cout << check() << '\n';
}
return 0;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
while (t--) {
solve();
//cout << solve() << '\n';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
0 ms |
2400 KB |
Output is correct |
5 |
Correct |
1 ms |
2400 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
3 ms |
2652 KB |
Output is correct |
11 |
Correct |
20 ms |
5212 KB |
Output is correct |
12 |
Correct |
35 ms |
5460 KB |
Output is correct |
13 |
Correct |
52 ms |
5460 KB |
Output is correct |
14 |
Correct |
33 ms |
5460 KB |
Output is correct |
15 |
Correct |
37 ms |
5468 KB |
Output is correct |
16 |
Correct |
34 ms |
5572 KB |
Output is correct |
17 |
Correct |
33 ms |
5720 KB |
Output is correct |
18 |
Correct |
34 ms |
5636 KB |
Output is correct |
19 |
Correct |
33 ms |
5612 KB |
Output is correct |
20 |
Correct |
33 ms |
5656 KB |
Output is correct |
21 |
Correct |
33 ms |
5464 KB |
Output is correct |
22 |
Correct |
34 ms |
5468 KB |
Output is correct |
23 |
Correct |
34 ms |
5584 KB |
Output is correct |
24 |
Correct |
34 ms |
5460 KB |
Output is correct |
25 |
Correct |
39 ms |
5596 KB |
Output is correct |