Блог пользователя vsanjay_nitdgp

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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...

Полный текст и комментарии »

  • Проголосовать: нравится
  • -13
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -17
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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...

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

Автор vsanjay_nitdgp, история, 9 лет назад, По-английски

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

Полный текст и комментарии »

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится