Reminder: in case of any technical issues, you can use lightweight websites m1.codeforces.com, m2.codeforces.com or m3.codeforces.com ×

rahulb's blog

By rahulb, history, 5 months ago, In English,

https://codeforces.com/contest/629/submission/46721512 This is the link to my solution to 629D. I am getting WA on 59th testcase. The error is of the order of exp(-5) but I am not able to figure out the reason why I am getting that error. I have set the precision to 12. Many other solutions with same precision have passed. Is there something else I am missing?

 
 
 
 

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by rahulb (previous revision, new revision, compare).

»
5 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Try storing pi as long double

long double pi = acosl(-1)

Your method will cast your pi value into double when not adding suffix l to the number.

  • »
    »
    5 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Still gives the same answer. Thanks anyways

»
5 months ago, # |
  Vote: I like it +3 Vote: I do not like it

This is actually not a precision error. The answer is basically an integer multiplied by PI, so you can never get a precision error if you find the integer part correctly.

»
4 months ago, # |
  Vote: I like it 0 Vote: I do not like it

I haven't read tried to understand your solution but there might be a problem with position[r*r*h]=i;, since there can be multiple values of r*r*h.