Codeforces Gym 100187H H. Mysterious Photos Water problem

Source: Internet
Author: User

Time Limit:20 Sec

Memory limit:256 MB

Topic Connection

Http://codeforces.com/gym/100187/problem/H

Description

Everyone probably heard the rumours about the constellation of Bermuda Triangle:any person who looks to this constellatio N of three stars is said to disappear completely. Though, it's not clear who then spreads these rumours.

Recently-photos has been sent to the editorial office of the newspaper your work on. Each photo depicts three glowing points on the dark background. The note applied to the photos indicates that they is the photos of the constellation of the Bermuda of Triangle.

Of course, the editors cannot check if it ' s true without the risk of the stuff. But at least it's possible to make sure, each photo depicts the same triple of stars. Remember that photos could is taken with the different zoom and rotation. They could also is taken with the help of a mirror on order to decrease the risk of triggering.

As a regular programmer of the newspaper you has the task to determine if these photos can depict the same triple of Star S.

Input

The input consists of 6 lines. Each of the first three lines contains, integers separated by space-the coordinates of stars on the first photo. Each of the next three lines also contains, integers-the coordinates of stars on the second photo. All coordinates is between-104 and 104, inclusively. Stars on all photo don ' t coincide and don ' t lie on the same line.

Output

Output«yes»if the photos can depict the same triple of Stars And«no»otherwise.

Sample Input

0 0
0 2
1 0
0 0
0 4
2 0

Sample Output

YES

HINT

Test instructions

I'll give you two triangles and ask if you're similar.

Exercises

Just ask if you are similar ...

Code

#include <cstdio>#include<cmath>#include<cstring>#include<ctime>#include<iostream>#include<algorithm>#include<Set>#include<vector>#include<sstream>#include<queue>#include<typeinfo>#include<fstream>#include<map>#include<stack>typedefLong Longll;using namespacestd;//freopen ("d.in", "R", stdin);//freopen ("D.out", "w", stdout);#defineSspeed ios_base::sync_with_stdio (0); Cin.tie (0)#defineTest Freopen ("Test.txt", "R", stdin)#defineMAXN 2001001#defineMoD 1000000009#defineEPS 1e-9Const intinf=0x3f3f3f3f;Constll infll =0x3f3f3f3f3f3f3f3fll;inline ll Read () {ll x=0, f=1;CharCh=GetChar ();  while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();}  while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} returnx*F;}//**************************************************************************************structnode{Doublex, y;};DoubleDis (node A,node b) {return(a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (a.y-b.y);} Node a[3];node b[3];intMain () { for(intI=0;i<3; i++) Cin>>a[i].x>>a[i].y;  for(intI=0;i<3; i++) Cin>>b[i].x>>b[i].y; Doubleaa[Ten]; Doublebb[Ten]; intstep=0;  for(intI=0;i<3; i++)         for(intj=i+1;j<3; j + +) Aa[step++]=dis (a[i],a[j]); Step=0;  for(intI=0;i<3; i++)         for(intj=i+1;j<3; j + +) Bb[step++]=dis (b[i],b[j]); Sort (Aa,aa+3); Sort (BB,BB+3); intflag=0; if(aa[0]/bb[0]==aa[1]/bb[1]&&aa[1]/bb[1]==aa[2]/bb[2]) Flag=1; if(flag) cout<<"YES"<<Endl; Elsecout<<"NO"<<Endl;}

Codeforces Gym 100187H H. Mysterious Photos Water problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.