Can anyone explain the solution for this problem 102014F - Directional Resemblance ?
The problem basically says:
We are given N vectors in 3D and we want to find 2 vectors such that the angle between them is minimum.
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | maomao90 | 163 |
2 | Um_nik | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
Can anyone explain the solution for this problem 102014F - Directional Resemblance ?
The problem basically says:
We are given N vectors in 3D and we want to find 2 vectors such that the angle between them is minimum.
Name |
---|
sort by polar angle?
And then the minimum has to be between 2 consecutive vectors ?
Yes. If you want to practice implementing: https://codeforces.net/contest/598/problem/C
Thanks
Those 2 problems are completely different...
How so? I didn't download the OPs problemset, but it does "minimum angle between all pairs of vectors is what they're looking for.
In the problemset the vectors in question are 3d...
http://neerc.ifmo.ru/trains/zurich/analysis/20170426.pdf
Google is your friend!
Thank you
I solved that problem with a KD tree. Normalize the vectors, the distance will be proportional to the angle between them so you can use a KD tree to answer closest point.
Or you can use the same thing normalizing vectors in the sphere of same radius and solve it with the general idea for closest pairs (the idea in the editorial)