#include <bits/stdc++.h>
using namespace std;
/// toto -> 1
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define io \
ios_base::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define all(a) a.begin(),a.end()
#define rep(k,i,n) for(int k=i;k<n;k++)
#define repp(k,i,n) for(int k=n-1;k>=i;k--)
#define rech(k) for(char k='a';k<='z';k++)
#define SZ(a) (int)a.size()
#define MX(a) *max_element(all(a))
#define MN(a) *min_element(all(a))
#define SM(a) accumulate(all(a),0LL)
#define vi vector<int>
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define vvi vector<vector<int>>
/// toto -> 2
const int mod = 1e9 + 7 , modd = 998244353;
void F1(bool res) {
if(res) {
cout<<"Yes\n" ;
}
else {
cout<<"No\n" ;
}
}
struct mint{
int val;
mint(int64_t v = 0) {
v %= mod;
if (v < 0) v += mod;
val = v;
}
mint& operator+=(const mint& other) {
val += other.val;
if (val >= mod) val -= mod;
return *this;
}
mint& operator-=(const mint& other) {
val += mod - other.val;
if (val >= mod) val -= mod;
return *this;
}
mint& operator*=(const mint& other) {
val = (int64_t)val * other.val % mod;
return *this;
}
mint& operator/=(const mint& other) {
return *this *= other.inv();
}
friend mint operator+(mint a, const mint& b) { return a += b; }
friend mint operator-(mint a, const mint& b) { return a -= b; }
friend mint operator*(mint a, const mint& b) { return a *= b; }
friend mint operator/(mint a, const mint& b) { return a /= b; }
mint pow(int64_t exp) const {
mint a = *this, res = 1;
while (exp > 0) {
if (exp & 1)
res *= a;
a *= a;
exp >>= 1;
}
return res;
}
mint inv() const {
assert(val != 0);
return pow(mod - 2);
}
friend ostream& operator<<(ostream& os, const mint& m) {
return os << m.val;
}
};
int bp(int n,int m){
if(m == 0){
return 1;
}
if(m == 1){
return n%mod;
}
if(m%2==0){
return bp(n*n%mod,m/2)%mod;
}
return n*bp(n,m-1)%mod;
}
typedef long long ll;
/// toto -> 3
const int N = 2e5 + 545, M = 1e6 + 5 , inf = 2e9 + 99;
const ll inff = 1e18 + 88;
struct pi{
ll mx , mn , mark , lazy;
};
pi tree[N*4];
void push(int v, int l, int r){
if(l == r){
tree[v].mark= 0;
tree[v].lazy = 0;
return;
}
if(tree[v].mark == 0){
return;
}
/// updateing value of lazy ...
tree[(v<<1)].mark = tree[(v<<1)+1].mark = 1;
tree[(v<<1)].lazy += tree[v].lazy;
tree[(v<<1)+1].lazy += tree[v].lazy;
tree[(v<<1)].mn += tree[v].lazy;
tree[(v<<1)].mx += tree[v].lazy;
tree[(v<<1)+1].mn += tree[v].lazy;
tree[(v<<1)+1].mx += tree[v].lazy;
tree[v].lazy = tree[v].mark = 0;
tree[v].mn = min(tree[(v<<1)].mn, tree[(v<<1)+1].mn);
tree[v].mx = max(tree[(v<<1)].mx, tree[(v<<1)+1].mx);
}
void update(int v,int l,int r,int ml,int mr,int val){
if(l > r || ml > r || l > mr){
return;
}
push(v,l,r);
if(ml <= l && r <= mr){
/// seting value
tree[v].mn += val;
tree[v].mx += val;
tree[v].mark = 1;
tree[v].lazy += val;
return;
}
int mid = (l+r)>>1;
update((v<<1) , l , mid , ml , mr , val);
update((v<<1)|1 , mid+1 , r , ml , mr , val);
tree[v].mn = min(tree[(v<<1)].mn, tree[(v<<1)+1].mn);
tree[v].mx = max(tree[(v<<1)].mx, tree[(v<<1)+1].mx);
}
void solve(){
int x , pos;
cin>>x>>pos;
update(1 , 1 , N ,1 , x , (pos == 1 ? -1 : 1));
ll mx = tree[1].mx , mn = tree[1].mn;
if(mn >= 0){
cout<<"<\n";
}
else if(mx <= 0){
cout<<">\n";
}
else{
cout<<"?\n";
}
}
int32_t main()
{
io;
ll t=1;
cin>>t;
rep(_,1,t+1)
{
cerr << "Start of test case " << _ << "\n";
///cout<<"Case #"<<_<<": ";
solve();
cerr << endl;
cerr << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
2 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
3 ms |
2396 KB |
Output is correct |
6 |
Correct |
4 ms |
4444 KB |
Output is correct |
7 |
Correct |
7 ms |
2396 KB |
Output is correct |
8 |
Correct |
9 ms |
2632 KB |
Output is correct |
9 |
Correct |
8 ms |
2392 KB |
Output is correct |
10 |
Correct |
60 ms |
5204 KB |
Output is correct |
11 |
Correct |
386 ms |
10832 KB |
Output is correct |
12 |
Correct |
628 ms |
13564 KB |
Output is correct |
13 |
Correct |
727 ms |
14352 KB |
Output is correct |
14 |
Correct |
668 ms |
14300 KB |
Output is correct |
15 |
Correct |
672 ms |
14280 KB |
Output is correct |
16 |
Correct |
675 ms |
14568 KB |
Output is correct |
17 |
Correct |
677 ms |
14192 KB |
Output is correct |
18 |
Correct |
680 ms |
14940 KB |
Output is correct |
19 |
Correct |
744 ms |
14420 KB |
Output is correct |
20 |
Correct |
673 ms |
15460 KB |
Output is correct |
21 |
Correct |
669 ms |
14228 KB |
Output is correct |
22 |
Correct |
692 ms |
14576 KB |
Output is correct |
23 |
Correct |
706 ms |
14572 KB |
Output is correct |
24 |
Correct |
723 ms |
14584 KB |
Output is correct |
25 |
Correct |
691 ms |
14372 KB |
Output is correct |