Can anyone provide the new link to the ICO whatsapp group?? The link given in this site as well as at Codechef has expired.
Can anyone provide the new link to the ICO whatsapp group?? The link given in this site as well as at Codechef has expired.
Hi...is it possible to solve this problem using sliding window method?? If we take by taking 3 elements at a time and defining arr[-1] as the last element and arr[n] as the first element ( 0 based indexing )..Is it possible to solve using this method??
Sir this is my code. I am getting the verdict TLE. Please help me.
#include<iostream>using namespace std;long int arr[200000],res = 0;long int process(int x);int main(){long int n,res,i;cin>>n;for(i=0;i<n;i++){cin>>arr[i];}res = process(n-1);cout<<res;return 0;}long int process(int i){if(i < 2){return 0;}res = min(arr[i] + process(i-1),min(arr[i-1] + process(i-2),arr[i-2] + process(i-3)));return res;
Dear Sir,
I have used the following logic -
At any point (x,y) , f(x,y) = (x,y) + max(f(x-1,y),f(x,y-1)); /// from the top
at this position i have recreated the best paths "from bottom" to the positions..(x,y) (x+2,y) and (x,y+2)..I have then taken out the max of all the three later calculated weightages...and then stored the → f(x) + max value to temp_max variable..and then put it into recursion.so that the new max value is updated at each call...Am i right in my approach??
Hope to get your reply soon.
Thank You