vkditya0997's blog

By vkditya0997, history, 8 years ago, In English

Hello everyone,
I was trying this problem : Click
I couldn't get any idea. So, read the editorial.
It mentioned to square root decompose the queries and then solve the problem. I don't really get the idea behind it.
can someone, please explain?
P.S.: I know about SQRT decomposition

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

Hello codeforces,

I am not able to understand the editorial for this question.

Can someone please explain the approach to this problem more clearly?

Editorial link : http://agc002.contest.atcoder.jp/data/agc/002/editorial.pdf

Problem link : http://agc002.contest.atcoder.jp/tasks/agc002_d

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

Hello Codeforces,

I was trying this 603B - Moodular Arithmetic, I couldn't get the idea and read the editorial.

I have a doubt.


for k >  = 2 case :

we choose m such that km = 1 mod p

and also it has been proved that f(ki * n mod p ) = ki * f(n) mod p

and now if we choose some f(n) , we get the value of f(n) , f(k * n mod p ) ,.... f(km - 1 * n mod p )

Understood until this point


I didn't understand from here..

Therefore, if we choose f(n) of p - 1 / m integers n, we can get value of all p-1 non-zero integers. Since f(n) can be chosen in p ways for each of the p - 1 / m integers, the answer is pp - 1 / m

Can someone please help in understanding this one?

Thanks in Advance!

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

Hello everyone,
I have seen many problems which can be solved using tree center.
So, I would like to know about it.
If someone can provide resources or explain it here in comments, It would be great!


and also my approach for today atCoder Problem C was something like this : ( failed! )

  • Find an extreme of a diamemter of tree, This can be done by running a dfs from any arbitrary node. The node whose depth is highest is one of the extreme. ( Please correct me? )
  • find the diameter from this extreme ( the highest depth from this node ).
  • the nodes with the depth equal to the diameter are pushed into a vector ( let's say A ).
  • Now, for every node in the vector A, Run a dfs and count the no of nodes having depth greater than K. the minimum of these would be the answer.


Where did I go wrong?
Someone please help me?

Thanks in Advance

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

How to solve problem B ?

This problem looks similar to SPOJ-WATER

Someone please explain the approach to this problem?

Thank you!

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

Hello Codeforces,

I was learning about LCA today. I found some video tutorial which explained a naive method.

So, I wanted to know the best Algorithm for finding LCA between two nodes.

Thank you!

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

I am facing really tough time solving dp problems.

For example, 682D - Alyona and Strings has been solved by many users during the contest.

even after the contest, I wasn't able to solve.

I need to train hard on dp problems.

Someone, please suggest me some good way to train on these.

Thank you!

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

Problem Statement : Click
I'm not able to arrive at the dp state.
But there were some comments on the announcement Post
It mentioned

dp[ i ][ j ] = max( dp[ i ][ j - 1 ] , presum[ j ] - presum[ j - m ] + dp[ i - 1 ][ j - m ] );

Some one please explain this state?
Thank you

Full text and comments »

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

By vkditya0997, history, 8 years ago, In English

I'm not able to get the idea for this question ( http://codeforces.net/gym/100109/problem/F )
Someone please help me in getting the idea.
Thanks in advance!

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Hints on how to solve this problem?
Problem Statement : https://community.topcoder.com/stat?c=problem_statement&pm=14132
Thanks!

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Hello everyone,
Is there any plugin so that I can use my favourite Editor ( Sublime Text ) for Topcoder ?
I used to use Greed Plugin.
But, It is not generating correct Class
Today for the first time, I faced the problem.
Other than Greed, Any other similar plugin ?
Thanks in Advance

Full text and comments »

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

By vkditya0997, 9 years ago, In English

Hello everyone,
I am trying to solve this problem on topcoder ( SRM 678 div2 1000 ptr )
Not able to get the idea on how to solve!
Please help me in arriving at the solution !
Thanks in advance ! :)

EDIT : Anyone please?

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

How to solve it ?

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Hello Everyone,

What's the difference in these two macros ?

#define LL long long int 
   and 
typedef long long LL;

and

What's the difference between these ?

inline void myFunction(){}
   and 
void myFunction(){}

Thanks !

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Recently,

I have seen subscriber 's youtube channel, It is very useful and I thank all the coders who upload their screencasts and helping for the community.

Interesting thing is,
He uses some C++ code to generate random test cases to test his solution and to hack some other's solution
I would like to hear some tips on how to generate random test cases in C++ ?

Yeah , rand() function can be used but shows same integer every time after it's execution.
So, It would be interesting, If some of the coders in this community share their tips on how to generate those test cases.

and also I can see that Far Manager Editor is pretty Powerful!, How to use it?
Any similar Editor on Linux Ubuntu ?

I even like to see tourist coding during codeforces/topcoder/codechef rounds.

Hope that he notices this post and uploads screen cast as Petr, Egor, subscriber, many others ... does :)

Thanks everyone!!

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Hello folks,

I have a small doubt regarding Dijkstra Algorithm



The highlighted part,

    What's the main use of the line?

Thanks in Advance and Merry Christmas!

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

So,
When does the handle change setting opens ?
Happy Christmas ! :)

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

Can someone please explain the problem statement ?

link : click here

Explain the first test case? :)

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

I solved this by a brute force
By removing each and every pair, if no of connected components are greater than initial no , count ++
But it was very lengthy, and I saw many short codes, Which I couldn't understand?
Any optimized Algorithm to solve these kind of problems?
Thanks in advance !

Full text and comments »

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

By vkditya0997, history, 9 years ago, In English

How to solve this question using BIT?

Full text and comments »

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