#include <iostream>
using namespace std;
const int N = 1e5 + 10;
int n, x, y;
struct SEG {
int val[N << 2], lazy[N << 2];
void down(int id) {
int lz = lazy[id];
if (lz == 0) return;
val[id << 1] += lz;
lazy[id << 1] += lz;
val[id << 1 | 1] += lz;
lazy[id << 1 | 1] += lz;
lazy[id] = 0;
}
void update(int l, int r, int u, int v, int VAL, int id) {
if (l > v || r < u) return;
if (l >= u && r <= v) {
val[id] += VAL;
lazy[id] += VAL;
return;
}
int mid = (l + r) >> 1;
down(id);
update(l, mid, u, v, VAL, id << 1);
update(mid + 1, r, u, v, VAL, id << 1 | 1);
val[id] = min(val[id << 1], val[id << 1 | 1]);
}
} one, two;
int main() {
cin.tie(0); cout.tie(0);
ios_base::sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; ++i) {
cin >> x >> y;
if (y == 1) {
one.update(1, n, 1, x, 1, 1);
two.update(1, n, 1, x, -1, 1);
} else {
one.update(1, n, 1, x, -1, 1);
two.update(1, n, 1, x, 1, 1);
}
if (one.val[1] >= 0) cout << ">\n";
else if (two.val[1] >= 0) cout << "<\n";
else cout << "?\n";
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |