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

Автор temp_ac, история, 4 года назад, По-английски

I was solving a problem using C++ vector STL. But I was getting some wrong answers for my problem. Then, I started debugging my code. And after that, I noticed some weird behavior by my vector STL.

Code 1

After giving input like this : 3 5 8 10

I am getting this output : -3 0 3 8 ( why getting 0 on index 1 ? AND where is 10 ? )

And Similarly Let's see Another weird behavior ( if we don't sort the vector v AND still giving same input as of Code 1 ):

Code 2

I am getting this output : 0 3 8 10 ( why getting 0 on index 0 ? AND where is -3 ? )

Can someone explain this why I am facing this weird behavior ?

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

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

Автор temp_ac, история, 4 года назад, По-английски

I just want to talk about the this ( Codeforces Round #635 Div 1 ) contest. As we can see that the writers in this contests were EternalAlexander , ustze , and Sulfox

Also we can note that the maximum ratings of all these three writers are 2200, 2112, and 2529 ( And for getting this much ratings, these writers have faced many ups and downs too in their past contests ) correspondingly. And from these ratings, it might not be wrong to say that these writers have some lesser knowledge than Codeforces LGMs.

My question might be very weird, but I would be happy if someone could give a better explanation. I just want to know that why any of the Codeforces top LGMs ( except maroonrk ) could not participate well/good ( could not even solve 5 problems out of 7 problems ) in this contest ?

It might not be wrong to say and expect that the top LGMs have much more knowledge than these writers because as we can see that the difference between the ratings of these three writers and codeforces LGMs are really huge.

This is the contest Final Standings : Final_Standings

Please someone explain this as I am very eager to know the reason behind this.

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

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

Автор temp_ac, история, 4 года назад, По-английски

Why the last visit of MiFaFaOvO is showing 9 hours ago, whereas he recently solved few problems of the current running round kotlin heroes episode 3 ?

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

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

Автор temp_ac, история, 4 года назад, По-английски

A rooted binary tree of N ( 1<=N<=1000000 ) nodes is given. You need to answer Q ( 1<=Q<=100000 ) queries.

Each q query contains two inputs : u val

In each query, You need to check whether a node of value val is present in the subtree of node u or not.

I know only a naive approach ( first creating an adjacency list using set STL for each node by finding the subtree of it and then check whether value val is present in the subtree of node u or not ) to this problem. And it is obvious that the solution doesn't fit for given N range.

Can anyone suggest a better approach to this problem ?

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

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

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

I just want to know why submission time is varying for submitting the same solution?

Example :

Solution A1 : Link — Submission Time — 31 ms

Solution A2 : Link — Submission Time — 15 ms

Both Solution-A1 and Solution-A2 are same. But still, both are taking different Submission time. Why?

Solution B1 : Link — Submission Time — 30 ms

Solution B2 : Link — Submission Time — 15 ms

Similarly, both Solution-B1 and Solution-B2 are same. But still, both are taking different Submission time.

May I know the reasons behind the different submission times?

Note: These both solutions are not mine, I am just wondering for the reason why these both same solutions are having a time difference.

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

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