Advertisement
MiinaMagdy

10865 - Brownie Points

Apr 17th, 2023
780
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. /*
  2. +---------------------------------------------+
  3. |                                             |
  4. |       © 17/04/2023 (18:14) MinaMagdy        |
  5. |                                             |
  6. +---------------------------------------------+
  7. */
  8. #include <bits/stdc++.h>
  9. #include <ext/pb_ds/assoc_container.hpp>
  10. #include <ext/pb_ds/tree_policy.hpp>
  11.  
  12. using namespace std;
  13. using namespace __gnu_pbds;
  14. #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
  15. #define multi_ordered_set tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>
  16. #define endl "\n"
  17. #define MOD 1000000007
  18. #define INF 2000000000
  19. #define all(s) s.begin(), s.end()
  20. #define rall(s) s.rbegin(), s.rend()
  21. #define sz(x) int(x.size())
  22.  
  23. typedef long long ll;
  24. typedef long double ld;
  25. typedef unsigned long long ull;
  26. // --------------------------->         GEOMETRY         <---------------------------    
  27. #define EPS 1e-9
  28. #define PI acos(-1)
  29. #define X real()
  30. #define Y imag()
  31. #define angle(a) atan2(a.Y, a.X)
  32. #define vec(a, b) point((b) - (a))
  33. #define length(a) hypot(a.Y, a.X)
  34. #define normalize(a) (a) / length(a)
  35. #define dot_prod(a, b) real(conj(a) * (b))
  36. #define cross_prod(a, b) imag(conj(a) * (b))
  37. #define lengthSqr(p) dot_prod(p, p)
  38. #define rotateO(p, ang) p * exp(point(0, ang))
  39. #define rotateA(p, about, ang) rotateO(vec((about), (p)), ang) + (about)
  40. #define reflicatO(v, m) conj(v / m) * m
  41. #define reflicatA(v, about, m) conj(vec(about, v) / vec(about, m)) * vec(about, m) + about
  42.  
  43. typedef complex<ld> point;
  44. bool cin_point(point &p) {
  45.     double x = -INF, y = -INF;
  46.     cin >> x >> y;
  47.     p = {x, y};
  48.     return x != -INF or y != -INF;
  49. }
  50.  
  51. int solve() {
  52.     int n;
  53.     cin >> n;
  54.     if (!n) return 1;
  55.     vector<point> v(n);
  56.     for (int i = 0; i < n; i++) cin_point(v[i]);
  57.     int a = 0, b = 0;
  58.     for (int i = 0; i < n; i++) {
  59.         int f1 = (v[i].X > v[n / 2].X ? 1 : v[i].X < v[n / 2].X ? -1 : 0);
  60.         int f2 = (v[i].Y > v[n / 2].Y ? 1 : v[i].Y < v[n / 2].Y ? -1 : 0);
  61.         if (f1 * f2 > 0) a++;
  62.         else if (f1 * f2 < 0) b++;
  63.     }
  64.     cout << a << " " << b << endl;
  65.     return 0;
  66. }
  67.  
  68. int main(void)
  69. {
  70.     ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  71.     int testcase = 1;
  72.     // cin >> testcase;
  73.     while (testcase)
  74.         testcase -= solve();
  75.     return 0;
  76. }
Tags: UVA
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement