Комментарии
На Gol_D → Codeforces Round #780 (Div. 3) Разбор, 2 года назад
0

I tried to analyse your code : pair<ll,pair<ll,ll>> give_mx(vll &v,ll i,ll j){ ll prod=1; for(int k=i;k<=j;++k)prod*=v[k]; suppose i = 2 and j = n-1; so you will make j-i iterations which is n-2 and if n=1e5 so the you will have product of pow(2,1e5) which is impossible because as we know that max value of long integer cant be more than (in this range 2^62) so in the process you will get bad behaviour of overflow , just if I'm wrong just tell me maybe i couldn't clearly understood your code

На okwedook → Codeforces Round #870 (Div. 2) Editorial, 3 года назад
0

yes yes using pref and suff more easier just the idea didn't came

На okwedook → Codeforces Round #870 (Div. 2) Editorial, 3 года назад
0

Hello guys i know it's been a while for this div but i have an idea on D that got me ACC so we can make it using seg tree because b1+b3+b2-(r-l) to be maximized we can see it like this : (b1+l)+b2+(b3-r) and for every element from 2 to n-1 we can get max element which is (bj+j) and j from 1 to i-1 and max (bc-c) where c from i+1 to n so result will be max(bi+max(bj+j)+max(bc-c)) and we can query using the seg tree to see the two element we are looking for because both B1 and B3 needs to be the left and right itself

it's been a while but for problem C we can use monotonic stack good luck everyone !!!

На sum → Editorial for Codeforces Round #919 (Div. 2), 3 года назад
0

there's the check part n%i

yes we can just make it in O(n+log(n) for the sort ) == O(n) .