# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
764544 | Trunkty | Weighting stones (IZhO11_stones) | C++14 | 30 ms | 3744 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;
typedef long long ll;
//#define int ll
int n;
//
int sumi[400020],maxi[400020],mini[400020];
void update(int node, int l, int r, int pos, int val){
if(l==r){
sumi[node] = val;
maxi[node] = val;
mini[node] = val;
}
else{
int mid = (l+r)/2;
if(pos<=mid){
update(node*2,l,mid,pos,val);
}
else{
update(node*2+1,mid+1,r,pos,val);
}
sumi[node] = sumi[node*2]+sumi[node*2+1];
mini[node] = min(mini[node*2+1],mini[node*2]+sumi[node*2+1]);
maxi[node] = max(maxi[node*2+1],maxi[node*2]+sumi[node*2+1]);
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
int a,b;
cin >> a >> b;
if(b==1){
update(1,1,n,a,1);
}
else{
update(1,1,n,a,-1);
}
if(mini[1]>=0){
cout << ">" << "\n";
}
else if(maxi[1]<=0){
cout << "<" << "\n";
}
else{
cout << "?" << "\n";
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |