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