ke_timofeeva7

GEOMETRY

Feb 24th, 2022 (edited)
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 4.54 KB | None | 0 0
  1. /*
  2. ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀       ⠀⠀⠀⠀⠀⠀⠀⣠⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  ⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀     ⢀⣠⡯⠀⠀⠀⢠⡐⠀⠀⠀⠀⠀
  3. ⠀⠀⠀⢀⣤⠔⠂⠀⠀⠀⢤⣤⣤⣤⣄⣀⣀⣀⣀⡀⠀⢀⣀⣀⣀⡀⠀⠀⠀⢀⢀⣀⣠⣤⣴⣶⣾⠉⠉⠙⣶⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   ⠀⣰⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀
  4. ⠀⠀⠰⣿⣷⣾⣿⣷⣴⣶⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠉⠛⢿⣿⣿⣿⣿⣿⣿⣿⠿⠿⣿⣶⣿⣿⣿⣿⣤⣂⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣠⣤⣤⣤⣴⣦⣾⣿⣿⣿⣶⣦⣴⣶⣶⠀
  5. ⠀⠀⠀⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣤⣶⣶⣿⣿⣿⣿⣿⣿⣿⣯⣤⣤⣿⡿⠿⠿⠿⠛⠛⠛⠛⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣽⣿⣿⡟⢻⣿⣿⣿⡟⣿⣿⣿⣿⠉⠉⠁⠀
  6. ⠀⠀⠀⣹⣟⣿⣦⠈⠻⠋⢉⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⣿⣿⣿⣠⣾⣿⣿⣏⣤⣾⣿⣿⣿⡆⠀
  7. ⠀⠀⢀⣿⣿⣿⣿⣦⠀⠘⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠟⢿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡧⠀
  8. ⠀⠀⢸⣿⣿⣿⣿⣿⡀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡈⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠛⡄⠀
  9. ⠀⠀⠈⠿⠿⠁⣿⣿⣿⠎⠻⣯⠉⠉⠉⠈⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⢹⣿⢻⠉⠉⠁⠈⠻⢦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠉⠙⠛⠛⢿⣿⠟⠋⠁⠀⠀⠀⠈⠀
  10. ⠀⠀⠀⠀⠀⠀⢹⣿⡟⠀⠀⠈⠳⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⠞⠀⠀⠀⠀⠀⠀⠙⠳⠤⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀    ⠀⠀⠀⠁⠀⠀⠀⠀⠀⠸⣿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀
  11. ⠀⠀⠀⠀⠀⠀⢈⡟⠇⠀⠀⠀⠀⠈⠁⠤⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣶⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀     ⠀⠀⠀⢹⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  12. ⠀⠀⠀⠀⠀⠀⠀⠙⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⠂⠀⠀⠀⠀  ⠀⠀⠀⠀⠀⠀⠀⠀                             ⠀⠀⡘⡀⠀
  13. ⠀⠀⠀⠀⠀⠀                         ⠀⠀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
  14. */
  15.  
  16. #include <iostream>
  17. #include <string>
  18. #include <sstream>
  19. #include <vector>
  20. #include <cmath>
  21. #include <algorithm>
  22. #include <memory.h>
  23. #include <stdio.h>
  24. #include <stack>
  25. #include <deque>
  26. #include <queue>
  27. #include <set>
  28. #include <iterator>
  29. #include <map>
  30. #include <iomanip>
  31. #include <unordered_set>
  32. #include <array>
  33. #include <random>
  34. #include <ctime>
  35. #include <chrono>
  36. #include <cstdlib>
  37. //#define int long long
  38. #define pb push_back
  39. #define fir first
  40. #define sec second
  41. #define double long double
  42. #define endl "\n"
  43. #define un unsigned
  44. #define INF 1000000000009
  45. #define EPS 0.00000001
  46. #define pii pair<int, int>
  47. #define all(v) v.begin(), v.end()
  48. using namespace std;
  49.  
  50. const int N = 1000007, MOD = 1e9 + 7, R = 1 << 20, logn = 19, ABC = 26;
  51. const double PI = acos(-1);
  52.  
  53. mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
  54.  
  55. struct Point
  56. {
  57.     int x, y;
  58.  
  59.     Point(int a, int b) : x(a), y(b) {}
  60.     Point() : x(0), y(0) {}
  61. };
  62.  
  63. struct Vector
  64. {
  65.     Point a;
  66.  
  67.     Vector(Point a) : a(a) {}
  68.     Vector(Point a, Point b) : a({ b.x - a.x, b.y - a.y }) {}
  69.     Vector(int x, int y) : a({ x, y }) {}
  70.     Vector(int x1, int y1, int x2, int y2) : a({ x2 - x1, y2 - y1 }) {}
  71. };
  72.  
  73. istream& operator >> (istream& in, Point& a)
  74. {
  75.     in >> a.x >> a.y;
  76.     return in;
  77. }
  78.  
  79. int dot_product(Point a, Point b)
  80. {
  81.     return a.x * b.x + a.y * b.y;
  82. }
  83.  
  84. int cross_product(Point a, Point b)
  85. {
  86.     return a.x * b.y - a.y * b.x;
  87. }
  88.  
  89. double angle(Point a, Point b)
  90. {
  91.     double an = atan2(cross_product(a, b), dot_product(a, b));
  92.  
  93.     return abs(an);
  94. }
  95.  
  96. signed main()
  97. {
  98.     ios_base::sync_with_stdio(false);
  99.     cin.tie(0);
  100.     cout.tie(0);
  101.     cout.precision(20);
  102.  
  103.     Point a, b, c, p;
  104.     cin >> a >> b >> c >> p;
  105.  
  106.     Vector aa(b, a), bb(b, c), cc(b, p);
  107.  
  108.     double q = angle(aa.a, cc.a), w = angle(cc.a, bb.a), e = angle(aa.a, bb.a);
  109.  
  110.     if (abs(q + w - e) <= EPS)
  111.     {
  112.         cout << "YES";
  113.     }
  114.     else
  115.     {
  116.         cout << "NO";
  117.     }
  118.  
  119.     return 0;
  120. }
  121.  
Add Comment
Please, Sign In to add comment