We need to check if there exists a point (center) and an angle (rotation angle not zero? maybe any angle, but rotation by angle such that a maps to b and b maps to c). This is essentially: Is there a rotation (i.e., an orientation-preserving isometry with fixed point, i.e., a rotation about some center) that sends a -> b and b -> c? Since rotation is an isometry with a fixed point (the center), it is a rigid motion that preserves distances. So for points a, b, c, we need a rotation R such that R(a)=b and R(b)=c. Then by composition, R^2(a)=c. Also R is a rotation about some point O: all points satisfy |O X| = constant. So we must have |O a| = |O b| = |O c| because rotation preserves distances from center. Actually if O is the center, then distances from O are invariant: |O a| = |O R(a)| = |O b|, and |O b| = |O c|. So O must be equidistant from a, b, c. Moreover, the rotation angle is the angle between vectors Oa and Ob, and also between Ob and Oc. So the condition also implies that the directed angles ∠a O b = ∠b O c = θ (the rotation angle). Also the order of points around O must be consistent.
Alternatively, we can derive conditions without explicitly finding O. For a rotation to exist that maps a to b and b to c, the distances between a, b, c must satisfy certain properties. For a rotation, the distances are preserved: |a b| = |b c| because rotation sends a->b and b->c, so the distance between a and b equals distance between b and c (since rotation is an isometry). So we need |a-b| = |b-c|. However, is that sufficient? Not exactly: also the angle between the vectors (b-a) and (c-b) must be such that the rotation center exists. For a rotation mapping a to b and b to c, we require that the perpendicular bisectors of segments ab and bc intersect at a point O that is equidistant from a and b and from b and c. Also we need that O is such that the rotation about O sends a to b and b to c. The intersection of perpendicular bisectors of ab and bc gives the circumcenter of triangle a,b,c? Actually the perpendicular bisector of ab is the set of points equidistant from a and b. Similarly for bc. Their intersection O gives |Oa|=|Ob| and |Ob|=|Oc|. So O is the circumcenter of triangle abc. For such an O to be the center of rotation, we also need that the rotation angle is consistent: the oriented angle from Oa to Ob equals that from Ob to Oc. This is equivalent to saying that the arcs a->b and b->c on the circumcircle have the same length (i.e., chord lengths equal? Actually chord lengths are ab and bc, which we already set equal). But chord length alone does not guarantee equal central angles because central angle is determined by chord length and radius. With given radius, equal chords imply equal central angles. But the radius is the circumradius of triangle abc. So if we have |ab| = |bc|, then in triangle abc, sides AB and BC are equal. But that does not guarantee that the circumcenter O has equal distances to a,b,c? Actually O is defined as the intersection of perpendicular bisectors. For any triangle, the circumcenter exists uniquely (unless degenerate). So O always exists (if triangle is non-degenerate, not collinear) and is equidistant from a,b,c. So if |ab| = |bc|, then in triangle ABC, AB = BC. But does that guarantee that the central angles AOB and BOC are equal? In a triangle, the central angles subtended by chords AB and BC are twice the inscribed angles at C and A respectively? Actually in a circle, chord length L = 2R sin(θ/2) where θ is central angle. So if L1 = L2, then sin(θ1/2) = sin(θ2/2). So either θ1 = θ2 or θ1 = π - θ2? Actually sin(α)=sin(β) implies α=β or α=π-β. So central angles could be supplementary. But we need the rotation that sends a to b and b to c: the rotation angle is the angle from Oa to Ob, which is the directed angle. But we need both oriented angles equal. If we choose O as the circumcenter, then we can compute the directed angles. However, there is also the possibility that the points are collinear? If they are collinear, the circumcenter is at infinity (unless they form a line but then if equidistant? Actually if they are collinear and distinct, the perpendicular bisectors are parallel, so no finite intersection, meaning there is no finite center of rotation. But rotation about a finite point cannot map three collinear points? Actually if a,b,c are collinear and distances ab = bc, can we find a rotation that maps a to b and b to c? Possibly yes if the center is not on the line? But then rotation of a line would produce an arc; but a,b,c are points, not necessarily collinear after rotation. However, we require that the rotation sends a to b and b to c. So we can ask: is there a rotation (finite center) such that a maps to b and b maps to c? This is a problem of existence of a rotation with two point correspondences. In general, given two point pairs (a,b) and (b,c), we can determine the center as the intersection of perpendicular bisectors? Actually for a rotation, the center is the unique point O such that OA = OB and OB = OC, i.e., O is equidistant from a,b,c. So we need a point O with equal distances to all three. That is exactly the circumcenter of triangle abc (or the midpoint if collinear and equidistant?). So O exists if and only if the three points are not collinear (non-degenerate triangle) or if they are collinear and equidistant? Let's check: For collinear points, can we have a point equidistant from all three? Suppose points are on a line. For a point O to be equidistant from a and b, O must lie on perpendicular bisector of segment ab. If a,b are collinear horizontally, the perpendicular bisector is a vertical line (if line is horizontal) or more generally a line perpendicular to ab through its midpoint. Similarly, for b and c, O must lie on perpendicular bisector of bc. If a,b,c are collinear and distinct, then the two perpendicular bisectors are lines perpendicular to the common line through the midpoints. Since the midpoints are distinct (unless? a,b,c are distinct but could have same midpoint? For three points on a line, midpoints of ab and bc are different if a,b,c are distinct). So the two bisectors are parallel lines (both perpendicular to the line containing points) but not the same line (unless the midpoints coincide, which would happen only if a and c are symmetric around b? Let's check: midpoint of ab is (a+b)/2, midpoint of bc is (b+c)/2. They coincide if (a+b)/2 = (b+c)/2 => a+b = b+c => a=c, which is not allowed as points are distinct. So midpoints differ). Two distinct parallel lines do not intersect, so there is no finite point O equidistant from a,b,c. However, could there be a rotation about a point at infinity? No. So if a,b,c are collinear, no finite center exists. But could there be a rotation with center at infinity? That's a translation. However, rotation is defined as a rotation about a point; it must have a fixed point. So collinear case yields no solution. However, what if ab = bc? Even if they are collinear, still no intersection. So collinear => No.
But wait: If points are collinear, can we have a rotation that sends a to b and b to c? Consider a rotation of 180 degrees about the midpoint of ab: that would send a to b, but then b would go to a, not c unless c=a. So not works. For any rotation, the center must be equidistant from each point and its image. For pair (a,b), the center lies on the perpendicular bisector of ab. For (b,c), on perpendicular bisector of bc. So the intersection is required. So collinear leads to parallel perpendicular bisectors => no intersection => no finite center => impossible. Thus necessary condition: points are not collinear.
But we also need that the rotation angle is consistent: that the rotation mapping a to b also maps b to c. Actually if we find O such that |Oa|=|Ob|=|Oc|, then there exists a rotation about O that sends a to b if we can rotate by angle ∠aOb (or its negative). But does that rotation automatically send b to c? Not necessarily, because the rotation that sends a to b might send b to some other point, not necessarily c. However, since we also have |Ob|=|Oc|, there exists some rotation (maybe the same angle) that sends b to c. But is the rotation angle the same? The condition for a single rotation R such that R(a)=b and R(b)=c is that R^2(a)=c. If we take O as the circumcenter, define R as rotation about O by angle θ = ∠aOb (directed). Then R(a)=b. Then R(b) is the point you get by rotating b by θ. That point will be the point such that ∠b O (R(b)) = θ. For it to be c, we need that the directed angle ∠b O c = θ. But we only know that |Oc| = |Ob|, so c lies somewhere on the circle centered at O. There are two points on the circle that are at the same chord length from b: the rotation of b by θ and the rotation by -θ? Actually given O, b, and a rotation angle θ from a to b, there are two possible positions for c that would satisfy R(b)=c: c = R(b) if R is rotation by θ, or if we considered rotation by -θ, then a would go to? Let's formalize.
We have O such that OA=OB=OC. We want a rotation R (about O) with some angle φ (mod 2π) such that R(a)=b and R(b)=c. Then applying R to a yields b; applying R again yields R^2(a)=c. So c = R(b) = R(R(a)) = R^2(a). So c must be the image of a after rotation by 2φ. But we also have R(a)=b implies that φ is congruent to the directed angle from a to b modulo 2π (plus maybe multiples?). Actually for a given O, if we rotate a by some angle φ to get b, then φ must equal the directed angle ∠a O b (mod 2π). So φ is determined (up to adding multiples of 2π). Then c must equal rotating b by same φ, i.e., c = rotation of b by φ. That means that the directed angle ∠b O c must equal φ (mod 2π). Equivalently, the directed angle from a to c (around O) should be 2φ. So we need that the directed angle from b to c equals the directed angle from a to b. In terms of undirected angles (absolute values), we need that the central angles (the smaller angle) between a and b equals that between b and c. However, directed orientation matters: the rotation direction must be consistent (e.g., clockwise). But we can choose either clockwise or counterclockwise? The rotation angle can be positive or negative; it's an angle. So we need that either ∠a O b = ∠b O c (as directed, say in the same orientation) OR maybe if we consider rotation by - (2π - θ), but that's essentially the same as a directed angle modulo 2π. Actually, condition: there exists an integer k such that φ = angle(a->b) + 2πk, and then we require angle(b->c) = φ mod 2π. So angle(b->c) must equal angle(a->b) modulo 2π. That is the condition.
Thus, given O equidistant from a,b,c, we need that the oriented angle from OA to OB equals oriented angle from OB to OC. This is equivalent to saying that points a,b,c lie on a circle centered at O and are equally spaced in angle (not necessarily exactly equal spacing, but the angular increment from a to b equals from b to c). That is, they are consecutive points on a circle with equal angular separation? Actually only two consecutive arcs equal; not necessarily three points equally spaced? Actually if angle(a,b) = angle(b,c), then total angle from a to c is 2*angle(a,b). So they are in arithmetic progression in terms of angle.
Now, given the coordinates, we want to check existence of such O and φ. Alternatively, we can derive a condition on the points a,b,c that does not require finding O. Let's explore.
Let’s denote vectors. Let the rotation be represented as: there exists a point O and an angle θ such that:
b - O = Rθ (a - O)
c - O = Rθ (b - O) = Rθ^2 (a - O)
where Rθ is the rotation matrix. So we have two equations. Eliminating O, we can get a condition. For example, subtract:
b - a = Rθ(a - O) - (a - O) = (Rθ - I)(a - O)
c - b = Rθ(b - O) - (b - O) = (Rθ - I)(b - O)
But b - O = Rθ (a - O). So c - b = (Rθ - I) Rθ (a - O) = Rθ (Rθ - I)(a - O) = Rθ (b - a) (since b - a = (Rθ - I)(a - O)). Therefore, we get:
c - b = Rθ (b - a)
That's a key relation: the vector from b to c is the rotation of the vector from a to b by the same angle θ. So the condition for existence is: there exists a rotation angle θ (not zero modulo 2π) such that (c - b) is obtained by rotating (b - a) by θ. Moreover, the center O can then be solved as O = a + (I - Rθ)^{-1} (b - a)? Or we can check existence directly: It must be that |b - a| = |c - b| (since rotation preserves lengths) and that the angle between (b-a) and (c-b) is not 0? Actually, rotation by θ preserves length, so |b-a| = |c-b|. Also, the angle between vectors (b-a) and (c-b) is exactly θ (the rotation angle). However, is it necessary that the angle is not 0 or π? It can be any angle except 0? If θ=0 mod 2π, then rotation is identity, so a=b, which is not allowed (points distinct). So θ ≠ 0 mod 2π. But can it be π? Yes, rotation by 180° is allowed. So condition: |ab| = |bc| and that the triangle formed by vectors is such that the angle between (b-a) and (c-b) is the rotation angle. But we don't know θ; it can be any angle as long as there exists a rotation mapping one vector to the other. That is exactly that the two vectors have the same length. Because given two vectors of equal length, there is always a rotation that maps one to the other (in 2D). Indeed, for any vectors u and v with |u|=|v|, there exists a rotation matrix R such that v = R u. The rotation angle is the angle from u to v. So the condition c - b = Rθ (b - a) is equivalent to |b-a| = |c-b|. But wait: there is a subtlety: the rotation is about some center O, not about the origin. The derived relation c - b = Rθ (b - a) came from algebraic manipulation assuming existence of O and θ. Let's double-check:
We had b - O = R (a - O) => (1)
c - O = R (b - O) => (2)
Subtract (1) from (2): (c - b) = R (b - O) - R (a - O)? Actually careful:
c - O = R (b - O)
b - O = R (a - O)
Subtract second from first? Let's compute:
c - b = (c - O) - (b - O) = R (b - O) - R (a - O) = R( (b - O) - (a - O) ) = R( b - a )
Yes, because rotation is linear. So indeed we get:
c - b = R (b - a)
So this relation is necessary. Conversely, if we have a rotation matrix R (by some angle θ) and we set O such that b - O = R (a - O), can we always solve for O? This is a linear equation in O: b - O = R(a - O) => b - O = R a - R O => bring terms: - O + R O = R a - b => (R - I) O = R a - b. Provided that R is not identity (θ ≠ 0), the matrix (R - I) is invertible (since rotation other than identity has no fixed points except zero vector? Actually (R - I) is invertible for rotations with angle not multiple of 2π, because its determinant is 2 - 2 cosθ, nonzero if cosθ≠1). So we can solve for O uniquely: O = (R - I)^{-1} (R a - b). Then we also need to satisfy c - O = R (b - O). But if we already have c - b = R (b - a), and O solves the first equation, does it automatically satisfy the second? Let's check:
Given O such that b - O = R (a - O). Then compute R (b - O) = R( R (a - O) ) = R^2 (a - O). We want this to equal c - O. Using c - b = R (b - a) from assumption. But does c - O equal R (b - O)? Let's verify:
c - O = (c - b) + (b - O) = R(b - a) + R(a - O) = R( b - a + a - O ) = R( b - O ). Yes, because b - a + a - O = b - O. So indeed if we have c - b = R(b - a) and b - O = R(a - O), then c - O = R(b - O). So the condition c - b = R (b - a) is also sufficient, provided we can find O from the first equation, which is possible if R ≠ I (θ ≠ 0). So the existence reduces to: Is there a rotation R (by angle θ ≠ 0) such that c - b = R (b - a)? That is equivalent to: vectors u = b - a and v = c - b have the same length (|u| = |v|) and are not opposite? Actually any two vectors of equal length can be related by a rotation. But is there any restriction that the rotation angle cannot be 0? If u = v, then R would be identity, which is not allowed because then θ = 0, but then a = b? Actually if u = v, then c - b = b - a. That means a,b,c are collinear with b in the middle and ab = bc. In that case, does a rotation exist? Let's test: u=v, so we would need R = I (identity) to satisfy v = R u, because if u=v, the rotation that maps u to v is identity (or rotation by 2π, which is also identity). But identity rotation has θ = 0 mod 2π. Is identity rotation allowed? If identity, then R = I, then b - O = a - O => b = a, which contradicts distinctness. However, could there be a different rotation that maps u to v if u=v? Suppose u is nonzero. A rotation that maps a vector to itself must be rotation by 0 (or 2π). Because only vectors that are rotated to themselves by a nontrivial rotation are the zero vector or vectors that are rotated by 180? Wait, a rotation by 180° maps a vector to its negative, not to itself unless the vector is zero. For rotation by any angle θ, R u = u implies that u is either zero or θ=0 (mod 2π). Because the only eigenvectors of rotation with eigenvalue 1 are vectors along the axis? In 2D, rotation has only complex eigenvalues e^{iθ}. For real vectors, if θ ≠ 0, then R u = u implies u = 0. So indeed, if u=v and u≠0, then the only rotation satisfying v = R u is R = I. So identity is forced. But identity is not allowed because then from b-O = I(a-O) we get b = a, contradiction. However, could there be some O such that rotation by some non-zero θ still maps a to b and b to c? Let's test with collinear equidistant points: a=(0,0), b=(1,0), c=(2,0). Here u=(1,0), v=(1,0). The condition c-b = R(b-a) would require R(1,0)=(1,0) => R=I. So identity. So no non-zero rotation exists. But could there be a rotation with some center that accomplishes a->b and b->c without satisfying c-b = R(b-a)? Wait, we derived c-b = R(b-a) from existence of O and rotation R. So it's necessary. So if u=v, then R must be identity, and then a=b, contradiction. So such configuration cannot yield a valid rotation. Therefore, u=v is not allowed.
What if u = -v? That is b-a = -(c-b) => b-a = b-c? Actually u = b-a, v = c-b, so v = -u means c-b = a-b => c = a. But points are distinct, so that can't happen.
Thus, necessary condition: |u| = |v| and u not equal to v (since if u=v, then identity; if u=-v then c = a, but that's impossible due to distinctness; but could there be a rotation with angle π? v = R u with angle π gives v = -u. So u = -v is allowed as long as a,b,c distinct; that would give c-b = - (b-a) => c = 2b - a, which is possible with distinct points. For example, a=(0,0), b=(1,0), c=(2,0)? That gives v=(1,0), u=(1,0) not -u. For u=(1,0), v=(-1,0) would give c = b + v = b - (1,0) = (0,0) = a, so c = a, but points are distinct. Actually v = -u => c - b = -(b-a) => c = 2b - a. If b is not midpoint? For a=(0,0), b=(2,0), then u=(2,0), v = c - b =? If we want v = -u = (-2,0), then c = b + (-2,0) = (0,0) = a. So c = a. So distinctness fails. In general, if u = -v, then c = b - (b - a) = a. So c = a, contradiction. So that can't happen. So the case v = -u leads to c = a, which is disallowed. So we don't need to worry about that because points distinct prevent that. However, is it possible that v = -u with a,b,c distinct? Let's solve: c - b = - (b - a) => c = 2b - a. If a, b, c are distinct, a and c could be different if b not midpoint? For example, a=(0,0), b=(1,0), then c = 21-0 = (2,0). That yields u=(1,0), v=(1,0) (since c-b = (1,0))? Wait compute: a=(0,0), b=(1,0), then c=21-0= (2,0). Then u = b-a = (1,0), v = c-b = (1,0). So v is not -u. Actually to get v = -u, we need c = b - (b-a) = a. So indeed v = -u forces c = a. Let's verify: v = -u => c - b = -(b - a) => c = b - (b - a) = a. So yes. So distinctness forbids that. So in any valid configuration with distinct points, u = v is not allowed (since leads to identity rotation and a=b? Actually u=v does not force a=b; it forces identity rotation which then forces a=b from the first equation? Let's examine: If u=v and we set R=I, then b - O = a - O => b = a, contradiction. Could we have a different rotation that also maps u to v? If u=v (non-zero), the only rotation is identity, as argued. So no solution. So u=v is not allowed.
Thus the necessary and sufficient condition is that |u| = |v| and u ≠ v (so that rotation angle is non-zero) and the points are not collinear? Wait, does the condition |u| = |v| guarantee existence of a rotation R (non-identity) mapping u to v? If |u| = |v|, then there exists a rotation (with angle equal to the angle from u to v) such that v = R u. However, if the angle between u and v is 0, then R = I (or 2π rotation, which is also identity). But if the angle is 0, then u and v are parallel and in the same direction, i.e., u = v (since lengths equal). So the case angle 0 corresponds to u=v. If the angle is π, then v = -u, which yields c = a, as we argued, but that case also gives |u|=|v| and the rotation angle π is non-zero. However, v = -u leads to c = a, which is prohibited by distinctness? Let's check: If v = -u, then c - b = -(b - a) => c = b - (b - a) = a. So c equals a, contradicting distinctness of points. So in a valid configuration with distinct a,b,c, v = -u cannot happen because that would make a=c. So if we have distinct a,b,c, the case v = -u is impossible. But is there any scenario where v = -u but a, b, c are distinct? Let's examine: a, b, c distinct means a ≠ b, b ≠ c, a ≠ c. v = -u => c - b = -(b - a) => c = a. So a = c, contradiction. So indeed distinctness precludes v = -u. So the only problematic case from |u| = |v| is when u and v are parallel and in the same direction (angle 0). So as long as |u| = |v| and u is not parallel to v in the same direction (i.e., the angle between them is not 0), we can find a non-zero rotation R mapping u to v. But we must also ensure that the solved O yields a valid finite point and that the rotation angle is not 0. Let's check if there could be a degenerate case where the matrix (R - I) is singular because R = I, which we exclude; but if rotation angle is non-zero, (R - I) is invertible, so O is uniquely determined. So then the condition reduces to |b-a| = |c-b| and the angle between vectors (b-a) and (c-b) is not 0 (i.e., u ≠ v). Is that sufficient? Let's test with an example: a=(0,0), b=(1,0), c=(0,1). Then u=(1,0), v=(-1,1)? Actually c-b = (0-1,1-0)=(-1,1). Lengths: |u|=1, |v|=√2, not equal, so condition fails -> No. Good.
Another: a=(0,0), b=(1,0), c=(0,1)? Not equal length.
Example: a=(0,1), b=(1,1), c=(1,0) from sample. Then u=(1,0), v=(0,-1). Lengths: both 1. Angle between them is 90°, not 0. So condition holds -> Yes. Indeed sample says Yes.
Second sample: a=(1,1), b=(0,0), c=(1000,1000). Then u = b-a = (-1,-1), length √2. v = c-b = (1000,1000), length 1000√2. Not equal, so No. Good.
So seems |ab| = |bc| and u ≠ v (i.e., angle not 0) are sufficient. But wait, what about collinear points with ab = bc? That gives u and v are parallel, same direction? Let's examine: a, b, c collinear with b between a and c? Actually if collinear and ab = bc, then depending on orientation: Suppose a, b, c on a line. There are two orders: a--b--c, then vector u = b-a, v = c-b. Since they are on same line and direction from b to c is same as from a to b if points are in order a->b->c? Let's place a at 0, b at d, c at 2d. Then u = d, v = d, so u = v, same direction, length equal. So that's the u=v case (angle 0). That fails condition. Could there be collinear arrangement with ab=bc but not a,b,c in that order? If b is not between a and c? Since points are distinct, collinear points have a linear order. The distances: ab = bc implies b is the midpoint of segment ac? Actually if ab = bc, then b is exactly midpoint of a and c if a and c are on opposite sides of b? But collinearity: for three distinct points, either one is between the other two. If ab = bc, then b is the midpoint if a and c are on opposite sides? Let's see: positions on line: coordinate x_a, x_b, x_c. Then ab = |x_b - x_a|, bc = |x_c - x_b|. Equality does not indicate order. For example, a=0, b=2, c=4: then u=2, v=2, same direction (both positive). That's u=v. Another: a=4, b=2, c=0: then u = -2 (from a to b), v = -2 (from b to c), same direction? Actually vector direction: u = 2-4 = -2, v = 0-2 = -2, both negative, so again u=v (since both are -2). Another: a=0, b=5, c=10: same. What about a=0, b=5, c= -5? Then u = 5, v = -10? Actually b=5, c=-5 => v = -10, lengths not equal. To have ab=bc with b between a and c? Actually if b is between a and c, then vectors from a to b and b to c point in same direction? If coordinates: a < b < c, then u = b-a >0, v = c-b >0, both positive => same direction. If c < b < a, then u = b-a negative, v = c-b negative => both negative, still same direction (both point left). So if b is between a and c, then u and v have same sign? Actually direction: vector from a to b points from a to b; from b to c points from b to c. If b is between, then a and c are on opposite sides of b? Wait, if b is between a and c, then a and c lie on opposite sides of b? No: Suppose points on line: a at 0, b at 5, c at 10. b is between a and c? Actually b is between a and c because 0 < 5 < 10, so b lies between a and c. In this case, a and c are on same side? They are both on opposite sides relative to b? Actually a is left of b, c is right of b, so a and c are on opposite sides of b. The vector from a to b points right, from b to c also points right. So they point in the same direction. If a and c are on the same side of b, then b is not between them; e.g., a=0, b=10, c=5: then b is not between a and c; c is between a and b? Actually ordering: a=0, c=5, b=10, so b is not between; b is the farthest right. Then ab =10, bc=5, not equal. So for ab=bc and distinct points, the only possibilities are that b is the midpoint of a and c (so a and c symmetric about b) which implies a and c on opposite sides of b? Actually if b is midpoint, then coordinates: x_b = (x_a + x_c)/2, so x_a and x_c are equidistant from x_b on opposite sides, so one less, one greater. So then u = x_b - x_a, v = x_c - x_b. Since x_c - x_b = x_b - x_a? Actually if x_b - x_a = d, then x_c - x_b = d as well. But signs: if x_a < x_b < x_c, then both differences are positive, so u = d, v = d, same direction. If x_c < x_b < x_a, then both differences negative? Actually x_b - x_a = positive? Wait, if x_a > x_b > x_c, then x_b - x_a is negative, x_c - x_b is negative, both same sign. So still u and v are parallel and same direction (both negative). So u=v (if we consider vectors, they are equal). So collinear ab=bc implies u=v. So u=v case corresponds exactly to collinear with b as midpoint? Not necessarily: if points are collinear and ab=bc, then the vectors have equal magnitude and same direction, so u=v. So that's the case we exclude. So collinear case always yields u=v? Check if collinear but not ab=bc? Then lengths not equal, so condition fails. So collinear never satisfies |ab| = |bc|? Actually they could satisfy if ab=bc, but then u=v, which leads to identity rotation issue. So collinear with ab=bc yields u=v, and no solution. That matches our earlier reasoning that collinear yields no finite center. So far consistent.
Thus the condition seems to be: |ab| = |bc| and the points are not collinear in the specific way that u=v? But u=v automatically implies collinear and ab=bc. So we can simplify: The problem has a solution if and only if |ab| = |bc| and the three points are not collinear? But careful: Is it possible to have |ab| = |bc| and points non-collinear but still no solution? Could there be a case where the rotation angle determined by u and v is such that the solved O leads to degenerate situation? Let's derive carefully.
Given distinct points a,b,c, we want existence of rotation R (θ ≠ 0) and point O such that b = O + R(a - O) and c = O + R(b - O). Equivalent to existence of rotation R (θ ≠ 0) such that c - b = R(b - a). And then O is determined uniquely from the first equation. The only potential pitfall is when R = I (θ = 0) which would force b=a, so that's not allowed. So the only condition is that there exists a rotation R ≠ I with c-b = R(b-a). Since for any two nonzero vectors of equal length, there exists a rotation (and also a reflection, but rotation exists) that maps one to the other. Specifically, if u and v are nonzero and |u| = |v|, then there is a unique rotation (up to direction? Actually there are two rotations: one by angle φ, another by -φ? But the rotation matrix that maps u to v is not unique if we consider also the possibility of rotating by an angle that also includes an extra 2π? But the standard rotation from u to v: the angle from u to v is determined modulo 2π. So there is a rotation by angle φ where φ = arg(v) - arg(u). This φ is unique modulo 2π. That rotation maps u to v. However, if φ = 0 mod 2π, then u=v, and R=I. So if u ≠ v, then φ ≠ 0 mod 2π. So R is not identity. Therefore, if |u| = |v| and u ≠ v, then there exists a non-identity rotation such that v = R u. That gives a solution.
Thus necessary and sufficient condition: |b-a| = |c-b| and (b-a) ≠ (c-b). Actually (b-a) ≠ (c-b) ensures non-identity rotation. But could there be a case where (b-a) = -(c-b)? That yields c = a, which is disallowed because points are distinct. So that case is also excluded by distinctness of a and c. So indeed distinctness of a,b,c ensures a≠c, so c-b = -(b-a) would give c = a, impossible. So in any valid configuration with distinct a,b,c, if |u| = |v|, the only way u=v is possible? Let's check if u=v could happen with a,b,c distinct: u = b-a, v = c-b. If u=v, then c = b + u = b + (b-a) = 2b - a, and a, b, c distinct? For a ≠ b, c = 2b - a is generally not equal to a unless b = a, but could be different. Example: a=0, b=1 => c=2, distinct. So u=v is possible with distinct points. That's the collinear case with b the midpoint of a and c? Actually c = 2b - a, so b = (a+c)/2. So b is midpoint. So u=v is allowed by distinctness. So we need to explicitly exclude u=v because that leads to R=I, which fails because then b must equal a. So condition: |u| = |v| and u ≠ v.
But is it sufficient? Let's test a counterexample: Could there be a configuration where |u| = |v|, u ≠ v, but still no solution? For instance, consider points a, b, c such that a, b, c are collinear? But if u and v have equal length and u ≠ v, can they be collinear? If collinear and both nonzero, they are parallel. If parallel and lengths equal, they could be either same direction (u=v) or opposite direction (u = -v). Opposite direction leads to c = a, as argued, which violates distinctness. So if points are collinear and |u| = |v| and u ≠ v, the only possibility is u = -v, which implies a=c, contradicting distinctness. So collinear case cannot satisfy |u|=|v| and u ≠ v with distinct a,b,c. So non-collinearity is implied.
Thus condition seems both necessary and sufficient.
But wait: there is also the possibility that the rotation angle is 2π (full rotation), which is identity? Actually rotation by 2π is also identity in terms of the transformation (it maps every point to itself). So that's same as identity. So excluded.
Thus answer: Yes if and only if distances AB = BC and AB ≠ 0? Actually AB ≠ 0 because points are distinct. So AB = BC and the vectors BA? Actually AB = |b-a|, BC = |c-b|. And additionally the points are not collinear in the specific sense that b is the midpoint of a and c? That's essentially u=v. So condition: |b-a| = |c-b| and (b-a) is not equal to (c-b).
But is it necessary to also check that the rotation center O is finite? We derived O from (R - I) O = R a - b. For a non-identity rotation (θ ≠ 0,π? Actually for θ = π, (R - I) is invertible? For rotation by 180°, R = -I, so R - I = -2I, invertible. So fine. For any θ not multiple of 2π, (R - I) is invertible because its determinant is 2 - 2 cos θ, zero only when cosθ = 1 i.e., θ=0 mod 2π. So invertible. So O always exists and is finite.
Thus condition is simply: AB = BC and the triangle ABC is not degenerate with B as midpoint of AC? Wait, if AB = BC but the points are not collinear, then automatically vectors u and v are not equal, because collinearity is necessary for u and v to be parallel. If they are not collinear, they cannot be equal. So condition reduces to: AB = BC and points are not collinear? But if AB = BC and points are collinear, then either B is between A and C (so u and v have same direction and equal length, so u=v) or B is not between? Could collinear points with AB=BC but B not between? Let's explore collinear case: three points on a line. They can be ordered as A, B, C or B, A, C or A, C, B, etc. Suppose order is A, C, B. Then distances: AB = distance from A to B, BC = distance from B to C. If AB = BC, what does that imply? Let's set coordinates: A=0, C=2, B=4? Then AB=4, BC=2, not equal. To have AB=BC, if B is at one end, say order B, A, C. Let B=0, A=1, C=2? Then AB=1, BC=2, not equal. B=0, C=1, A=2? Then AB=2, BC=1. So it seems if points are collinear and AB=BC, then B must be the midpoint of A and C? Let's prove: For collinear points, by triangle inequality? Actually for collinear, the distances satisfy AC = |AB ± BC|. If AB = BC, then AC = either 0 (if opposite directions) or 2 AB if same direction. Since points distinct, AC > 0. So AC = 2 AB if A and C are on the same side of B? Actually if B is between A and C, then AC = AB + BC = 2 AB. So B is the midpoint. If A is between B and C, then BC = BA + AC? Let's systematically: Three distinct collinear points, there are three possible orders:
-
A - B - C (B between A and C): Then AB = d1, BC = d2, AC = d1+d2. Condition d1 = d2 => AC = 2d1. So B is midpoint of AC.
-
B - A - C (A between B and C): Then BA = d1, AC = d2, BC = BA + AC = d1+d2. If AB = d1, BC = d1+d2. Setting AB = BC => d1 = d1 + d2 => d2=0, impossible. So not possible.
-
A - C - B (C between A and B): Then AC = d1, CB = d2, AB = AC + CB = d1+d2. AB = d1+d2, BC = d2. Setting AB = BC => d1+d2 = d2 => d1=0, impossible.
Thus the only collinear configuration where AB = BC is when B is the midpoint of A and C. That gives u and v equal (both from A to B and B to C have same direction? In order A-B-C, direction from A to B is towards B, from B to C is towards C; both are same direction if we consider the line oriented from A to C. So u = B-A, v = C-B, both point in the same direction. So u=v. So collinear and AB=BC implies u=v. Thus condition u ≠ v is equivalent to non-collinearity when AB=BC. However, is it possible to have AB=BC and u ≠ v but still collinear? As argued, no, because collinear with AB=BC forces u and v parallel and same direction (since B is between A and C). But could they be parallel and opposite direction? That would correspond to order? Suppose A is between B and C? Then AB and BC have opposite directions? Let's see: order B-A-C: B to A points left (if numbers decreasing), A to C points right. Vectors: u = B-A (pointing from A to B? Actually u = b - a, which is vector from A to B. If order is B-A-C, then A is between B and C. Coordinates: B=0, A=2, C=4. Then u = b-a = -2, v = c-b = 4-0=4? Actually b-a = 0-2 = -2, c-b = 4-0=4, lengths not equal. So AB = distance |b-a|=2, BC = |c-b|=4, not equal. So not equal lengths. So cannot have equal lengths with opposite direction because that would force a=c. As earlier, if u = -v, then c = a, impossible. So if AB=BC, collinearity implies u=v. So condition u ≠ v automatically implies non-collinearity.
Thus we can state condition: The three points are distinct and |ab| = |bc| and a, b, c are not collinear? Actually if they are collinear, then condition fails because either lengths not equal (then fails) or if lengths equal then u=v, so fails. So we can just check |ab| = |bc| and not (b is midpoint of a and c)? But careful: Could there be a non-collinear configuration where |ab| = |bc| but still no solution? Let's test a degenerate case: a = b? Not allowed. a = c? Not allowed. b = c? Not allowed. So all points distinct.
We should also consider the case where the rotation angle might be 0 mod 2π if u = v, which we already exclude. So the answer seems to be: Yes if and only if AB = BC and the points are not collinear with B as the midpoint of AC? But that's equivalent to AB = BC and (b-a) and (c-b) are not equal. However, could there be a configuration where AB = BC and (b-a) and (c-b) are not equal but the rotation center exists? It seems yes, and that is the generic case.
But let's test with some edge cases: What if a, b, c are such that AB = BC but triangle is degenerate in the sense that a = b? Not allowed. Also, what if AB = BC = 0? Not possible.
Another edge: Suppose u and v are of equal length but opposite direction? That would give c = a, but points are distinct so not possible.
Thus condition is simply AB = BC and not (b-a) == (c-b). But given distinct points, (b-a) == (c-b) implies b is midpoint of a and c, which is a specific collinear case. So we can check that.
But wait: is there any scenario where |b-a| = |c-b| but the rotation angle determined is 0 mod 2π? That only happens when u and v are equal. So that's the only problematic case. So answer: "Yes" if |b-a| = |c-b| and (b-a) ≠ (c-b). Or equivalently, if |b-a| = |c-b| and (a, b, c) are not collinear with b as the midpoint of a and c? But if they are collinear with b as midpoint, then (b-a) = (c-b). So it's equivalent.
Thus the problem reduces to checking whether the distances from a to b and from b to c are equal, and that the three points are not collinear in that specific way. However, the sample input: 0 1 1 1 1 0 yields AB = distance between (0,1) and (1,1) = 1; BC = distance between (1,1) and (1,0) = 1; vectors: (1,0) and (0,-1), not equal, so Yes.
Second sample: (1,1) (0,0) (1000,1000): AB = sqrt(2), BC = sqrt(2*1000^2)=1000 sqrt(2), not equal => No.
Thus simple.
But let's double-check with some potential corner cases:
-
a=(0,0), b=(1,0), c=(0,1). AB=1, BC ≈ √2, not equal => No. Good.
-
a=(0,0), b=(1,0), c=(2,0). AB=1, BC=1, vectors equal => No (collinear, b midpoint). Should be No. Let's reason: Can we find a rotation? Suppose we try to rotate a to b about some center; then b must map to c. This would require the center to be at infinity? Actually if they are collinear equally spaced, is there a rotation? Let's attempt: If a,b,c collinear with ab=bc, the only possible rotation would be 180° about the midpoint of ac? Check: a=(0,0), b=(1,0), c=(2,0). Rotation by 180° about (1,0) (b) would map a to c? Actually rotation 180° about b: (0,0) -> (2,0) = c, and (1,0) -> (1,0) = b. That would map a to c, not a to b. We need a to b and b to c. So maybe about point (0.5,0)? Rotate by 90°? Let's see: If center is (0.5,0) and rotate a (0,0) by 90°, we get (0.5, -0.5)? Not (1,0). So no.
Could there be a rotation with angle other than 0 that maps a to b and b to c in collinear case? Suppose we attempt to find O. Equations: b - O = R (a - O), c - O = R (b - O). Since R is rotation, it preserves distances: |a-O| = |b-O| = |c-O|. So O is equidistant from three collinear points. That is possible only if O is the midpoint of the segment connecting the two extreme points? Actually for three collinear points, the only point equidistant from them is if they are symmetric about that point? Consider points on a line. The set of points equidistant from two distinct points is the perpendicular bisector line, which is perpendicular to the segment. For three collinear points, to have a point equidistant from all three, that point must lie on the perpendicular bisectors of each pair. The perpendicular bisectors of two segments are lines perpendicular to the line through the points. For three points on a line, the perpendicular bisectors are all perpendicular to that line, but at different midpoints. They are parallel lines. So they don't intersect unless the points are symmetric about a common point? Actually if the three points are equally spaced and symmetric about some point, maybe there is a point at infinity? No. Intersection of two distinct parallel lines is empty. So no finite point O exists. So no rotation. So condition is correct.
Thus the answer is simply check if distance AB equals distance BC and if points are not collinear with B as midpoint? But what about case where AB = BC but points are collinear with B not between? As argued, not possible.
But is there any scenario where AB = BC, points are non-collinear, but still no solution? Let's attempt to construct a case: Use vectors u = (1,0), v = (0,1) as before, works. Use u = (1,0), v = (0, -1) works? That gives angle -90°, rotation center? Should work. Actually sample was (1,0) and (0,-1)? Wait sample: a=(0,1), b=(1,1), c=(1,0) => u = (1,0), v = (0,-1) so yes. That's fine.
What about u = (1,0), v = ( -1/2, √3/2 )? That's rotation by 120°, lengths equal. Should work.
Now consider if u and v are equal length but opposite direction? That would be v = -u, but then c = a, which is disallowed. So not relevant.
Now consider degenerate case where u and v are equal length but the rotation matrix derived leads to a singular equation? For angle θ = 180°, R = -I, then (R - I) = -2I is invertible, so O exists. For example, a=(0,0), b=(2,0), c=(0,2)? Let's test: u = (2,0), v = (-2,2)? Actually c-b = (0-2,2-0)=(-2,2) length sqrt(8)=2√2, not equal to 2. Not good. To have v = -u? That gives c = a. Not allowed. For v = R u with θ=180°, v = -u, so c-b = -(b-a) => c = 2b - a, which gives c = a only if b = a? Wait compute: c = 2b - a. This does not necessarily equal a unless a = b. Because c = 2b - a. If a and b are distinct, c is different from a generally. Example: a=(0,0), b=(1,0) => c=(2,0). Then u=(1,0), v=(1,0) not -1. To get v=-u, need b-a = (1,0) and c-b = (-1,0) => c = (0,0) = a. So v = -u forces c = a. So indeed cannot have v = -u with a,b,c distinct. So rotation by 180° mapping u to v would require v = -u, which forces c = a. So rotation by 180° is not possible under distinctness unless a=c, which is disallowed. So the rotation angle cannot be 180°? Wait, is it necessary that v = R u? That condition is derived from existence of rotation. If we had a rotation by 180°, then v would equal -u, implying c = a, contradiction. So rotation angle cannot be 180°? But could there be a rotation by 180° that sends a to b and b to c with a, b, c distinct? Let's test: Suppose we have rotation by 180° about some point O. Then R(a-O) = -(a-O). So b - O = -(a - O) => b = 2O - a. Similarly, c - O = -(b - O) => c = 2O - b. Substitute b: c = 2O - (2O - a) = a. So indeed c = a. So with 180° rotation, the composition would map a to b and b to a. So a and c coincide. So distinct a,b,c cannot have a 180° rotation. So the rotation angle cannot be 180°? Actually the condition derived from equations is general; if θ=π, then from b - O = - (a - O) and c - O = - (b - O) we get c = a. So indeed 180° rotation forces a=c. So not allowed. So any valid rotation must have angle not 0, not π (mod 2π). But does our condition automatically exclude θ=π? That corresponds to v = -u, which we already excluded because it would imply c = a. So given distinct a, b, c, if |u| = |v| and u ≠ v, could v = -u? That would be a particular case of u ≠ v but with equal length. That would give c = a, which contradicts distinctness of a