2 2 1 21 1
11
1 5 1 101 3
53
4 3 6 61 12 23 13 34 14 2
83
2 2 1 21 1
11
1 5 1 101 3
53
4 3 6 61 12 23 13 34 14 2
83
Thomas has generously provided $$$n$$$ lines in a plane! The lines are in regular position! That is, no two lines are collinear and no three lines intersect at a point.
The lines divide the plane into regions. Formally, points $$$A$$$ and $$$B$$$ are in the same region if and only if the segment $$$\overline{\rm AB}$$$ doesn't intersect a line. Two regions are adjacent if their boundaries overlap on a segment.
Arvind and Zhongtang are going to play a game on the regions. First, Arvind will select a region and color it red. Then turns will proceed as follows: Zhongtang will select a region adjacent to a red region and color it blue, then Arvind will select a region adjacent to a blue region and color it red. The last person who can play wins.
You want prime betting odds. Can you predict the outcome of the game with perfect play?
$$$n \\ a_1 \ b_1 \ c_1 \ d_1 \\ a_2 \ b_2 \ c_2 \ d_2 \\ \ldots \\ a_n \ b_n \ c_n \ d_n$$$
The $$$i$$$-th line passes through lattice points $$$(a_i,b_i)$$$ and $$$(c_i,d_i)$$$.
Constraints
$$$2 \le n \le 2 \cdot 10^5 \\ \max(|a_i|,|b_i|,|c_i|,|d_i|) \le 10^9$$$
"Arvind" or "Zhongtang" (without quotes)
20 0 2 11 1 3 5
Zhongtang
TODO: diagram for sample
51 9 6 9 8
2 4 5
2021 13 34 1 21 7 36 24 44 31 19 46 42 45 35 21 46 16 43 45
12 14 16 18 19 20
51 9 6 9 8
2 4 5
2021 13 34 1 21 7 36 24 44 31 19 46 42 45 35 21 46 16 43 45
12 14 16 18 19 20
7 5 42 1 51 4 91 7 62 5 77 3 32 6 22 3 83 4 104 6 53 1 26 1 10
0 5 2 9 5 0 7 7 2 7 0 10 9 7 10 0
7 5 42 1 51 4 91 7 62 5 77 3 32 6 22 3 83 4 104 6 53 1 26 1 10
0 5 2 9 5 0 7 7 2 7 0 10 9 7 10 0
3 100 1 2
125000001
10 10 9 10
60520013
54 2 9 1 4
1 5
1069 42 1 2 1 46 1 2 1 10
1 6
Egor has an array $$$a_1,a_2,...,a_n$$$ of integers and a permutation $$$p_1,p_2,...,p_n$$$ with $$$i \neq p_i$$$ for all $$$i$$$.
Egor is all about good vibes! He wants to make $$$a_i + a_{p_i}$$$ nonnegative for all $$$i$$$ after applying at most $$$\lfloor \frac{n}{2} \rfloor$$$ operations. In one operation, he will choose $$$x$$$ and negate both $$$a_x$$$ and $$$a_{p_x}$$$.
Help Egor choose the operation sequence!
$$$n \\ a_1 \ a_2 \ \ldots \ a_n \\ p_1 \ p_2 \ \ldots \ p_n$$$
Constraints
$$$n \le 2 \cdot 10^5 \\ |a_i| \le 10^9$$$
$$$x_1 \ x_2 \ \ldots \ x_n$$$
$$$x_i$$$ is the $$$i$$$-th choice of $$$x$$$
43 -4 5 -62 1 4 3
2 2 4
61 -2 1 -2 1 -22 3 4 5 6 1
3 2 3 6
2 2
4 12
5 5
32 14880 744000 8630400 24165120
You are given an undirected disconnected graph $$$G_1$$$ with $$$n$$$ vertices, conveniently labeled $$$1$$$ through $$$n$$$. You can perform the following two operations on $$$G_1$$$:
Now you are given a second graph $$$G_2$$$ with the same vertex set. Transform $$$G_1$$$ into $$$G_2$$$ using at most $$$n^2$$$ of the operations, or say it's impossible.
Input consists of multiple tests. The first line contains $$$t$$$, the number of tests ($$$1 \leq t \leq 250$$$).
The first line of each test contains $$$n$$$, the number of vertices in $$$G_1$$$ and $$$G_2$$$ ($$$2 \leq n \leq 10^3$$$).
The next $$$n$$$ lines each contain strings of length $$$n$$$, consisting of 0s and 1s, which describe $$$G_1$$$. The $$$j$$$-th character of the $$$i$$$-th string (denoted $$$s_{i,j}$$$) is 1 if there is an edge between vertex $$$i$$$ and vertex $$$j$$$, and is 0 otherwise.
The next $$$n$$$ lines each contain strings of length $$$n$$$, describing $$$G_2$$$ in the same format as $$$G_1$$$.
It is guaranteed that for both graphs, and for all $$$1 \leq i, j \leq n$$$, that $$$s_{i,j} = s_{j,i}$$$ and $$$s_{i,i}=0$$$.
It is guaranteed that $$$G_1$$$ is disconnected. It is NOT guaranteed that $$$G_2$$$ is disconnected.
It is guaranteed that the sum of $$$n$$$ across all tests does not exceed $$$10^3$$$.
For each test, if the goal is impossible, output -1.
Otherwise, on the first line, output $$$k$$$, the number of operations you perform ($$$0 \leq k \leq n^2$$$).
On the following $$$k$$$ lines: first output an integer $$$1 \leq type \leq 2$$$ denoting the type of move you wish to perform.
If $$$type=1$$$, then you should also output $$$3$$$ distinct integers $$$1 \leq x, y, z \leq n$$$ such that edges $$$(x,y)$$$ and $$$(y,z)$$$ exist in the graph, but $$$(x,z)$$$ does not. Note that the order in which you output these numbers matters.
If there are multiple possible answers using at most $$$n^2$$$ moves, you can output any. You do not need to minimize the number of moves. We can show that if an answer exists, there is a way to achieve the goal using at most $$$n^2$$$ moves.
2200000110200000000
1 2 2 2 2
2401001000000100100111101111011110401001000000100100100101001010010
3 2 1 4 1 3 1 2 4 1 -1
In the first two sample tests, we start with a graph with $$$2$$$ vertices and no edges.
In the third sample test, the sequence of operations performed looks like this:
In the fourth sample test, we can show there is no answer.
010010100010
1
0001101110001111111000000101
3
010001011011000101101110101011010111011011010100110000000000000000000011
17
41 0 0 2
2 5 2 1 0
71 5 4 2 6 0 3
16 10 0 1 0 0 0 1
Today is Alice's birthday! She invited you and her $$$N-2$$$ other friends to her birthday bash.
The birthday cake is a convex polygons with $$$N$$$ sides such that no two adjacent sides are parallel. Once they sing Happy Birthday, the cake is cut as follows: a point $$$P$$$ is uniformly chosen at random in the interior of the pizza; from point $$$P$$$, $$$N$$$ cuts are made to the corners cake creating $$$N$$$ triangular slices. Since you and Alice are nice, you let your $$$N-2$$$ friends first take a slice, then you take a slice, and Alice gets the last one.
If everyone greedily takes cake slices by area, what is the expected area of your slice?
The first line contains a single integer $$$N$$$ ($$$3 \leq N \leq 200$$$).
The $$$i$$$-th of the following $$$N$$$ lines contains two integers $$$x_i$$$ and $$$y_i$$$: the coordinates of the $$$i$$$-th polygon vertex ($$$-10^5 \leq x_i, y_i \leq 10^5$$$). The $$$x$$$-axis runs from left to right, and the $$$y$$$-axis runs from bottom to top. The vertices are numbered in counterclockwise order.
Print one real number: the expected area of your slice of cake. Your answer will be considered correct if its absolute or relative error does not exceed $$$10^{-6}$$$.
40 01 01 10 1
0.1666666667
10-43 33-35 -3932 -4146 -1250 3050 3449 3842 4937 49-6 44
95.7188121428