#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORD(i, a, b) for(int i = a; i >= b; i--)
#define el '\n'
#define BIT(mask, i) (((mask) >> (i)) & 1)
#define MASK(i) (1LL << (i))
#define fi first
#define se second
template <class T1, class T2>
bool minimize(T1 &a, T2 b) {
if(a > b){a = b; return true;} return false;
}
template <class T1, class T2>
bool maximize(T1 &a, T2 b) {
if(a < b) {a = b; return true;} return false;
}
const int MOD = 1337377;
template <class T1, class T2>
void add(T1 &a, T2 b) {
a += b;
if(a >= MOD) a -= MOD;
}
const ll INF = (ll)1e18 + 10LL;
const int oo = (int)1e9 + 10;
const int MAX = (int)1e5 + 10;
const int LG = 18;
int numStone;
void init (void) {
cin >> numStone;
}
struct seg {
vector <int> minVal, maxVal, lazy;
seg (int n = 0) {
minVal.resize(n * 4 + 10, 0);
maxVal.resize(n * 4 + 10, 0);
lazy.resize(n * 4 + 10, 0);
}
void pushDown(int i) {
for(int t = i * 2; t <= i * 2 + 1; t++) {
minVal[t] += lazy[i];
maxVal[t] += lazy[i];
lazy[t] += lazy[i];
}
lazy[i] = 0;
}
void update(int u, int v, int c, int i = 1, int l = 1, int r = numStone) {
if (u > r || v < l) return;
if(u <= l && r <= v) {
minVal[i] += c;
maxVal[i] += c;
lazy[i] += c;
return;
}
pushDown(i);
int m = (l + r) >> 1;
update(u, v, c, i * 2, l, m);
update(u, v, c, i * 2 + 1, m + 1, r);
minVal[i] = min(minVal[i * 2], minVal[i * 2 + 1]);
maxVal[i] = max(maxVal[i * 2], maxVal[i * 2 + 1]);
}
};
void solve (void) {
seg it (numStone);
for(int i = 1; i <= numStone; i++) {
int rank, side;
cin >> rank >> side;
if(side == 1) it.update(1, rank, 1);
else it.update(1, rank, -1);
int ma = it.maxVal[1], mi = it.minVal[1];
if(ma <= 0) cout << '<' << el;
else if(mi >= 0) cout << '>' << el;
else cout << '?' << el;
}
}
int main (void) {
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define task "test"
int ntest = 1;
// cin >> ntest;
// srand(time(0));
while(ntest--) {
init();
solve();
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 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 |
344 KB |
Output is correct |
10 |
Correct |
5 ms |
860 KB |
Output is correct |
11 |
Correct |
24 ms |
3532 KB |
Output is correct |
12 |
Correct |
43 ms |
5332 KB |
Output is correct |
13 |
Correct |
35 ms |
6016 KB |
Output is correct |
14 |
Correct |
35 ms |
5980 KB |
Output is correct |
15 |
Correct |
35 ms |
5992 KB |
Output is correct |
16 |
Correct |
39 ms |
5968 KB |
Output is correct |
17 |
Correct |
37 ms |
6004 KB |
Output is correct |
18 |
Correct |
37 ms |
5984 KB |
Output is correct |
19 |
Correct |
35 ms |
5976 KB |
Output is correct |
20 |
Correct |
33 ms |
5984 KB |
Output is correct |
21 |
Correct |
35 ms |
6116 KB |
Output is correct |
22 |
Correct |
35 ms |
6116 KB |
Output is correct |
23 |
Correct |
36 ms |
5980 KB |
Output is correct |
24 |
Correct |
37 ms |
6008 KB |
Output is correct |
25 |
Correct |
38 ms |
6080 KB |
Output is correct |