# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
900083 | pcc | 돌 무게 재기 (IZhO11_stones) | C++14 | 33 ms | 11868 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |