| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 166413 | Dovran | 돌 무게 재기 (IZhO11_stones) | C++11 | 499 ms | 5628 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define N 100009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long
using namespace std;
int n, v[4*N][3], c[4*N];
void upd(int nd, int l, int r, int x, int y){
if(v[nd/2][2]!=0)
v[nd][2]+=v[nd/2][2], v[nd][1]+=v[nd/2][2], c[nd]+=v[nd/2][2];
if(l>x)
return;
if(r<=x){
v[nd][2]+=y;
v[nd][1]+=y, c[nd]+=y;
return;
}
int md=(l+r)/2;
upd(nd*2, l, md, x, y);
upd(nd*2+1, md+1, r, x, y);
v[nd][1]=max(v[nd*2][1], v[nd*2+1][1]);
c[nd]=min(c[nd*2], c[nd*2+1]);
v[nd][2]=0;
}
int main(){
cin>>n;
for(int i=1; i<=n; i++){
int x, y;
cin>>x>>y;
if(y==1)
upd(1, 1, n, x, -1);
else
upd(1, 1, n, x, 1);
if (v[1][1] <= 0)
cout<<">\n";
else if (c[1] >= 0)
cout<<"<\n";
else
cout<<"?\n";
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
