Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

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

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

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

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

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

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

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

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

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

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

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!

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

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

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

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

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

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

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

How to solve problem B ?

This problem looks similar to SPOJ-WATER

Someone please explain the approach to this problem?

Thank you!

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

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

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

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
  • Проголосовать: не нравится

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

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!

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

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

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

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
  • Проголосовать: не нравится

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

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

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

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

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

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

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

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

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

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

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?

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

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

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

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

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
  • Проголосовать: не нравится

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

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
  • Проголосовать: не нравится

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

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
  • Проголосовать: не нравится

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

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

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

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

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

Can someone please explain the problem statement ?

link : click here

Explain the first test case? :)

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

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

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

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 !

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

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

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