# Codeforces gym 100517 (two points, same direction judgment)

Source: Internet
Author: User

Codeforces gym 100517 (two points, same direction judgment)

Question: a convex bag is provided, which is given in clockwise order. The number of points cannot exceed 0.1 million. Two different points are given. The points are strictly in the convex bag. The convex bag ensures that no three points are collocated, the number of vertices (pi, pj) on the convex hull satisfies the requirement that the line segments of pi and pj strictly interwork with the line segments of the two points. The strict intersection between the line segments means that the intersection is not at the endpoint.

Solution: If a convex Packet Has n points, the p of the convex packet point set is doubled to 2n points. The first n vertices of the enumeration, which are enumerated to I each time, are divided into two vertices in [I + 1, I + n-1], and the two vertices p1, p2, the point where p1 and p2 are the "closest" line segments. Count the intermediate number. During the bipartite process, you need to make a judgment in the same direction, that is, to determine whether the straight line is in the "Left" or "right" of a line segment, and use the cross product to determine.

Code

``````//Hello. I'm Peter.//#pragma comment(linker, /STACK:102400000,102400000)#include

#include

#include

#include

#include

#include

#include

#include#include

#include

#include

#include

#include

#include

#include

#include

``````

Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.