# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166791 | Dovran | Weighting stones (IZhO11_stones) | C++11 | 408 ms | 7672 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define pb push_back
#define ss second
#define ff first
#define N 100005
#define inf 1000000009
#define ll long long
#define mid(a,b) (a+b)/2
using namespace std;
int n,T[4*N][3],T1[4*N][3],mx,mt,t,r;
void upd(int v,int pos,int l,int r,int nd){
T[nd][1] += T[nd / 2][2];
T1[nd][1] += T1[nd / 2][2];
T[nd][2] += T[nd / 2][2];
T1[nd][2] += T1[nd / 2][2];
if(r <= pos){
T[nd][1] += v;
T[nd][2] += v;
T1[nd][1] += v;
T1[nd][2] += v;
return;
}
if(l <= pos){
upd(v,pos,l,mid(l,r),nd * 2);
upd(v,pos,mid(l,r)+1,r,nd*2+1);
T[nd][2] = 0;
T1[nd][2] = 0;
T[nd][1] = max(T[nd * 2][1],T[nd * 2 + 1][1]);
T1[nd][1] = min(T1[nd * 2][1],T1[nd * 2 + 1][1]);
}
}
int main()
{
cin>>n;
for(int i = 1;i <= n;i++){
cin >> r >> t;
if(r > mx){
mx = r;
mt = t;
}
if(t == 1)
upd(-1,r,1,n,1);
else upd(1,r,1,n,1);
if(mt == 1)
if(T[1][1] <= 0) cout << ">\n";
else cout << "?\n";
else {
if(T1[1][1] >= 0) cout << "<\n";
else cout << "?\n";
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |