Submission #1129227

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11292272024-12-23 18:57:49mnbvcxz123Weighting stones (IZhO11_stones)C++20
100 / 100
30 ms6728 KiB
#include <iostream>
using namespace std;
#define int long long
struct struct_aint{
int sum,pref_min,pref_max;
};
struct_aint v[400005];
struct_aint combin(struct_aint a,struct_aint b){
struct_aint rasp;
rasp.pref_min=min(a.pref_min,a.sum+b.pref_min);
rasp.pref_max=max(a.pref_max,a.sum+b.pref_max);
rasp.sum=a.sum+b.sum;
return rasp;
}
void update(int nod,int st,int dr,int poz,int a){
if(st==dr){
v[nod].sum=a;
v[nod].pref_min=a;
v[nod].pref_max=a;
return ;
}
int mij=(st+dr)/2;
if(mij>=poz) update(2*nod,st,mij,poz,a);
else update(2*nod+1,mij+1,dr,poz,a);
v[nod]=combin(v[2*nod],v[2*nod+1]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...