# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
336946 | BY_KUTBILIM | Weighting stones (IZhO11_stones) | C++14 | 288 ms | 4588 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/** @BY_KUTBILIM **/
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define ll long long
const int N = (int)1e6 + 12;
int mx[N], mn[N], add[N];
void push(int v, int l, int r){
if(add[v] != 0){
if(l != r){
add[v*2] += add[v];
add[v*2+1] += add[v];
}
mx[v] += add[v];
mn[v] += add[v];
add[v] = 0;
}
}
void update(int v, int tl, int tr, int l, int r, int val){
push(v, tl, tr);
if(tr < l || tl > r)return ;
if(l <= tl and tr <= r){
add[v] += val;
push(v, tl, tr);
return ;
}
int tm = (tl + tr) / 2;
update(v*2, tl, tm, l, r, val);
update(v*2+1, tm+1, tr, l, r, val);
mx[v] = max(mx[v*2], mx[v*2+1]);
mn[v] = min(mn[v*2], mn[v*2+1]);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n;
cin >> n;
int t = n;
while(t--){
int r, s;
cin >> r >> s;
if(s == 1){
update(1, 1, n, 1, r, 1);
} else{
update(1, 1, n, 1, r, -1);
}
if(mx[1] >= 0 and mn[1] >= 0){
cout << ">\n";
} else if(mx[1] <= 0 and mn[1] <= 0){
cout << "<\n";
} else cout << "?\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |