# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
673563 | Baytoro | Weighting stones (IZhO11_stones) | C++17 | 60 ms | 7500 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.
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
const int INF=1e18,mod=998244353;
int n;
const int N=1e5+5;
int mn[4*N],mx[4*N],lazy[4*N];
void push(int l, int r, int x){
if(lazy[x]){
mn[x]+=lazy[x];
mx[x]+=lazy[x];
if(l!=r){
lazy[2*x]+=lazy[x];
lazy[2*x+1]+=lazy[x];
}
lazy[x]=0;
}
}
void update(int lx, int rx, int v, int x=1,int l=1, int r=n){
push(l,r,x);
if(l>rx || r<lx) return;
if(lx<=l && r<=rx){
lazy[x]+=v;
push(l,r,x);
return;
}
int md=(l+r)/2;
update(lx,rx,v,2*x,l,md);
update(lx,rx,v,2*x+1,md+1,r);
mx[x]=max(mx[2*x],mx[2*x+1]);
mn[x]=min(mn[2*x],mn[2*x+1]);
}
void solve(){
cin>>n;
for(int i=0;i<n;i++){
int t,x;
cin>>t>>x;
int k=1;
if(x==2) k=-1;
update(1,t,k);
if(mx[1]>0 && mn[1]>=0){
cout<<">\n";
}
else if(mx[1]<=0 && mn[1]<0){
cout<<"<\n";
}
else
cout<<"?\n";
}
}
main(){
//fopn("newbarn");
ios;
int T=1;
//cin>>T;
while(T--){
solve();
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |