Hi, I'm facing issues using the standard complex class from C++, in this task: The angle between the vectors.
I need to compute the length of vectors, okay: If I use the abs()
function or sqrt(norm())
(same thing) I get 3 WAs out of 64 tests. If I compute it manually, I get AC.
This code gets AC, because I compute manually the lengths. This code gets 3 WAs, because I use abs().
Since I can't see input files I don't understand what is the problem.
Any idea?
deleted
Let's look at sources of abs() (gcc 4.6.2):
So, it does almost the same as you except some kind of normalization in order to avoid overflow.
So, I think problem is in precision and rounding — it seems like e-olimp.com use strict comparing of float numbers (0.1234549999999 after rounding becomes 0.12345, 0.1234550000000 becomes 0.12346 and e-olimp.com considers these numbers different, but real difference is 1e-13).