### vkditya0997's blog

By vkditya0997, history, 7 years ago,

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.
P.S.: I know about SQRT decomposition

• +1

By vkditya0997, history, 7 years ago,

Hello codeforces,

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

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

• +1

By vkditya0997, history, 7 years ago,

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

• +7

By vkditya0997, history, 7 years ago,

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?

• +1

By vkditya0997, history, 7 years ago,

How to solve problem B ?

This problem looks similar to SPOJ-WATER

Someone please explain the approach to this problem?

Thank you!

• +2

By vkditya0997, history, 7 years ago,

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!

• +3

By vkditya0997, history, 7 years ago,

I am facing really tough time solving dp problems.

For example, 682D - Алёна и строки 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!

• +5

By vkditya0997, history, 7 years ago,

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

• +1

By vkditya0997, history, 8 years ago,

I'm not able to get the idea for this question ( http://codeforces.com/gym/100109/problem/F )

• +1

By vkditya0997, history, 8 years ago,

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

• 0

By vkditya0997, history, 8 years ago,

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 ?

• 0

By vkditya0997, 8 years ago,

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!

• +5

By vkditya0997, history, 8 years ago,

How to solve it ?

• -13

By vkditya0997, history, 8 years ago,

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 !

• -6

By vkditya0997, history, 8 years ago,

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!!
• +4

By vkditya0997, history, 8 years ago,

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!
• -2

By vkditya0997, history, 8 years ago,

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

• +14

By vkditya0997, history, 8 years ago,

Can someone please explain the problem statement ?

Explain the first test case? :)

• 0

By vkditya0997, history, 8 years ago,

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?