damon2598's blog

By damon2598, history, 5 years ago, In English

I was trying to solve this problem : http://codeforces.com/problemset/problem/1037/D (Valid BFS) . My submission is :http://codeforces.com/contest/1037/submission/45684523

My method : I am storing parent of each node (using bfs) . then , I am checking that is the new bfs following the order policy , using a queue . The code is neat and small . Please someone help me , I want to know where my algorithm is wrong .

Full text and comments »

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

By damon2598, history, 5 years ago, In English

Today ,I saw a question on codechef October Lunchtime . The problem link is : https://www.codechef.com/LTIME65A/problems/NICARRAY I tried solving it recursively (for partial marks) . But I couldn't get it correct . Only the basic testcases are passing . Here is my solution : https://www.codechef.com/viewsolution/21248539 .

The recurrence that I thought is [ f(n,k) = f(n-j,k-j) for j=1 to (n-k+1) ] . base case: if n == k == 0 then i added the gcd of the newly formed array to the final answer.

Please someone explain how to solve this problem (or this type of problem) . ( I still don't know how to remove TLE. )

Full text and comments »

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

By damon2598, history, 5 years ago, In English

in the educational Codeforces Round 53 , problem B (1073B) my solution gives TLE ,but I don't think it should. My submission is : http://codeforces.com/contest/1073/submission/44858358 can someone suggest the bugs in my code ,if any ?

Full text and comments »

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

By damon2598, history, 6 years ago, In English

A very familiar niche of dp problemset is the subsequence problemset . But , there are a wide range of questions related to subarrays , that can be solved using dp. Please suggest me some resources for the problems related to subarrays , which can be solved using dp.

Full text and comments »

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