#include <bits/stdc++.h>
#define pb push_back
#define endl "\n"
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define fname ""
#define sz(x) (int)(x.size())
typedef long long ll;
using namespace std;
const ll N = (ll)(5e5) + 322;
const ll INF = (ll)(1e9);
const ll mod = (ll)(1e9) + 7;
const double eps = 1e-9;
int n, x[N], y[N], q, s, sum, mn, mx;
int add[N];
pair <int, int> t[N * 4];
void push(int x, int l, int r) {
if (add[x]) {
t[x].fi += add[x];
t[x].se += add[x];
if (l != r) {
add[x + x] += add[x];
add[x + x + 1] += add[x];
}
add[x] = 0;
}
}
void upd(int x, int tl, int tr, int l, int r, int val) {
push(x, tl, tr);
if (l <= tl && tr <= r) {
add[x] += val;
push(x, tl, tr);
return;
}
if (tl > r || tr < l) {
return;
}
int mid = (tl + tr) / 2;
upd(x + x, tl, mid, l, r, val);
upd(x + x + 1, mid + 1, tr, l, r, val);
t[x].fi = max(t[x + x].fi, t[x + x + 1].fi);
t[x].se = min(t[x + x].se, t[x + x + 1].se);
}
int main () {
//freopen(fname".in", "r", stdin);
//freopen(fname".out", "w", stdout);
scanf("%d", &n);
for (int i = 1; i <= n; ++i) {
scanf("%d%d", &q, &s);
if (s == 1) {
upd(1, 1, n, 1, q, 1);
}else {
upd(1, 1, n, 1, q, -1);
}
mx = t[1].fi;
mn = t[1].se;
if (mn < 0 && mx > 0) {
puts("?");
}
if (mn >= 0 && mx >= 0) {
puts(">");
}
if (mn <= 0 && mx <= 0) {
puts("<");
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
23220 KB |
Output is correct - 73 tokens |
2 |
Correct |
0 ms |
23220 KB |
Output is correct - 89 tokens |
3 |
Correct |
5 ms |
23220 KB |
Output is correct - 221 tokens |
4 |
Correct |
0 ms |
23220 KB |
Output is correct - 21 tokens |
5 |
Correct |
0 ms |
23220 KB |
Output is correct - 369 tokens |
6 |
Correct |
5 ms |
23220 KB |
Output is correct - 492 tokens |
7 |
Correct |
0 ms |
23220 KB |
Output is correct - 945 tokens |
8 |
Correct |
6 ms |
23220 KB |
Output is correct - 1237 tokens |
9 |
Correct |
0 ms |
23220 KB |
Output is correct - 1105 tokens |
10 |
Correct |
12 ms |
23220 KB |
Output is correct - 8921 tokens |
11 |
Correct |
43 ms |
23220 KB |
Output is correct - 56110 tokens |
12 |
Correct |
80 ms |
23220 KB |
Output is correct - 90207 tokens |
13 |
Correct |
71 ms |
23220 KB |
Output is correct - 100000 tokens |
14 |
Correct |
70 ms |
23220 KB |
Output is correct - 100000 tokens |
15 |
Correct |
67 ms |
23220 KB |
Output is correct - 100000 tokens |
16 |
Correct |
64 ms |
23220 KB |
Output is correct - 100000 tokens |
17 |
Correct |
68 ms |
23220 KB |
Output is correct - 100000 tokens |
18 |
Correct |
58 ms |
23220 KB |
Output is correct - 99999 tokens |
19 |
Correct |
65 ms |
23220 KB |
Output is correct - 99999 tokens |
20 |
Correct |
69 ms |
23220 KB |
Output is correct - 99999 tokens |
21 |
Correct |
79 ms |
23220 KB |
Output is correct - 100000 tokens |
22 |
Correct |
70 ms |
23220 KB |
Output is correct - 100000 tokens |
23 |
Correct |
78 ms |
23220 KB |
Output is correct - 100000 tokens |
24 |
Correct |
64 ms |
23220 KB |
Output is correct - 100000 tokens |
25 |
Correct |
68 ms |
23220 KB |
Output is correct - 100000 tokens |