Submission #48428

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
484282018-05-13 09:57:12ernestvwWeighting stones (IZhO11_stones)C++11
100 / 100
206 ms13996 KiB
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
const int maxn = 1<<17;
class SegmentTree {
public:
int n;
vi sum,minsuffix,maxsuffix;
SegmentTree(int _n) : n(_n), sum(2*_n,0),
minsuffix(2*_n,0), maxsuffix(2*_n,0) {}
void update(int i,int v) {
i+=n;
maxsuffix[i]=minsuffix[i]=sum[i]=v;
while((i/=2)>0) {
sum[i]=sum[2*i]+sum[2*i+1];
minsuffix[i]=min(minsuffix[2*i]+sum[2*i+1],minsuffix[2*i+1]);
maxsuffix[i]=max(maxsuffix[2*i]+sum[2*i+1],maxsuffix[2*i+1]);
}
}
};
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin>>N;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...