# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
673563 | Baytoro | Weighting stones (IZhO11_stones) | C++17 | 60 ms | 7500 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
void fopn(string name){
freopen((name+".in").c_str(),"r",stdin);
freopen((name+".out").c_str(),"w",stdout);
}
const int INF=1e18,mod=998244353;
int n;
const int N=1e5+5;
int mn[4*N],mx[4*N],lazy[4*N];
void push(int l, int r, int x){
if(lazy[x]){
mn[x]+=lazy[x];
mx[x]+=lazy[x];
if(l!=r){
lazy[2*x]+=lazy[x];
lazy[2*x+1]+=lazy[x];
}
lazy[x]=0;
}
}
void update(int lx, int rx, int v, int x=1,int l=1, int r=n){
push(l,r,x);
if(l>rx || r<lx) return;
if(lx<=l && r<=rx){
lazy[x]+=v;
push(l,r,x);
return;
}
int md=(l+r)/2;
update(lx,rx,v,2*x,l,md);
update(lx,rx,v,2*x+1,md+1,r);
mx[x]=max(mx[2*x],mx[2*x+1]);
mn[x]=min(mn[2*x],mn[2*x+1]);
}
void solve(){
cin>>n;
for(int i=0;i<n;i++){
int t,x;
cin>>t>>x;
int k=1;
if(x==2) k=-1;
update(1,t,k);
if(mx[1]>0 && mn[1]>=0){
cout<<">\n";
}
else if(mx[1]<=0 && mn[1]<0){
cout<<"<\n";
}
else
cout<<"?\n";
}
}
main(){
//fopn("newbarn");
ios;
int T=1;
//cin>>T;
while(T--){
solve();
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |