# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
900083 | pcc | Weighting stones (IZhO11_stones) | C++14 | 33 ms | 11868 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 ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
#define mid ((l+r)>>1)
const int mxn = 1e5+10;
pll mx[mxn*4],mn[mxn*4];
int n;
void modify(int now,int l,int r,int p,int v){
if(r<=p){
mx[now].sc += v;
mn[now].sc += v;
return;
}
modify(now*2+1,l,mid,p,v);
if(mid<p)modify(now*2+2,mid+1,r,p,v);
mx[now].fs = max(mx[now*2+1].fs+mx[now*2+1].sc,mx[now*2+2].fs+mx[now*2+2].sc);
mn[now].fs = min(mn[now*2+1].fs+mn[now*2+1].sc,mn[now*2+2].fs+mn[now*2+2].sc);
return;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n;
int q = n;
while(q--){
int a,b;
cin>>a>>b;
modify(0,0,n+1,a,b==1?1:-1);
if(mn[0].fs>=0)cout<<">\n";
else if(mx[0].fs<=0)cout<<"<\n";
else cout<<"?\n";
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |