Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define pb push_back
  4. #define F first
  5. #define S second
  6. #define ll long long
  7. #define ld long double
  8. #define endl '\n'
  9.  
  10. using namespace std;
  11.  
  12. ll p;
  13. int x1[10000], x2[10000], y1[10000], y2[10000];
  14. bool z[10000];
  15.  
  16. int main() {
  17.  
  18. freopen("input.txt", "r", stdin);
  19. freopen("output.txt", "w", stdout);
  20.  
  21. ios_base::sync_with_stdio(0);
  22. cin.tie(0);
  23. cout.tie(0);
  24. for(int i = 0; i < 4; ++i) {
  25. cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];
  26. }
  27. for(int i = 0; i < 3; ++i) {
  28. for(int j = 0; j < (4-i); ++j) {
  29. if ( y1[j] > y1[j + 1] ) {
  30. p = y1[j];
  31. y1[j] = y1[j + 1];
  32. y1[j + 1] = p;
  33. p = y2[j];
  34. y2[j] = y2[j + 1];
  35. y2[j + 1] = p;
  36. }
  37. }
  38. }
  39. if (y2[1] <= y1[3] && y2[2] <= y1[3] ) {
  40. cout << "Horizontal" << endl;
  41. cout << y1[3] << endl;
  42. return 0;
  43. }
  44. for(int i = 0; i < 4; ++i) {
  45. for(int j = 0; j < (4-i); ++j) {
  46. if ( x1[j] > x1[j + 1] ) {
  47. p = x1[j];
  48. x1[j] = x1[j + 1];
  49. x1[j + 1] = p;
  50. p = x2[j];
  51. x2[j] = x2[j + 1];
  52. x2[j + 1] = p;
  53. }
  54. }
  55. }
  56. if (x2[1] <= x1[3] && x2[2] <= x1[3] ) {
  57. cout << "Vertical" << endl;
  58. cout << x1[3] << endl;
  59. return 0;
  60. }
  61. cout << "Impossible";
  62. return 0;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement