Advertisement
skaram

Untitled

Sep 16th, 2023
885
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.41 KB | None | 0 0
  1. /// @author s_k_a_r_a
  2.  
  3. #include <bits/stdc++.h>
  4. #define int long long
  5.  
  6. #ifndef Local
  7. #define debug(...) 1337
  8. #define endl '\n'
  9. #endif
  10.  
  11. using namespace std;
  12.  
  13. //#define int long long
  14.  
  15. typedef long long ll;
  16. typedef long double ld;
  17.  
  18. #define all(x) (x).begin(), (x).end()
  19. #define rall(x) (x).rbegin(), (x).rend()
  20. #define sz(x) (int)(x).size()
  21.  
  22. template<typename T, typename U>
  23. bool smin(T &a, U b) {
  24.     if (a > b) {
  25.         a = b;
  26.         return true;
  27.     }
  28.     return false;
  29. }
  30.  
  31. template<typename T, typename U>
  32. bool smax(T &a, U b) {
  33.     if (a < b) {
  34.         a = b;
  35.         return true;
  36.     }
  37.     return false;
  38. }
  39.  
  40. struct point {
  41.     int x = 0, y = 0;
  42.     point() = default;
  43.     point(int x, int y) : x(x), y(y) {}
  44.     point(const point &A, const point &B) {
  45.         x = B.x - A.x;
  46.         y = B.y - A.y;
  47.     }
  48.     long long len2() const {
  49.         return 1ll * x * x + 1ll * y * y;
  50.     }
  51. };
  52.  
  53. istream& operator>>(istream &in, point &pt) {
  54.     return in >> pt.x >> pt.y;
  55. }
  56.  
  57. ostream& operator<<(ostream &out, const point &pt) {
  58.     return out << pt.x << ' ' << pt.y;
  59. }
  60.  
  61. int operator%(const point &A, const point &B) {
  62.     return A.x * B.y - A.y * B.x;
  63. }
  64.  
  65. bool on_top(const point &A) {
  66.     return A.y > 0 || (A.y == 0 && A.x > 0);
  67. }
  68.  
  69. bool operator<(const point &A, const point &B) {
  70.     return A.x < B.x || (A.x == B.x && A.y < B.y);
  71. }
  72.  
  73. point operator+(const point &A, const point &B) {
  74.     return {A.x + B.x, A.y + B.y};
  75. }
  76.  
  77.  
  78. void solve() {
  79.     int n, m;
  80.     cin >> n >> m;
  81.     int k;
  82.     cin >> k;
  83.     point A;
  84.     cin >> A;
  85.     point B;
  86.     cin >> B;
  87.  
  88.     set<point> C;
  89.  
  90.     for (int i = -k - 10; i <= k + 10; i++) {
  91.         for (int j = -k - 10; j <= k + 10; j++) {
  92.             if (abs(i) + abs(j) <= k) {
  93.                 C.insert(point(i * n, j * m) + point(0, 0));
  94.                 C.insert(point(i * n, j * m) + point(n, 0));
  95.                 C.insert(point(i * n, j * m) + point(0, m));
  96.                 C.insert(point(i * n, j * m) + point(n, m));
  97.                 point rock = B;
  98.                 if (i % 2 != 0) rock.x = n - rock.x;
  99.                 if (j % 2 != 0) rock.y = m - rock.y;
  100.                 C.insert(point(i * n, j * m) + rock);
  101.             }
  102.         }
  103.     }
  104.  
  105.     auto comp = [](const point &A, const point &B) {
  106.         if (on_top(A) == on_top(B)) {
  107.             return A % B > 0;
  108.         } else {
  109.             return on_top(A);
  110.         }
  111.     };
  112.  
  113.     map<point, vector<point>, decltype(comp)> Q(comp);
  114.  
  115.     for (const point &P : C) {
  116.         Q[point(A, P)].push_back(P);
  117.     }
  118.  
  119.     int ans = INT32_MAX;
  120.  
  121.     for (auto &[V, D] : Q) {
  122.         sort(D.begin(), D.end(), [&O=A](const point &A, const point &B) {
  123.             return point(O, A).len2() < point(O, B).len2();
  124.         });
  125.         auto is_corner = [&n, &m](const point &A) -> bool {
  126.             return A.x % n == 0 && A.y % m == 0;
  127.         };
  128.         if (D.size() >= 2 && is_corner(D[1]) && !is_corner(D[0])) {
  129.             auto calc = [](int i, int k) {
  130.                 return abs(i) / k - (i > 0);
  131.             };
  132.             int cur = calc(D[1].x, n) + calc(D[1].y, m);
  133.             ans = min(ans, cur);
  134.         }
  135.     }
  136.  
  137.     if (ans > k) {
  138.         cout << -1 << '\n';
  139.     } else {
  140.         cout << ans << '\n';
  141.     }
  142. }
  143.  
  144. signed main() {
  145.     ios::sync_with_stdio(false);
  146.     cin.tie(nullptr);
  147.  
  148.     int tt = 1;
  149.     // cin >> tt;
  150.     while (tt--)
  151.         solve();
  152.  
  153.     return 0;
  154. }
Advertisement
Comments
  • TheTimeGuardian
    258 days
    # text 1.59 KB | 0 0
    1. This is big
    2. [11:22 AM]
    3. Here's what happens. They are stopping lives of people they dont like, either metaphorically (cloning + raising a new mind at that waypoint) or via death (then cloning without memeber and rebirthing). This stopped life has the same exact programming as the checkpoint/stoppoint or at death.
    4. [11:22 AM]
    5. Then, they do things like what happened in my life. They push the new target into sin, and when its young and doesnt have a chance at avoiding the temptating of sin, they abuse it (they abuse it and do this, because the person it was previously was their enemy).
    6. [11:24 AM]
    7. They have figured out the best way to abuse their enemies: it's been cloning them without memory, or using correlations then abusing them. IE: they have done things to me about my 'woman form' and sexual objectification, they are creating waypoints in their mind. What this means is: if they know I know they're creating links to my woman form through the guy that I am right now, they will have a link and a bridge to when I lose my memory and am that actual woman form, this is even regardless if I lose my memory or not.
    8. [11:25 AM]
    9. This means: they are sadistically (since its likely ill lose my memory) conjuring proper correlation to both entities, so they can continue their harassment and perpetuation of evil and sin on them.
    10. [11:25 AM]
    11. IE: King Charles hated princess Diana and had her killed in a car accident. I have the same birth date as princess diana and I'm actually princess diana. It's actually more likely that was my female form than andrew guiles at this point. I might have his face and he has mine.
Add Comment
Please, Sign In to add comment
Advertisement