跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1184. Contact

    ID: 1190 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 10 上传者: 标签>计算几何数学挑战难度共享题库Codeforces英文题面题目来源题面语言

Contact

题目描述

E. Contact
time limit per test
3 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Little Petya is preparing for the first contact with aliens. He knows that alien spaceships have shapes of non-degenerate triangles and there will be exactly 4 ships. Landing platform for a ship can be made of 3 special columns located at some points of a Cartesian plane such that these 3 points form a triangle equal to the ship with respect to rotations, translations (parallel shifts along some vector) and reflections (symmetries along the edges). The ships can overlap after the landing.

Each column can be used to land more than one ship, for example, if there are two equal ships, we don't need to build 6 columns to land both ships, 3 will be enough. Petya wants to know what minimum number of columns will be enough to land all ships.

Input

Each of 4 lines will contain 6 integers x1 y1 x2 y2 x3 y3 (0≤x1,y1,x2,y2,x3,y3≤20), representing 3 points that describe the shape of each of 4 ships. It is guaranteed that 3 points in each line will represent a non-degenerate triangle.

Output

First line should contain minimum number of columns enough to land all spaceships.

Examples
Input
0 0 1 0 1 2
0 0 0 2 2 2
0 0 3 0 1 2
0 0 3 0 2 2
Output
4
Input
0 0 0 1 1 1
0 0 0 2 2 2
0 0 0 5 5 5
0 0 0 17 17 17
Output
9
Note

In the first test case columns can be put in these points: (0,0),(1,0),(3,0),(1,2). Note that the second ship can land using last 3 columns.

In the second test case following points can be chosen: (0,0),(0,1),(1,0),(0,2),(2,0),(0,5),(5,0),(0,17),(17,0). It is impossible to use less than 9 columns.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 657 题。保留原作者与原赛事署名。