vsanjay_nitdgp's blog

By vsanjay_nitdgp, history, 9 years ago, In English

this is my solution http://ideone.com/49SCl3 for spoj problem

http://www.spoj.com/problems/MRECAMAN/en/

could anyone pls say why am i getting TLE

THANKS IN ADVANCE

Full text and comments »

  • Vote: I like it
  • +1
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

this is my solution

http://ideone.com/FB9VxG for the following problem http://mirror.codeforces.com/contest/572/problem/B

i really worked hard for this problem...but i couldnt find any wrong in my solution...

could anyone pls point out wrong in my solution...

pls help me..

thanks in advance

Full text and comments »

  • Vote: I like it
  • -5
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

recently i wrote a program on doubly linbked list.....this is my code

http://ideone.com/XLSln7

i coulod able to put number at any position except at end.....could you pls tell whats wrong in this code.

THIS WAS MY QUESTION ..BUT LATER I SAW THE CODE TWICE ....AND GOT THE ERROR..

i got it...in doubly linked list.....when you are inserting a noe at the end....see that you are not using thsi step...

"temp1->next->prev=temp1;"

so....take a global variable 'l' which keeps track of length of list....when list length is equal to your inserting position ,dont use that line....

check modified code below

http://ideone.com/mwEiyp

hope this helps for beginners of linked list.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

i used the following lazy propogation to update my tree...like i wanted to get sum of [i,j]

http://ideone.com/Vh05zS

my input was n=8;all elements set to zero.'0'.

then i gave my array number 26 to update array from i=1 to i=3;[1,3]

but i am getting tree[1]=52 instead of 78....

could any one say where i am getting wrong.....

thanks in advance

Full text and comments »

By vsanjay_nitdgp, history, 9 years ago, In English

sir....the following code....i used succesfully compiled and got correct answer...i.e insert a number at end position...this is my code

http://ideone.com/DxFaPU

but first time i got wrong because in print fuction in while loop i used "temp->next!=NULL" instead of "temp".....could any one say why did i get wrong...before.

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

could any one pls explain the following problem clearly so that a beginner could understand

http://mirror.codeforces.com/contest/460/problem/C

Full text and comments »

  • Vote: I like it
  • +5
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

could any one pls say how to solve this problems....and also say some prerequisites to solve this problem....

https://www.codechef.com/COFU2015/problems/LINGRP

thanks in advance...

Full text and comments »

  • Vote: I like it
  • -13
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English
  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

Sir..I tried the below question ..I got the correct answer for all test cases.but I got TLE due to constraints..then I saw some users solutions..they did that problem with a formula...but I wonder what is that formula....could any one explain how to get AC with in time limit..and explain that formula clearly..how did they get it. https://www.codechef.com/PROCON15/problems/PRCNSR1

Thanks

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

could any one say clear logic behind this problem.

http://www.spoj.com/problems/MKEQUAL/

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

recently....i came across a problem on spoj...NGM2.. http://www.spoj.com/problems/NGM2/

i think many dont concentrate on this topic.....i am one.....i know how to solve this problem....but couldnt write code.....could any one post code for this problem in c.

Full text and comments »

  • Vote: I like it
  • -17
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

sir..i am dp beginner....i solved the following problem with brute-force.....but i want to know approach for DP solutions.....

pls explain the approach clearly...

thanks in advance

http://mirror.codeforces.com/problemset/problem/189/A

Full text and comments »

Tags dp
  • Vote: I like it
  • -3
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

i solved "longest common subsequnce" problem....there the elements need not to be contiguous....but whn i saw a video on maximum subsequence sum....he said sequnce has to be contiguous.....

i am confused which one to follow....

pls clear...

Full text and comments »

Tags dp
  • Vote: I like it
  • +2
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

Hello...I am a dream coder...and now I want to master dynamic programming...recently I solving the following problem....

i saw the ditorial,,,,but dp solution was not given.

could any one explain dp code for below problem.i am dp beginner

Thanks in advance

http://mirror.codeforces.com/problemset/problem/327/A

Full text and comments »

Tags dp
  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

Hello...I am a dream coder...and now I want to master dynamic programming...recently I solving the following problem....but couldn't understand the editorial.

Could any one pls explain this problems solution clearly..for a DP beginner.....

Thanks in advance

http://mirror.codeforces.com/contest/455/problem/A

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By vsanjay_nitdgp, history, 9 years ago, In English

Hello...I am a dream coder...and now I want to master dynamic programming...recently I solving the following problem....but couldn't understand the editorial.

Could any one pls explain this problem clearly..for a DP beginner.....

Thanks in advance

http://mirror.codeforces.com/contest/455/problem/A

Full text and comments »

Tags dp
  • Vote: I like it
  • -3
  • Vote: I do not like it

By vsanjay_nitdgp, history, 10 years ago, In English

http://mirror.codeforces.com/contest/460/problem/C

can any one pls explain how to do this problem through binary search.

include

include <stdio.h>

using namespace std; long long i,n,k,m[200010],w,l,r,z,a[200010],kol,sum,p; int main(){ //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout); cin>>n>>k>>w; for (i=0;i<n;i++) cin>>m[i]; l=1; r=10; while (l<=r){ z=(l+r)/2; kol=0; sum=0; for(p=0;p<10;p++) a[p]=0; for ( i=0;i<n && kol<=k;i++){ sum=sum+a[i]; if (m[i]+sum<z){ kol=kol+z-(m[i]+sum); a[i+w]-=z-(m[i]+sum); sum=z-m[i]; } } if (kol<=k) l=z+1; else r=z-1;

}
cout<<r;
return 0;

} here is one of the codes and i couldnt understand any thing at all.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it

By vsanjay_nitdgp, history, 10 years ago, In English

COULD SOME ONE PLS EXPLAIN THIS QUESTION CLEARLY.pretty confused.

Full text and comments »

  • Vote: I like it
  • -3
  • Vote: I do not like it