Submission #900083

#TimeUsernameProblemLanguageResultExecution timeMemory
900083pccWeighting stones (IZhO11_stones)C++14
100 / 100
33 ms11868 KiB
#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 timeMemoryGrader output
Fetching results...