semi_rated's blog

By semi_rated, 6 years ago, In English

I am very confused about when I should use double and when I should use long double.
In yesterdays educational round, my solution for 1009C - Annoying Present has failed for using double. After system testing, I resubmitted it using long double and it got accepted.
My solution using double got WA on test 39: 40379060
My same code replacing double with long double got accepted: 40379089

Update:
When I use long long tot for storing the sum of all calculation and finally used double ans = tot*1.0/n it also got accepted: 40379501 ! Why ?? Then why WA when using double tot? Since the sum of all calculation don't have any precision or floating point value, precision is coming only when dividing by n, then why using double gave WA ?

As far as I know double can store value up to 1.8×10308 (approximately). So, why long double is needed here? Isn't double is enough here?

Also, during contest or online problem solving how should I decide which one I should use: double or long double?
Is it safe to use long double always for all problems? Or is there any specific case when I should use long double ?

Thanks in advance.

Full text and comments »

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

By semi_rated, history, 6 years ago, In English

If any codeforces problem is mentioned in any blog post or comment with proper problem tag which is [problem:problem_number], then if anyone keep the mouse cursor on that problem name i.e. link, then the Contest Round name is shown in which contest that problem is used. For example, 12A - Суперагент

. Notice that when you put your mouse cursor on this problem name, contest name is being shown.

But if we keep the mouse cursor on the problem name in the problemset page, then nothing shown.

So, I request to add this feature so that the Contest Round Name is shown when mouse cursor is put upon a problem name in problemset page.

It will be helpful. Because in the problemset page, when I see, for example 105B I don't know whether it is a Div2B or Div1B. According to my level I may want to skip the problem if it is a Div2B but will read and try to solve the problem if it is a Div1B(i.e. Div2D).

Please add the feature, MikeMirzayanov !
Thanks in advance.

Full text and comments »

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

By semi_rated, 6 years ago, In English

Lets list all the good problems from acm.sgu.ru in this post.

1) 507. Treediff

Please comment the problems you solved and think to be good or interesting, or the problems that you think to be "must solve". I will add them to the list of this post.

You may give the category/type or hint or algorithm/data structure needed to solve the problem in spoiler.

Full text and comments »

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

By semi_rated, 6 years ago, In English

Please give some online judge problems in which prefix sum( also known as cumulative sum) technique is useful.

Thanks in advance.

Full text and comments »

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