Prințesa

Time limit: 1s Memory limit: 512MB Input: Output:


Princess Ale has been captured by Empress Khan, who wants to use her hair for a magic potion. The Empress locks Ale up in a special prison. Fortunately, Claudiu Codreanu, the Princess's best friend, wants to help her escape!

Princess Ale, like all princesses, is shaped like a polygon (not necessarily convex), with NN sides. The Empress's prison is also shaped like a polygon, having NN walls that perfectly wrap around the princess's sides all the way around. Let's assume that the NN walls overlap perfectly with Ale's sides, and Claudiu Codreanu wants to prove that he can free the princess with minimal effort. He proposes that the princess can free herself by destroying a single wall of the prison, and you are the ones who have to give him a reality check and say whether this is actually possible or not. After destroying a wall, the princess will free herself through a sequence of translation and rotation moves. (Formally, the goal is for her to reach an arbitrarily large distance from the remaining walls).

Implementation Details

You must implement the function

bool can_escape(std::vector<int> x, std::vector<int> y);

The polygon has NN points given in counterclockwise order: (x[0],y[0])(x[0], y[0]), (x[1],y[1])(x[1], y[1]), ,\ldots, (x[N1],y[N1])(x[N - 1], y[N - 1]). The function returns a single boolean value: true if the answer is Yes and false otherwise.

The judge may call the function multiple times within the same test.

Constraints and Notes

  • 3N1 000 0003 \leq N \leq 1 \ 000 \ 000.
  • x.size()=y.size()=N\text{x.size()} = \text{y.size()} = N
  • Let SS be the sum of the values of NN over all calls to the function within the test.
  • S10 000 000S \leq 10 \ 000 \ 000
  • The polygon does not self-intersect, does not self-touch, and has no consecutive collinear vertices.
  • The maximum absolute value of the coordinates is 1 000 000 0001 \ 000 \ 000 \ 000.
# Score Constraints
1 2 N=3N = 3
2 11 S5 000S \leq 5 \ 000 and the polygon is convex.
3 19 The polygon is convex
4 18 S5 000S \leq 5 \ 000
5 21 S1 000 000S \leq 1 \ 000 \ 000
6 29 No additional restrictions.

Example 1

input

1
7
3 12
6 2
9 8
12 -2
18 6
21 2
23 12

output

Test 1: 1

Explanation

See the drawing in the statement.

Log in or sign up to be able to send submissions!