#include <bits/stdc++.h>
#define Fname ""
using namespace std;
const int MaxN = 8e5 + 17, INF = 1e9 + 17, Mod = 1e9 + 7;
int n, x, y;
struct node
{
int Max;
int Min;
int add;
node (int X = INF)
{
Max = -X;
Min = X;
add = 0;
}
} t[MaxN];
void push (int v)
{
if (t[v].add)
{
t[v].Max += t[v].add;
t[v].Min += t[v].add;
t[v + v].add += t[v].add;
t[v + v + 1].add += t[v].add;
}
}
void build (int v, int l, int r)
{
if (l == r)
t[v].Max = 0, t[v].Min = 0;
else
{
int m = (l + r) >> 1;
build (v + v, l, m);
build (v + v + 1, m + 1, r);
t[v].Max = 0;
t[v].Min = 0;
}
}
void upd (int v, int l, int r, int L, int R, int val)
{
push (v);
if (l > R || r < L)
return;
if (L <= l && r <= R)
{
t[v].add = val;
push (v);
return;
}
int m = (l + r) >> 1;
upd (v + v, l, m, L, R, val);
upd (v + v + 1, m + 1, r, L, R, val);
t[v].Max = max (t[v + v].Max, t[v + v + 1].Max);
t[v].Min = min (t[v + v].Min, t[v + v + 1].Min);
}
int main ()
{
#ifdef Elibay
freopen (".in", "r", stdin);
#endif
scanf ("%d", &n);
build (1, 1, n);
for (int i = 1; i <= n; ++ i)
{
scanf ("%d%d", &x, &y);
int Mx = t[1].Max;
int My = t[1].Min;
if (y == 2)
upd (1, 1, n, 1, x, -1);
else
upd (1, 1, n, 1, x, 1);
Mx = t[1].Max;
My = t[1].Min;
if (Mx > 0 && My >= 0)
puts (">");
else if (Mx <= 0 && My < 0)
puts ("<");
else
puts ("?");
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
11096 KB |
Output isn't correct - 5th words differ - expected: '?', found: '<' |
2 |
Incorrect |
3 ms |
11096 KB |
Output isn't correct - 6th words differ - expected: '?', found: '>' |
3 |
Incorrect |
0 ms |
11096 KB |
Output isn't correct - 2nd words differ - expected: '<', found: '?' |
4 |
Incorrect |
3 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '>' |
5 |
Incorrect |
0 ms |
11096 KB |
Output isn't correct - 11th words differ - expected: '<', found: '?' |
6 |
Incorrect |
0 ms |
11096 KB |
Output isn't correct - 6th words differ - expected: '<', found: '?' |
7 |
Incorrect |
3 ms |
11096 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
8 |
Incorrect |
0 ms |
11096 KB |
Output isn't correct - 9th words differ - expected: '<', found: '?' |
9 |
Incorrect |
3 ms |
11096 KB |
Output isn't correct - 5th words differ - expected: '>', found: '?' |
10 |
Incorrect |
6 ms |
11096 KB |
Output isn't correct - 8th words differ - expected: '?', found: '<' |
11 |
Incorrect |
42 ms |
11096 KB |
Output isn't correct - 4th words differ - expected: '?', found: '<' |
12 |
Incorrect |
74 ms |
11096 KB |
Output isn't correct - 25193rd words differ - expected: '<', found: '?' |
13 |
Incorrect |
69 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '<', found: '?' |
14 |
Incorrect |
73 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '>', found: '?' |
15 |
Incorrect |
74 ms |
11096 KB |
Output isn't correct - 17th words differ - expected: '<', found: '?' |
16 |
Incorrect |
72 ms |
11096 KB |
Output isn't correct - 9th words differ - expected: '?', found: '>' |
17 |
Incorrect |
78 ms |
11096 KB |
Output isn't correct - 3rd words differ - expected: '?', found: '>' |
18 |
Incorrect |
85 ms |
11096 KB |
Output isn't correct - 9th words differ - expected: '<', found: '?' |
19 |
Incorrect |
77 ms |
11096 KB |
Output isn't correct - 17th words differ - expected: '?', found: '<' |
20 |
Incorrect |
78 ms |
11096 KB |
Output isn't correct - 8th words differ - expected: '?', found: '<' |
21 |
Incorrect |
75 ms |
11096 KB |
Output isn't correct - 11th words differ - expected: '?', found: '>' |
22 |
Incorrect |
70 ms |
11096 KB |
Output isn't correct - 2nd words differ - expected: '>', found: '?' |
23 |
Incorrect |
70 ms |
11096 KB |
Output isn't correct - 7th words differ - expected: '?', found: '>' |
24 |
Incorrect |
76 ms |
11096 KB |
Output isn't correct - 4th words differ - expected: '>', found: '?' |
25 |
Incorrect |
80 ms |
11096 KB |
Output isn't correct - 4th words differ - expected: '>', found: '?' |