Submission #764544

#TimeUsernameProblemLanguageResultExecution timeMemory
764544TrunktyWeighting stones (IZhO11_stones)C++14
100 / 100
30 ms3744 KiB
#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 timeMemoryGrader output
Fetching results...