“HMAPPY1”
first find 2 max size substring and store their first and last pointer and when shift queries come you just move 4 points and for length query you just need to check size of both substring both query thake O(1) time
https://www.codechef.com/viewsolution/21397995
“GMEDIAN”
Its simple observation you for making odd length subset you have 2^(n-1) possible way i proved that with equation (l+r) C (l) way to choose elements in array at (l+1) position where (l+r+1) = n
Now for even length we need to check frequency of number and after some observations you can find solutions with O(n²) so total time complexity O(n²)
https://www.codechef.com/viewsolution/21483295
“MAGICHF2”
If N is even than we need to divide N like after devide N is two part one part still can divide by 2
But for odd we need to add one into it
And after logN/K iteration you can find its probability.
https://www.codechef.com/viewsolution/21521761
"CHEF and Eq "
First i tried with Gaussian elimination in O( n³ ) but after reading some papers i can make in O(n²)
Its known as vandermonde matrix.
And i read about FFT i think that it will be solutions of it
May be using MOD root of unity.
I can’t solve it for 100 point.
O( N²) for more information
https://discuss.codechef.com/questions/80978/sata05-editorial
" MaxDigit "
For subtask 1 we just need to know how many paths are passing from node 1 in s using dfs an after than remove node from distance 3 and ( Children of root C 2 ) from ans…
I didn’t paste partially point solutions you can check
For prime tree and Chef and recipe i used brute force approach for partially point
I got TLE in BinXor