CF23D.Tetragon

省选/NOI-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You're given the centers of three equal sides of a strictly convex tetragon. Your task is to restore the initial tetragon.

给你一个严格凸四边形三条等长边的中点。你的任务是还原出原始的四边形。

输入格式

The first input line contains one number T — amount of tests (1 ≤ T ≤ 5·104). Each of the following T lines contains numbers _x_1, _y_1, _x_2, _y_2, _x_3, _y_3 — coordinates of different points that are the centers of three equal sides (non-negative integer numbers, not exceeding 10).

第一行输入包含一个数字 TT —— 测试用例的数量(1≤T≤5⋅1041 \leq T \leq 5\cdot10^4)。接下来的 TT 行中,每行包含六个数字 x1,y1,x2,y2,x3,y3x_1, y_1, x_2, y_2, x_3, y_3 —— 分别为三个相等边的中心点的坐标(均为不超过 1010 的非负整数)。

输出格式

For each test output two lines. If the required tetragon exists, output in the first line YES, in the second line — four pairs of numbers — coordinates of the polygon's vertices in clockwise or counter-clockwise order. Don't forget, please, that the tetragon should be strictly convex, i.e. no 3 of its points lie on one line. Output numbers with 9 characters after a decimal point.

If the required tetragon doen't exist, output NO in the first line, and leave the second line empty.

对每个测试用例输出两行。如果所要求的四边形存在,则第一行输出 YES,第二行输出四组数——即该四边形顶点的坐标(按顺时针或逆时针顺序排列)。请注意,该四边形必须是严格凸的,即其任意三点不共线。所有数字需保留小数点后 9 位。

如果所要求的四边形不存在,则第一行输出 NO,第二行留空。

输入输出样例

  • 输入#1

    3
    1 1 2 2 3 3
    0 1 1 0 2 2
    9 3 7 9 9 8

    输出#1

    NO
    
    YES
    3.5 1.5 0.5 2.5 -0.5 -0.5 2.5 0.5
    NO

输入解题思路,AI测评打分。不知道怎么写?

首页