14C.md (1256B)
1 Source: https://codeforces.com/problemset/problem/14/C 2 3 C. Four Segments 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 64 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Several months later Alex finally got his brother Bob's creation by post. And now, in his turn, Alex wants to boast about something to his brother. He thought for a while, and came to the conclusion that he has no ready creations, and decided to write a program for rectangles detection. According to his plan, the program detects if the four given segments form a rectangle of a positive area and with sides parallel to coordinate axes. As Alex does badly at school and can't write this program by himself, he asks you to help him. 22 23 Input 24 25 The input data contain four lines. Each of these lines contains four integers *x*1, *y*1, *x*2, *y*2 ( - 109 ≤ *x*1, *y*1, *x*2, *y*2 ≤ 109) — coordinates of segment's beginning and end positions. The given segments can degenerate into points. 26 27 Output 28 29 Output the word «YES», if the given four segments form the required rectangle, otherwise output «NO». 30 31 Examples 32 33 Input 34 35 ``` 36 1 1 6 1 37 1 0 6 0 38 6 0 6 1 39 1 1 1 0 40 ``` 41 42 Output 43 44 ``` 45 YES 46 ``` 47 48 Input 49 50 ``` 51 0 0 0 3 52 2 0 0 0 53 2 2 2 0 54 0 2 2 2 55 ``` 56 57 Output 58 59 ``` 60 NO 61 ```