# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
170861 | juggernaut | Weighting stones (IZhO11_stones) | C++14 | 71 ms | 7672 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.
//Just try and the idea will come!
#include<bits/stdc++.h>
#define int long long int
using namespace std;
int mx[400001],mn[400001],add[400001],n,x,y,i;
void push(int v,int l,int r){
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 l,int r,int ql,int qr,int val){
push(v,l,r);
if(r<ql||qr<l)return;
if(ql<=l&&r<=qr){
add[v]+=val;
push(v,l,r);
return;
}
int mid=(l+r)>>1;
update(v*2,l,mid,ql,qr,val);
update(v*2+1,mid+1,r,ql,qr,val);
mx[v]=max(mx[v*2],mx[v*2+1]);
mn[v]=min(mn[v*2],mn[v*2+1]);
}
main(){
scanf("%lld",&n);
for(i=0;i<n;i++){
scanf("%lld%lld",&x,&y);
update(1,1,n,1,x,3-y*2);
if(mx[1]>=0&&mn[1]>=0)puts(">");
else if(mx[1]<=0&&mn[1]<=0)puts("<");
else puts("?");
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |