QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#903415#10087. ArchaeologyRed Phobia (Koki Takano, Yuma Hamaguchi, Saku Mizuhara)AC ✓2ms3840kbC++2321.1kb2025-02-17 11:56:412025-02-17 11:56:54

Judging History

This is the latest submission verdict.

  • [2025-02-17 11:56:54]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3840kb
  • [2025-02-17 11:56:41]
  • Submitted

answer

#line 1 "sol.cpp"
#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rrep(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define ALL(v) (v).begin(), (v).end()
#define UNIQUE(v) sort(ALL(v)), (v).erase(unique(ALL(v)), (v).end())
#define SZ(v) (int)v.size()
#define MIN(v) *min_element(ALL(v))
#define MAX(v) *max_element(ALL(v))
#define LB(v, x) int(lower_bound(ALL(v), (x)) - (v).begin())
#define UB(v, x) int(upper_bound(ALL(v), (x)) - (v).begin())

using uint = unsigned int;
using ll = long long int;
using ull = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;
const int inf = 0x3fffffff;
const ll INF = 0x1fffffffffffffff;

template <typename T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return 1;
    }
    return 0;
}
template <typename T, typename U> T ceil(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? (x + y - 1) / y : x / y);
}
template <typename T, typename U> T floor(T x, U y) {
    assert(y != 0);
    if (y < 0)
        x = -x, y = -y;
    return (x > 0 ? x / y : (x - y + 1) / y);
}
template <typename T> int popcnt(T x) {
    return __builtin_popcountll(x);
}
template <typename T> int topbit(T x) {
    return (x == 0 ? -1 : 63 - __builtin_clzll(x));
}
template <typename T> int lowbit(T x) {
    return (x == 0 ? -1 : __builtin_ctzll(x));
}

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "P(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &map_var) {
    os << "{";
    for (auto itr = map_var.begin(); itr != map_var.end(); itr++) {
        os << "(" << itr->first << ", " << itr->second << ")";
        itr++;
        if (itr != map_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
template <typename T> ostream &operator<<(ostream &os, const set<T> &set_var) {
    os << "{";
    for (auto itr = set_var.begin(); itr != set_var.end(); itr++) {
        os << *itr;
        ++itr;
        if (itr != set_var.end())
            os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
#ifdef LOCAL
#define show(...) _show(0, #__VA_ARGS__, __VA_ARGS__)
#else
#define show(...) true
#endif
template <typename T> void _show(int i, T name) {
    cerr << '\n';
}
template <typename T1, typename T2, typename... T3>
void _show(int i, const T1 &a, const T2 &b, const T3 &...c) {
    for (; a[i] != ',' && a[i] != '\0'; i++)
        cerr << a[i];
    cerr << ":" << b << " ";
    _show(i + 1, a, c...);
}

/**
 * @brief template
 */

using T = long double;
const T eps = 1e-8;
using Point = complex<T>;
using Poly = vector<Point>;
#define X real()
#define Y imag()
template <typename T> inline bool eq(const T &a, const T &b) {
    return fabs(a - b) < eps;
}
bool cmp(const Point &a, const Point &b) {
    auto sub = [&](Point a) {
        return (a.Y < 0 ? -1 : (a.Y == 0 && a.X >= 0 ? 0 : 1));
    };
    if (sub(a) != sub(b))
        return sub(a) < sub(b);
    return a.Y * b.X < a.X * b.Y;
}
struct Line {
    Point a, b, dir;
    Line() {}
    Line(Point _a, Point _b) : a(_a), b(_b), dir(b - a) {}
    Line(T A, T B, T C) {
        if (eq(A, (T).0)) {
            a = Point(0, C / B), b = Point(1 / C / B);
        } else if (eq(B, (T).0)) {
            a = Point(C / A, 0), b = Point(C / A, 1);
        } else {
            a = Point(0, C / B), b = Point(C / A, 0);
        }
    }
};
struct Segment : Line {
    Segment() {}
    Segment(Point _a, Point _b) : Line(_a, _b) {}
};
struct Circle {
    Point p;
    T r;
    Circle() {}
    Circle(Point _p, T _r) : p(_p), r(_r) {}
};

istream &operator>>(istream &is, Point &p) {
    T x, y;
    is >> x >> y;
    p = Point(x, y);
    return is;
}
ostream &operator<<(ostream &os, Point &p) {
    os << fixed << setprecision(12) << p.X << ' ' << p.Y;
    return os;
}
Point unit(const Point &a) {
    return a / abs(a);
}
T dot(const Point &a, const Point &b) {
    return a.X * b.X + a.Y * b.Y;
}
T cross(const Point &a, const Point &b) {
    return a.X * b.Y - a.Y * b.X;
}
Point rot(const Point &a, const T &theta) {
    return Point(cos(theta) * a.X - sin(theta) * a.Y,
                 sin(theta) * a.X + cos(theta) * a.Y);
}
Point rot90(const Point &a) {
    return Point(-a.Y, a.X);
}
T arg(const Point &a, const Point &b, const Point &c) {
    double ret = acos(dot(a - b, c - b) / abs(a - b) / abs(c - b));
    if (cross(a - b, c - b) < 0)
        ret = -ret;
    return ret;
}

Point Projection(const Line &l, const Point &p) {
    T t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}
Point Projection(const Segment &l, const Point &p) {
    T t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
    return l.a + (l.a - l.b) * t;
}
Point Reflection(const Line &l, const Point &p) {
    return p + (Projection(l, p) - p) * (T)2.;
}
int ccw(const Point &a, Point b, Point c) {
    b -= a;
    c -= a;
    if (cross(b, c) > eps)
        return 1; // ccw

    if (cross(b, c) < -eps)
        return -1; // cw

    if (dot(b, c) < 0)
        return 2; // c,a,b

    if (norm(b) < norm(c))
        return -2; // a,b,c

    return 0; // a,c,b
}
bool isOrthogonal(const Line &a, const Line &b) {
    return eq(dot(a.b - a.a, b.b - b.a), (T).0);
}
bool isParallel(const Line &a, const Line &b) {
    return eq(cross(a.b - a.a, b.b - b.a), (T).0);
}
bool isIntersect(const Segment &a, const Segment &b) {
    return ccw(a.a, a.b, b.a) * ccw(a.a, a.b, b.b) <= 0 and
           ccw(b.a, b.b, a.a) * ccw(b.a, b.b, a.b) <= 0;
}
int isIntersect(const Circle &a, const Circle &b) {
    T d = abs(a.p - b.p);
    if (d > a.r + b.r + eps)
        return 4;
    if (eq(d, a.r + b.r))
        return 3;
    if (eq(d, abs(a.r - b.r)))
        return 1;
    if (d < abs(a.r - b.r) - eps)
        return 0;
    return 2;
}
T Dist(const Line &a, const Point &b) {
    Point c = Projection(a, b);
    return abs(c - b);
}
T Dist(const Segment &a, const Point &b) {
    if (dot(a.b - a.a, b - a.a) < eps)
        return abs(b - a.a);
    if (dot(a.a - a.b, b - a.b) < eps)
        return abs(b - a.b);
    return abs(cross(a.b - a.a, b - a.a)) / abs(a.b - a.a);
}
T Dist(const Segment &a, const Segment &b) {
    if (isIntersect(a, b))
        return (T).0;
    T res = min({Dist(a, b.a), Dist(a, b.b), Dist(b, a.a), Dist(b, a.b)});
    return res;
}
Point Intersection(const Line &a, const Line &b) {
    T d1 = cross(a.b - a.a, b.b - b.a);
    T d2 = cross(a.b - a.a, a.b - b.a);
    if (eq(d1, (T)0.) and eq(d2, (T)0.))
        return b.a;
    return b.a + (b.b - b.a) * (d2 / d1);
}
Poly Intersection(const Circle &a, const Line &b) {
    Poly res;
    T d = Dist(b, a.p);
    if (d > a.r + eps)
        return res;
    Point h = Projection(b, a.p);
    if (eq(d, a.r)) {
        res.push_back(h);
        return res;
    }
    Point e = unit(b.b - b.a);
    T ph = sqrt(a.r * a.r - d * d);
    res.push_back(h - e * ph);
    res.push_back(h + e * ph);
    return res;
}
Poly Intersection(const Circle &a, const Segment &b) {
    Line c(b.a, b.b);
    Poly sub = Intersection(a, c);
    double xmi = min(b.a.X, b.b.X), xma = max(b.a.X, b.b.X);
    double ymi = min(b.a.Y, b.b.Y), yma = max(b.a.Y, b.b.Y);
    Poly res;
    rep(i, 0, sub.size()) {
        if (xmi <= sub[i].X + eps and sub[i].X - eps <= xma and
            ymi <= sub[i].Y + eps and sub[i].Y - eps <= yma) {
            res.push_back(sub[i]);
        }
    }
    return res;
}
Poly Intersection(const Circle &a, const Circle &b) {
    Poly res;
    int mode = isIntersect(a, b);
    T d = abs(a.p - b.p);
    if (mode == 4 or mode == 0)
        return res;
    if (mode == 3) {
        T t = a.r / (a.r + b.r);
        res.push_back(a.p + (b.p - a.p) * t);
        return res;
    }
    if (mode == 1) {
        if (b.r < a.r - eps) {
            res.push_back(a.p + (b.p - a.p) * (a.r / d));
        } else {
            res.push_back(b.p + (a.p - b.p) * (b.r / d));
        }
        return res;
    }
    T rc = (a.r * a.r + d * d - b.r * b.r) / d / (T)2.;
    T rs = sqrt(a.r * a.r - rc * rc);
    if (a.r - abs(rc) < eps)
        rs = 0;
    Point e = unit(b.p - a.p);
    res.push_back(a.p + rc * e + rs * e * Point(0, 1));
    res.push_back(a.p + rc * e + rs * e * Point(0, -1));
    return res;
}
Poly HalfplaneIntersection(vector<Line> &H) {
    sort(ALL(H), [&](Line &l1, Line &l2) { return cmp(l1.dir, l2.dir); });
    auto outside = [&](Line &L, Point p) -> bool {
        return cross(L.dir, p - L.a) < -eps;
    };
    deque<Line> deq;
    int sz = 0;
    rep(i, 0, SZ(H)) {
        while (sz > 1 and
               outside(H[i], Intersection(deq[sz - 1], deq[sz - 2]))) {
            deq.pop_back();
            sz--;
        }
        while (sz > 1 and outside(H[i], Intersection(deq[0], deq[1]))) {
            deq.pop_front();
            sz--;
        }
        if (sz > 0 and fabs(cross(H[i].dir, deq[sz - 1].dir)) < eps) {
            if (dot(H[i].dir, deq[sz - 1].dir) < 0) {
                return {};
            }
            if (outside(H[i], deq[sz - 1].a)) {
                deq.pop_back();
                sz--;
            } else
                continue;
        }
        deq.push_back(H[i]);
        sz++;
    }

    while (sz > 2 and outside(deq[0], Intersection(deq[sz - 1], deq[sz - 2]))) {
        deq.pop_back();
        sz--;
    }
    while (sz > 2 and outside(deq[sz - 1], Intersection(deq[0], deq[1]))) {
        deq.pop_front();
        sz--;
    }
    if (sz < 3)
        return {};
    deq.push_back(deq.front());
    Poly ret;
    rep(i, 0, sz) ret.push_back(Intersection(deq[i], deq[i + 1]));
    return ret;
}

T Area(const Poly &a) {
    T res = 0;
    int n = a.size();
    rep(i, 0, n) res += cross(a[i], a[(i + 1) % n]);
    return fabs(res / (T)2.);
}
T Area(const Poly &a, const Circle &b) {
    int n = a.size();
    if (n < 3)
        return (T).0;
    auto rec = [&](auto self, const Circle &c, const Point &p1,
                   const Point &p2) {
        Point va = c.p - p1, vb = c.p - p2;
        T f = cross(va, vb), res = (T).0;
        if (eq(f, (T).0))
            return res;
        if (max(abs(va), abs(vb)) < c.r + eps)
            return f;
        if (Dist(Segment(p1, p2), c.p) > c.r - eps)
            return c.r * c.r * arg(vb * conj(va));
        auto u = Intersection(c, Segment(p1, p2));
        Poly sub;
        sub.push_back(p1);
        for (auto &x : u)
            sub.push_back(x);
        sub.push_back(p2);
        rep(i, 0, sub.size() - 1) res += self(self, c, sub[i], sub[i + 1]);
        return res;
    };
    T res = (T).0;
    rep(i, 0, n) res += rec(rec, b, a[i], a[(i + 1) % n]);
    return fabs(res / (T)2.);
}
T Area(const Circle &a, const Circle &b) {
    T d = abs(a.p - b.p);
    if (d >= a.r + b.r - eps)
        return (T).0;
    if (d <= abs(a.r - b.r) + eps) {
        T r = min(a.r, b.r);
        return M_PI * r * r;
    }
    T ath = acos((a.r * a.r + d * d - b.r * b.r) / d / a.r / (T)2.);
    T res = a.r * a.r * (ath - sin(ath * 2) / (T)2.);
    T bth = acos((b.r * b.r + d * d - a.r * a.r) / d / b.r / (T)2.);
    res += b.r * b.r * (bth - sin(bth * 2) / (T)2.);
    return fabs(res);
}
bool isConvex(const Poly &a) {
    int n = a.size();
    int cur, pre, nxt;
    rep(i, 0, n) {
        pre = (i - 1 + n) % n;
        nxt = (i + 1) % n;
        cur = i;
        if (ccw(a[pre], a[cur], a[nxt]) == -1)
            return 0;
    }
    return 1;
}
int isContained(const Poly &a,
                const Point &b) { // 0:not contain,1:on edge,2:contain

    bool res = 0;
    int n = a.size();
    rep(i, 0, n) {
        Point p = a[i] - b, q = a[(i + 1) % n] - b;
        if (p.Y > q.Y)
            swap(p, q);
        if (p.Y < eps and eps < q.Y and cross(p, q) > eps)
            res ^= 1;
        if (eq(cross(p, q), (T).0) and dot(p, q) < eps)
            return 1;
    }
    return (res ? 2 : 0);
}
Poly ConvexHull(Poly &a) {
    sort(ALL(a), [](const Point &p, const Point &q) {
        return (eq(p.Y, q.Y) ? p.X < q.X : p.Y < q.Y);
    });
    a.erase(unique(ALL(a)), a.end());
    int n = a.size(), k = 0;
    Poly res(n * 2);
    for (int i = 0; i < n; res[k++] = a[i++]) {
        while (k >= 2 and
               cross(res[k - 1] - res[k - 2], a[i] - res[k - 1]) < eps)
            k--;
    }
    for (int i = n - 2, t = k + 1; i >= 0; res[k++] = a[i--]) {
        while (k >= t and
               cross(res[k - 1] - res[k - 2], a[i] - res[k - 1]) < eps)
            k--;
    }
    res.resize(k - 1);
    return res;
}
T Diam(const Poly &a) {
    int n = a.size();
    int x = 0, y = 0;
    rep(i, 1, n) {
        if (a[i].Y > a[x].Y)
            x = i;
        if (a[i].Y < a[y].Y)
            y = i;
    }
    T res = abs(a[x] - a[y]);
    int i = x, j = y;
    do {
        if (cross(a[(i + 1) % n] - a[i], a[(j + 1) % n] - a[j]) < 0)
            i = (i + 1) % n;
        else
            j = (j + 1) % n;
        chmax(res, abs(a[i] - a[j]));
    } while (i != x or j != y);
    return res;
}
Poly Cut(const Poly &a, const Line &l) {
    int n = a.size();
    Poly res;
    rep(i, 0, n) {
        Point p = a[i], q = a[(i + 1) % n];
        if (ccw(l.a, l.b, p) != -1)
            res.push_back(p);
        if (ccw(l.a, l.b, p) * ccw(l.a, l.b, q) < 0)
            res.push_back(Intersection(Line(p, q), l));
    }
    return res;
}

T Closest(Poly &a) {
    int n = a.size();
    if (n <= 1)
        return 0;
    sort(ALL(a), [&](Point a, Point b) {
        return (eq(a.X, b.X) ? a.Y < b.Y : a.X < b.X);
    });
    Poly buf(n);
    auto rec = [&](auto self, int lb, int rb) -> T {
        if (rb - lb <= 1)
            return (T)INF;
        int mid = (lb + rb) >> 1;
        auto x = a[mid].X;
        T res = min(self(self, lb, mid), self(self, mid, rb));
        inplace_merge(a.begin() + lb, a.begin() + mid, a.begin() + rb,
                      [&](auto p, auto q) { return p.Y < q.Y; });
        int ptr = 0;
        rep(i, lb, rb) {
            if (abs(a[i].X - x) >= res)
                continue;
            rep(j, 0, ptr) {
                auto sub = a[i] - buf[ptr - 1 - j];
                if (sub.Y >= res)
                    break;
                chmin(res, abs(sub));
            }
            buf[ptr++] = a[i];
        }
        return res;
    };
    return rec(rec, 0, n);
}

Circle Incircle(const Point &a, const Point &b, const Point &c) {
    T A = abs(b - c), B = abs(c - a), C = abs(a - b);
    Point p(A * a.X + B * b.X + C * c.X, A * a.Y + B * b.Y + C * c.Y);
    p /= (A + B + C);
    T r = Dist(Line(a, b), p);
    return Circle(p, r);
}
Circle Circumcircle(const Point &a, const Point &b, const Point &c) {
    Line l1((a + b) / (T)2., (a + b) / (T)2. + (b - a) * Point(0, 1));
    Line l2((b + c) / (T)2., (b + c) / (T)2. + (c - b) * Point(0, 1));
    Point p = Intersection(l1, l2);
    return Circle(p, abs(p - a));
}
Poly tangent(const Point &a, const Circle &b) {
    return Intersection(b, Circle(a, sqrt(norm(b.p - a) - b.r * b.r)));
}
vector<Line> tangent(const Circle &a, const Circle &b) {
    vector<Line> res;
    T d = abs(a.p - b.p);
    if (eq(d, (T)0.))
        return res;
    Point u = unit(b.p - a.p);
    Point v = u * Point(0, 1);
    for (int t : {-1, 1}) {
        T h = (a.r + b.r * t) / d;
        if (eq(h * h, (T)1.)) {
            res.push_back(Line(a.p + (h > 0 ? u : -u) * a.r,
                               a.p + (h > 0 ? u : -u) * a.r + v));
        } else if (1 > h * h) {
            Point U = u * h, V = v * sqrt(1 - h * h);
            res.push_back(Line(a.p + (U + V) * a.r, b.p - (U + V) * (b.r * t)));
            res.push_back(Line(a.p + (U - V) * a.r, b.p - (U - V) * (b.r * t)));
        }
    }
    return res;
}

/**
 * @brief Geometry
 */

#line 2 "library/Utility/random.hpp"

namespace Random {
mt19937_64 randgen(chrono::steady_clock::now().time_since_epoch().count());
using u64 = unsigned long long;
u64 get() {
    return randgen();
}
template <typename T> T get(T L) { // [0,L]
    return get() % (L + 1);
}
template <typename T> T get(T L, T R) { // [L,R]
    return get(R - L) + L;
}
double uniform() {
    return double(get(1000000000)) / 1000000000;
}
string str(int n) {
    string ret;
    rep(i, 0, n) ret += get('a', 'z');
    return ret;
}
template <typename Iter> void shuffle(Iter first, Iter last) {
    if (first == last)
        return;
    int len = 1;
    for (auto it = first + 1; it != last; it++) {
        len++;
        int j = get(0, len - 1);
        if (j != len - 1)
            iter_swap(it, first + j);
    }
}
template <typename T> vector<T> select(int n, T L, T R) { // [L,R]
    if (n * 2 >= R - L + 1) {
        vector<T> ret(R - L + 1);
        iota(ALL(ret), L);
        shuffle(ALL(ret));
        ret.resize(n);
        return ret;
    } else {
        unordered_set<T> used;
        vector<T> ret;
        while (SZ(used) < n) {
            T x = get(L, R);
            if (!used.count(x)) {
                used.insert(x);
                ret.push_back(x);
            }
        }
        return ret;
    }
}

void relabel(int n, vector<pair<int, int>> &es) {
    shuffle(ALL(es));
    vector<int> ord(n);
    iota(ALL(ord), 0);
    shuffle(ALL(ord));
    for (auto &[u, v] : es)
        u = ord[u], v = ord[v];
}
template <bool directed, bool simple> vector<pair<int, int>> genGraph(int n) {
    vector<pair<int, int>> cand, es;
    rep(u, 0, n) rep(v, 0, n) {
        if (simple and u == v)
            continue;
        if (!directed and u > v)
            continue;
        cand.push_back({u, v});
    }
    int m = get(SZ(cand));
    vector<int> ord;
    if (simple)
        ord = select(m, 0, SZ(cand) - 1);
    else {
        rep(_, 0, m) ord.push_back(get(SZ(cand) - 1));
    }
    for (auto &i : ord)
        es.push_back(cand[i]);
    relabel(n, es);
    return es;
}
vector<pair<int, int>> genTree(int n) {
    vector<pair<int, int>> es;
    rep(i, 1, n) es.push_back({get(i - 1), i});
    relabel(n, es);
    return es;
}
}; // namespace Random

/**
 * @brief Random
 */
#line 574 "sol.cpp"

ll N, godx, gody;

pair<ll, ll> Query(ll x, ll y) {
    cout << x << ' ' << y << endl;

    // if (godx == x and gody == y) {
    //     exit(0);
    // } else {
    //     for (;;) {
    //         ll u = Random::get(1LL, N);
    //         ll v = Random::get(1LL, N);
    //         ll val = (godx - x) * (u - x) + (gody - y) * (v - y);
    //         if (val > 0) {
    //             return {u, v};
    //         }
    //     }
    // }

    ll RX, RY;
    cin >> RX >> RY;
    if (x == RX && y == RY)
        exit(0);
    return {RX, RY};
}

Point Gravity(vector<Line> LS) {
    Poly P = HalfplaneIntersection(LS);
    Point P0 = P[0];
    for (auto &p : P)
        p -= P0;
    Point Ret(0.0L, 0.0L);
    rep(i, 0, SZ(P)) {
        Point LP = P[i], RP = P[(i + 1) % SZ(P)];
        Ret += ((LP + RP) / 3.0L) * (cross(LP, RP) / 2.0L);
    }
    Ret /= Area(P);
    return Ret + P0;
}

int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cerr << fixed << setprecision(20);

    cin >> N;
    godx = Random::get(1LL, N);
    gody = Random::get(1LL, N);

    if (N <= 9) {
        rep(i, 1, N + 1) {
            rep(j, 1, N + 1) {
                Query(i, j);
            }
        }
    }
    vector<Point> ZZ;
    ZZ.push_back(Point(0.005L, 0.005L));
    ZZ.push_back(Point((long double)N - 0.005L, 0.005L));
    ZZ.push_back(Point((long double)N - 0.005L, (long double)N - 0.005L));
    ZZ.push_back(Point(0.005L, (long double)N - 0.005L));
    vector<Line> LS;
    rep(i, 0, 4) LS.push_back(Line(ZZ[i], ZZ[(i + 1) % 4]));
    int _ = 80;
    while (_--) {
        Point G = Gravity(LS);
        ll x = round(G.real()), y = round(G.imag());
        if (x <= 0)
            x = 1;
        if (x > N)
            x = N;
        if (y <= 0)
            y = 1;
        if (y > N)
            y = N;
        auto [RX, RY] = Query(x, y);
        Point A((long double)x, (long double)y);
        Point B((long double)RX, (long double)RY);
        Point C = rot90(B - A);
        LS.push_back(Line(A + C, A));
    }
    Point G = Gravity(LS);
    ll x = round(G.real()), y = round(G.imag());
    rep(dx, -1, 2) rep(dy, -1, 2) {
        Query(x + dx, y + dy);
    }

    show(godx, gody);
    Poly _P = HalfplaneIntersection(LS);
    for (auto &p : _P)
        show(p.X, p.Y);
    show(G.X, G.Y);
    assert(0);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3584kb

input:

1
1 1

output:

1 1

result:

ok guessed correctly in 1 attempt

Test #2:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

2
2 2
1 2

output:

1 1
1 2

result:

ok guessed correctly in 2 attempts

Test #3:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

2
1 2
2 1
1 2
2 2

output:

1 1
1 2
2 1
2 2

result:

ok guessed correctly in 4 attempts

Test #4:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

2
1 1

output:

1 1

result:

ok guessed correctly in 1 attempt

Test #5:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

2
2 1
2 1
2 1

output:

1 1
1 2
2 1

result:

ok guessed correctly in 3 attempts

Test #6:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

4
4 3
2 3
2 4
1 4

output:

1 1
1 2
1 3
1 4

result:

ok guessed correctly in 4 attempts

Test #7:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

8
2 2
5 1
1 4
1 8
3 5
2 7
6 2
8 5
6 8
1 4
5 2
2 7
2 7
6 7
6 8
6 2
4 6
4 6
8 3
2 6
7 2
3 7
4 1
6 4
5 8
4 7
7 4
6 8
6 5
7 2
8 4
8 7
8 8
7 6
8 1
8 8
4 8
6 5
6 3
8 5
4 7
2 7
5 5
1 8
8 5
8 3
8 8
6 3
5 7
4 3
4 5
7 6
8 5
8 7
8 2
7 3
7 5
3 6
7 7
4 5
6 8
1 7
8 7

output:

1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
4 1
4 2
4 3
4 4
4 5
4 6
4 7
4 8
5 1
5 2
5 3
5 4
5 5
5 6
5 7
5 8
6 1
6 2
6 3
6 4
6 5
6 6
6 7
6 8
7 1
7 2
7 3
7 4
7 5
7 6
7 7
7 8
8 1
8 2
8 3
8 4
8 5
8 6
8 7

result:

ok guessed correctly in 63 attempts

Test #8:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

15
11 6
13 4
14 14
7 13
11 9
10 11
13 8

output:

7 7
11 7
11 4
13 6
12 6
12 7
13 8

result:

ok guessed correctly in 7 attempts

Test #9:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

30
27 16
18 26
6 17
25 28
22 10
16 13
7 3
20 5
23 17

output:

15 15
22 15
22 23
18 21
19 24
21 21
21 20
21 19
23 17

result:

ok guessed correctly in 9 attempts

Test #10:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

60
10 48
8 57
10 53
40 40
59 57
5 15
8 54
13 55
4 46
1 48
40 60
20 60
24 55
17 55
50 60
12 58
12 54

output:

30 30
19 39
18 49
9 47
13 48
16 54
15 50
14 52
14 53
13 53
12 53
12 53
12 53
12 53
12 53
12 53
12 54

result:

ok guessed correctly in 17 attempts

Test #11:

score: 0
Accepted
time: 1ms
memory: 3456kb

input:

120
61 46
81 85
38 79
102 20
56 43
27 23
70 38
9 8
48 97
71 75
85 3
1 26
88 47
82 20
57 37

output:

60 60
61 30
78 43
51 49
67 47
59 43
55 39
59 36
58 35
56 37
56 39
57 38
56 38
57 38
57 37

result:

ok guessed correctly in 15 attempts

Test #12:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

239
70 39
239 111
4 16
36 56
92 3
233 84
178 66
55 5
230 3
26 29
26 6
174 67
18 16
233 4
122 33

output:

119 119
95 67
154 54
122 65
105 79
113 44
117 51
120 53
122 38
124 28
123 34
123 31
122 34
122 34
122 33

result:

ok guessed correctly in 15 attempts

Test #13:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

477
137 90
4 290
149 261
120 148
82 19
165 351
36 422
45 455
81 411
21 279
49 164
2 149
335 472
13 378
54 371
41 242

output:

239 239
184 138
89 192
113 255
153 209
135 188
117 209
78 223
61 234
53 240
41 244
45 241
41 240
45 239
43 241
41 242

result:

ok guessed correctly in 16 attempts

Test #14:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

954
563 324
84 206
268 76
364 148
485 122
200 774
226 941
221 742
55 153
280 26
929 410
838 98
175 206
243 12
669 29
67 273
327 112
170 57
48 5
375 125

output:

477 477
566 264
325 189
240 106
375 90
466 64
423 100
401 126
383 143
370 146
370 134
375 135
379 130
377 133
376 129
377 128
377 129
376 127
375 126
375 125

result:

ok guessed correctly in 20 attempts

Test #15:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1908
1841 245
1838 766
1495 330
721 251
1789 407
1894 1285
1904 479
1302 344
1809 212
392 885
670 1093
553 1235
1606 1779
885 229
1740 197
1674 199
1708 321
1792 128
1616 349

output:

954 954
1329 700
1632 908
1624 475
1496 447
1574 266
1568 442
1599 451
1606 358
1623 299
1609 318
1607 337
1606 347
1617 361
1611 355
1612 352
1612 350
1615 350
1616 349

result:

ok guessed correctly in 19 attempts

Test #16:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

3815
3677 2978
2089 3746
78 2675
211 2874
2254 2715
3174 3069
665 3612
2726 3216
3022 3663
1112 3543
1993 2409
393 1092
233 3647
1468 3614
740 3162
228 3502
529 3264
2690 3489
972 3476
1713 3570
61 3510
2091 3607
1377 2623
800 2083
1705 3410

output:

1908 1908
2745 2292
2418 3093
1822 3030
1478 3165
1671 2803
1760 2829
1713 3177
1757 3199
1755 3372
1737 3470
1735 3399
1727 3356
1717 3370
1716 3390
1710 3387
1707 3393
1706 3384
1706 3390
1705 3402
1705 3408
1704 3410
1704 3413
1705 3411
1705 3410

result:

ok guessed correctly in 25 attempts

Test #17:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

7630
6905 2125
1639 3634
869 6639
3029 7142
2972 7564
6949 7213
73 4872
2620 7373
6721 6941
167 6942
416 5744
4028 6813
5807 7385
6844 3494
5784 7597
6609 7051
4118 7513
5831 7238
5621 6813
4096 7037
6027 6918
5862 7221
6775 6965
1253 7270
746 5610
7508 7493
6409 6807
1556 7053
5493 6777

output:

3815 3815
5532 3119
4342 2703
4645 4227
5229 5544
5366 6178
5725 6741
5564 6443
5474 6563
5558 6746
5510 6702
5491 6628
5468 6715
5468 6767
5472 6740
5479 6753
5490 6754
5486 6763
5489 6769
5493 6770
5491 6772
5492 6774
5493 6776
5494 6776
5494 6776
5493 6776
5493 6776
5493 6776
5493 6777

result:

ok guessed correctly in 29 attempts

Test #18:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

15259
8394 10191
11489 13478
13497 14321
14217 11985
1061 13070
15081 14957
15244 6899
11973 15043
14174 13415
13967 13231
13234 14915
13170 14555
15119 8151
15159 14808
15020 13225
14050 13639
14798 13574
13693 14925
13994 14908
13172 15011
15035 12736
15072 12529
1436 14446
14877 14823
14876 14309...

output:

7630 7630
8388 11331
11829 11355
11860 13299
13661 12638
12750 12768
13087 13766
13148 13082
12989 13406
13325 13516
13485 13532
13551 13713
13563 13809
13541 13753
13615 13785
13655 13794
13677 13801
13689 13806
13692 13824
13694 13834
13693 13839
13697 13839
13698 13838
13696 13836
13697 13837
136...

result:

ok guessed correctly in 55 attempts

Test #19:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

30518
25671 25954
20707 4761
22183 8442
25896 8643
3134 15616
21931 26052
27481 6460
28754 10777
29287 22914
26170 18271
30502 6488
29562 17371
15894 23607
30258 3513
30209 13978
26736 6616
27979 2453
29282 2332
28657 14127
29073 448
28895 1793
26909 23047
27399 28231
29190 7533
29053 22629
16086 81...

output:

15259 15259
20211 20478
23753 13790
24929 9645
27867 7292
26485 8512
26839 10016
26145 9097
27353 9483
27643 9821
27415 9960
28122 10069
28431 10171
28181 10178
28266 10146
28373 10194
28321 10166
28331 10144
28350 10131
28358 10140
28360 10136
28367 10133
28360 10134
28362 10135
28379 10136
28386 1...

result:

ok guessed correctly in 35 attempts

Test #20:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

61036
7249 41099
13242 55094
29149 8350
2946 58523
9224 4820
548 59682
3977 34504
6590 51288
8531 7316
1484 37739
2308 54597
6246 52037
3006 52575
139 34693
1550 22930
3509 55065
185 52549
2923 43539
5035 11708
3863 23484
1069 26099
1746 43995
130 41857
36779 4242
20585 54404
19310 47200
25745 17566...

output:

30518 30518
16311 35144
18936 48734
19741 42591
10632 41400
7268 37813
6005 39502
2975 38610
3619 39477
5361 38717
3969 38895
3576 39174
4349 39313
4168 39431
3627 39361
3405 39314
3306 39349
3110 39359
3143 39378
3148 39369
3103 39363
2941 39355
2860 39352
2817 39350
2838 39351
2849 39352
2855 3935...

result:

ok guessed correctly in 38 attempts

Test #21:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

122071
58954 110943
113517 5508
81904 108189
31745 21456
104779 118235
106060 101224
62830 73986
32363 107076
99280 104122
79312 96378
51710 101739
103472 60382
104688 114605
57670 120201
105209 110905
100997 115828
107769 106820
120564 114257
98422 114717
89453 111183
97258 5281
119861 29345
120110...

output:

61035 61035
60187 91535
83392 83558
95209 98223
79728 91058
89497 93628
95889 92565
92050 94137
89004 99232
90077 99665
88994 100609
87930 102883
88463 101764
88575 102379
88357 102673
88607 102860
88745 103014
88856 103063
88915 103131
88938 103180
88927 103212
88929 103196
88964 103193
88981 10318...

result:

ok guessed correctly in 47 attempts

Test #22:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

244141
92644 71279
175693 64041
158315 126925
198932 8256
189075 13573
91998 195840
203054 44617
48784 79637
243781 156162
53356 60073
180871 14007
193747 121817
241549 92258
5658 108141
72780 29509
58357 3197
241508 93021
237080 71507
211080 64951
225219 58640
185488 176011
187885 54012
105447 2473...

output:

122071 122071
98496 67865
160337 49204
147779 77596
173915 64458
189515 57779
170456 57979
185144 61416
177362 57795
180154 61451
177011 61672
177520 59692
177359 60716
178851 60628
178129 60853
177776 60702
177616 60613
177704 60642
177981 60103
178130 59812
178211 59658
178180 59759
178204 59708
1...

result:

ok guessed correctly in 34 attempts

Test #23:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

488282
106433 474884
275239 225797
201738 26776
170209 427924
331572 97800
354816 191510
21138 218969
95718 160060
29559 335507
218356 190319
58693 304796
20400 239439
107006 225586
472322 172776
283995 278119
182903 37669
55664 165238
92725 361231
205872 336312
165398 209856
223839 218124
85336 101...

output:

244141 244141
195573 351719
243221 311110
128261 233130
183305 272987
228802 267549
262129 274686
239461 261147
226358 245396
219519 243671
213344 232649
209308 230707
205602 225226
203201 222425
204470 223655
204890 225490
204841 224305
204542 224171
204196 224834
204102 225175
203909 225145
204015...

result:

ok guessed correctly in 42 attempts

Test #24:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

976563
798000 778429
576941 368466
930767 457066
129874 161618
44142 113454
51450 147219
953482 176698
397894 277421
527038 181525
943733 198520
203434 305494
118282 334964
677984 72465
817360 160370
972569 439132
930255 145463
408308 142858
789527 167284
665215 135869
939087 143175
680052 440040
77...

output:

488281 488281
661001 640757
722825 430430
857680 343652
803272 336477
774957 327577
756945 328150
775324 241358
761548 270329
757054 246303
763237 224779
758990 230937
756672 232678
754231 220093
753911 213736
754893 217452
755790 216917
755141 214905
755335 213787
755043 213312
755503 212855
755358...

result:

ok guessed correctly in 39 attempts

Test #25:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1953125
718546 34788
1194093 1870054
980144 1721279
435224 1594068
30914 1009612
525976 78898
1095299 1407639
537677 1690291
268178 91704
87396 512380
28598 870018
72480 1233676
98437 1352774
58281 887541
73148 120181
165120 1495046
3738 1202668
30492 402769
84856 967805
214752 120410
433585 1641812...

output:

976563 976563
887380 500498
944508 736525
663175 904564
317320 982805
152437 988436
170100 884509
241155 917869
247322 973543
244481 945571
226565 937147
182642 952484
161396 961345
151118 965825
138387 964885
139470 961970
138740 963439
131740 963984
130235 963379
127560 963718
128159 963159
129145...

result:

ok guessed correctly in 49 attempts

Test #26:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

3906250
928940 2062772
1208715 1193164
790880 3548370
113721 3134567
1233397 1174468
641249 1140462
1268721 128374
254473 1516093
52669 895386
934896 580050
2493442 2743273
685294 1550997
3013581 3409522
979342 2872252
876507 3890365
1767597 1777939
525493 2808584
1085832 215010
194184 86525
159096 ...

output:

1953125 1953125
980293 2022824
974424 1038724
1027144 1546962
793805 1692227
1126325 1752636
688771 1466219
544658 1326478
310316 1202675
177657 1108464
248559 1141614
283989 1172049
300258 1185467
312724 1187280
296052 1206414
282236 1219306
291331 1213828
286848 1219047
289856 1216241
290439 12150...

result:

ok guessed correctly in 46 attempts

Test #27:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

7812500
5283134 1013345
5882393 2240876
1639950 850522
6179712 6147603
1221918 7790721
5325790 2893676
3567670 6046971
3854207 1342480
157376 1886931
6051492 1361577
6781715 2626479
1356937 890351
4145472 1989771
6347970 625922
7008422 2441222
6560377 4717838
6460279 6461516
4553518 4088378
5351032 ...

output:

3906250 3906250
4525979 2100606
6254412 2550080
5513542 1968079
5282573 3099060
5011858 3644609
5029466 3273059
5054810 3474582
4731535 3308036
4570518 3239316
4600186 3150149
4678050 3188791
4642716 3136363
4628524 3097436
4638484 3083710
4666932 3098710
4679919 3107029
4685239 3111427
4675411 3116...

result:

ok guessed correctly in 45 attempts

Test #28:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

15625000
6826322 3483216
808394 9325874
1286822 5690921
910109 15313957
12404321 1705878
2040658 149853
1100135 6494429
10752607 825349
629668 4790484
595938 4123968
3183862 11167644
660100 3111253
173856 3652790
597688 5489686
4196134 70189
2136141 3396264
738387 11245259
490317 9411136
64483 91371...

output:

7812500 7812500
7219291 3973814
3633592 4902275
1789481 5175316
2045365 7215774
3047600 6884888
2640122 6035464
2006514 6018385
2280185 5938956
2065818 5551614
1909664 5380881
1945604 5497674
1917865 5440692
1805601 5464884
1751345 5487485
1753273 5452074
1757575 5433703
1745448 5441669
1725186 5441...

result:

ok guessed correctly in 49 attempts

Test #29:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

31250000
15163801 8278166
3933736 14860487
26670854 17175966
16697424 23175149
9662249 6030989
29076607 4553945
10939895 27684033
28226774 20003660
1837159 21540041
9979681 8118150
195267 10988102
6032382 3861704
27415428 15166467
24445525 17931116
12487754 8322289
27881863 17966381
1876806 17847991...

output:

15625000 15625000
15298046 7822762
7790489 8847138
11877015 10948587
12569849 13503944
11034183 12741981
13965028 11557750
12806349 12305912
13922257 12371949
13209195 12658924
13118156 12328329
12862704 12521417
12971422 12188495
13070687 12058510
13052215 12224129
13091669 12107698
13111274 121256...

result:

ok guessed correctly in 49 attempts

Test #30:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

62500000
51943776 46352566
55651698 45955833
19325256 48616623
30926988 60871455
53215813 55153468
53841780 61591388
4037942 54044468
38673048 59793079
42539372 62342109
59329044 54533936
62347557 50328061
58312075 62399430
61956747 61161971
27817619 59828797
1154453 59731841
33938042 62469644
97355...

output:

31250000 31250000
44100909 38852208
51519248 44644841
44321432 51591014
40497271 56810740
44042817 56380628
46106473 59472573
44403104 59020271
43262721 60435611
42979284 61514351
43753782 61451880
44186553 61443349
44481245 61730413
44629072 61787386
44561079 61537634
44517593 61494812
44503887 617...

result:

ok guessed correctly in 74 attempts

Test #31:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

125000000
79222151 76332998
89676498 113110069
71432638 113970598
22641011 56418251
27511483 99731329
17847977 100964511
2249252 109326215
83519958 26177022
13681632 124742991
58137042 116617163
4148624 106652353
19600872 121096369
33042631 124950813
12218678 119086567
10846853 46253051
11593672 105...

output:

62500000 62500000
86621845 79733875
77485318 103837483
56094007 111392009
41906468 106704577
32839199 108288893
26722039 111342052
21179923 118335299
23725264 114291062
22707195 116675357
24347434 117636602
23605570 116478971
23352377 117720100
23522290 118275004
23164290 118759538
23197476 11835741...

result:

ok guessed correctly in 70 attempts

Test #32:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

250000000
62418427 219810195
33529078 63975735
17361500 93204144
72143538 127361544
60932044 92450939
146848372 208943177
174057943 58932331
40572847 136556024
47063115 79559846
43039553 11309673
28393539 17980487
40257141 227058457
102826996 21945771
7355624 173725924
106584758 208836281
131241059 ...

output:

125000000 125000000
97496992 178423015
52071573 140337288
32508258 109346498
49132571 119625023
61417271 103903040
71516907 110963169
80043877 106341598
75881867 108917100
72490280 103690315
71100762 100665542
70116079 99179035
68767635 100391138
69634547 99809772
68737616 99820635
69509249 10031452...

result:

ok guessed correctly in 54 attempts

Test #33:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

500000000
76610048 268225174
68710147 76438346
378308723 241110854
156295289 122806210
79707230 192699
157679664 57079944
18113697 14257340
438263404 64975266
84786372 102166272
398983734 5660698
186456886 12832105
196110218 14409876
72954005 759449
74950076 7106912
72128512 6549154
399383759 336588...

output:

250000000 250000000
125460346 258759242
112291068 133015979
167028760 147914953
175874908 84709805
167058544 61787447
149488430 71535454
140560196 78053963
157727924 38190075
149319082 58203905
153638624 48281777
155270444 42789219
156648019 40698042
154476549 37886556
153322576 36457231
152727363 3...

result:

ok guessed correctly in 63 attempts

Test #34:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

999999995
731743801 677141913
742525552 289944252
991436166 943359295
331205983 682418988
881688146 610638066
898524283 462974415
631557802 986753329
888571180 136282744
908097116 838269208
997260898 505459799
457825860 762063943
791338673 721048419
658592564 390671604
998283229 242942512
726418506 ...

output:

499999998 499999998
701309392 627397805
803262846 384861923
781889722 515254217
648120945 538405789
722729268 542702086
750863811 524001957
771901744 579818070
760630897 551432220
776055554 564781996
788748143 564245134
784466254 568309660
788647530 577205921
784910258 573621920
787208538 571444750
...

result:

ok guessed correctly in 58 attempts

Test #35:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

999999996
206437356 822749250
908173415 643702300
67734612 796001920
543342772 498744980
129635531 474263433
884098435 856101927
199746601 939780065
856413579 21995428
931063457 790023882
884239411 549160895
794122221 722869187
197865222 272783491
939536917 229271677
529249739 537214678
907302960 74...

output:

499999998 499999998
348405203 681057051
579521569 779470013
455855838 719569441
446960450 581149932
390943192 527624482
407584060 580672885
386672006 629155647
395452465 604522486
413686608 616304176
423162106 613759033
427191736 621926263
430299949 609198249
433225745 603434929
434802780 600564013
...

result:

ok guessed correctly in 60 attempts

Test #36:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

999999997
411164400 452810560
797031077 750494521
649542972 309223186
564349796 165001700
865072949 443206160
901910609 75755025
938370653 328081651
861328605 112327723
839002774 54751010
837315870 73924701
978817352 232840156
216665701 223264550
909103783 19203332
837968293 136819523
822788581 3627...

output:

499999998 499999998
273514421 411466725
350107744 520824209
502261754 274620657
579407018 140138329
613046433 176651135
670481519 110169507
674777968 135491990
707635588 86056792
729003444 52705179
742411120 33774588
736792164 48010360
731352595 57231684
733708557 51788765
734334650 54755155
7358196...

result:

ok guessed correctly in 60 attempts

Test #37:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

999999998
656839358 299419738
445266090 441832667
437839724 209388709
545041016 689485836
176414018 816838184
393784214 756055730
299103853 471177897
46444737 681675661
1307598 658008688
167873374 2280274
238099632 142894568
137410302 185630525
418813574 343507202
407045047 24626288
93829930 9752205...

output:

499999999 499999999
630321363 300950973
478902980 335466782
302710296 164235092
398792600 242167925
345249157 282788390
394869372 316038134
341596027 327272691
314555363 330962108
297875472 329721811
274905966 310181713
264138203 301010188
255597299 297871560
261321506 298142821
264208651 294382042
...

result:

ok guessed correctly in 72 attempts

Test #38:

score: 0
Accepted
time: 2ms
memory: 3584kb

input:

999999999
752461264 62849627
548120882 92879711
936464592 967289016
249824960 715452928
951648561 614856593
632646612 204915731
624191000 135793334
857487805 386411578
914049389 770995429
820886324 92388449
158893928 28297519
357591723 78317300
928404542 410285128
908243483 323000894
881398156 23684...

output:

500000000 500000000
596252639 277793712
464874460 141928468
645445510 167425031
460831798 240054019
566078870 225868571
620408846 204432895
600496321 169292345
631511491 186260887
651706846 195593941
667651384 194562596
657803753 189483865
652909988 184813606
655099437 187978594
656222975 189404707
...

result:

ok guessed correctly in 75 attempts

Test #39:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1000000000
574851157 956297383
74756140 859591985
25025593 135771771
38271008 693927969
877739009 895106104
228433440 916976902
117648554 834284255
135347652 884769603
50938248 938897665
49718501 811021191
561977372 800208202
946418449 648242454
887523753 991675872
46555062 907962773
313164067 97940...

output:

500000000 500000000
527340049 747757565
273523262 779224719
227311890 672057195
110241596 705492539
165994242 707997564
160516766 769253537
129473696 797198625
129964093 816770830
103493015 826018998
91598976 825813445
98139693 819038158
101748477 811583029
103817772 815064841
102138522 822147093
10...

result:

ok guessed correctly in 60 attempts

Test #40:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

1000000000
124049365 773228761
775827897 525518098
423920764 824273005
687272692 522559115
769796843 677109730
855534929 39916009
965900602 691652638
630375016 891942738
900496204 105884922
875362972 491471025
959957337 896101977
468238560 849043378
891844816 719791620
58492017 917653201
637045537 8...

output:

500000000 500000000
294015935 621127942
472055783 688208979
538590420 854019021
557144558 795591534
671712747 842281708
629235788 786901229
680030541 804927151
683291797 824850689
670671443 809847343
682949531 811403993
707465537 825637010
695343848 819776489
701162540 822478366
697817319 820079457
...

result:

ok guessed correctly in 71 attempts

Test #41:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000000000
248721315 636545964
170582008 498565809
451083695 613260684
822662618 865120283
52916503 806518301
91299013 954409536
189470855 866432574
275055895 977394238
52432077 807264967
266473381 959702024
38350885 929572625
126506468 908155689
98756637 959227412
3077284 904559531
833635535 641532...

output:

500000000 500000000
274607369 590567414
162307850 377555988
197240954 516256469
253909316 524319806
159512121 662755495
97852725 751911671
77587108 793074054
86123063 793948908
41406841 843132356
62507238 821194274
50197584 837302252
48849312 842559643
40244900 852581698
35629235 858117659
37871836 ...

result:

ok guessed correctly in 70 attempts

Test #42:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1000000000
8426636 404179658
153768704 481106191
333021385 463187539
431206969 427380438
895858146 300924500
315569128 195435147
396315832 450446074
590280107 49982253
49627137 196515796
493385499 50459265
888109511 317295093
283305698 287946078
12848508 10015327
198077400 31696406
53018610 95222704...

output:

500000000 500000000
253166340 467512363
131829939 544240776
156399655 364905098
219965758 563783935
216951918 424205999
202331653 323508879
210467097 373118753
220523531 348377562
214161391 330028971
222261017 316573535
227180796 316105782
227626282 305034971
226062056 297398242
226186384 292689672
...

result:

ok guessed correctly in 68 attempts

Test #43:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1000000000
716815311 307164877
456505734 581249147
713549037 247290415
202651268 266088895
693044821 523018825
804921881 378692529
728823832 52666628
285576985 141873989
155928777 633685948
93982557 138445750
671900177 277974156
954597351 242077919
373719246 122199008
915626705 120362442
497960359 9...

output:

500000000 500000000
684080920 351766985
609710767 456493639
453491304 254478821
307046849 149324918
375977590 221286805
412835951 254866219
426165077 199658297
416890101 167844401
406812538 197636029
398028527 193709102
401691400 199587302
405397382 190607964
407242864 177228526
409125722 172424207
...

result:

ok guessed correctly in 63 attempts

Test #44:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

1000000000
497027630 856053249
674852462 933962345
233350706 767218539
828274 174836948
119945023 791326676
575925087 925488736
784314641 999363632
244774855 820041745
23178404 565655413
263792067 789067728
125391713 913791777
897633587 629786632
152985327 986817036
322440421 791185858
211953275 958...

output:

500000000 500000000
498608649 749994192
726159052 794264229
564621658 839147933
530355304 790767228
417576650 890085982
473570267 848848035
492909301 854503359
468507207 886759745
474318055 862030943
461146766 882449445
450286169 904680177
456201193 894224563
453411093 899384554
452607036 896578372
...

result:

ok guessed correctly in 62 attempts

Test #45:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1000000000
515963705 772239976
981399967 28551128
953382037 700785677
960907908 706171147
766500011 728208274
804134750 926793870
355749962 456384518
837178842 42607141
868163366 960199422
926550212 942916065
952587808 307174157
903268232 899734379
965865308 892347720
997156286 723265528
349615229 5...

output:

500000000 500000000
509773060 749713462
715796414 681887831
864716885 725941155
930419662 702658338
898969021 723244835
922112918 856270249
906459065 788987336
900899256 754790090
904758071 771807290
909941457 779913543
917938102 775470619
911215206 777594608
926496500 779095609
934284972 779657868
...

result:

ok guessed correctly in 61 attempts

Test #46:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000000000
40153281 873223555
553354824 118384943
52389857 618563356
246974711 775582212
109530600 105305191
84763211 770430399
96326190 23920355
729091671 350855818
178693792 798881069
43983682 997233288
101695 105728432
96123641 308129515
92070418 693259098
39785063 155930090
352434565 949019667
9...

output:

500000000 500000000
304894731 635271001
273719989 426530384
187366423 452889593
280599364 560749169
202571961 508503444
154535467 524987759
107061862 501088646
144931116 503148425
157131818 513953729
137186261 518145065
125290309 514431069
122874739 510837310
118394399 512643288
114702095 511363688
...

result:

ok guessed correctly in 57 attempts

Test #47:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000000000
432211245 314764982
92707841 672229850
658673564 59266327
169393494 631086059
318401308 236894316
294023357 38365547
32471012 327877229
226680041 35918766
90035439 169157970
61594469 20475239
751269624 556556348
291581437 751576942
429687018 649667831
256253364 448772922
57326537 28382682...

output:

500000000 500000000
439006534 261160609
223248305 349607800
316933658 289213591
383589516 399762255
298061934 336103062
255182216 293233671
208763563 278968192
193794393 253839189
169410169 241923470
157314074 229938134
165994290 235145058
166371164 239046070
171363891 238703651
168294349 241236983
...

result:

ok guessed correctly in 64 attempts

Test #48:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

1000000000
309776591 116856572
952954357 558170590
450416477 97245632
745844480 405600614
676917619 209264554
6239219 480463455
695348150 130094839
68824 491527340
52598614 49983980
882237234 175380198
450872397 31630172
422986145 38989069
868920382 406274573
794162311 142727608
765793684 113123907
...

output:

500000000 500000000
417253177 270541110
654087644 247771581
528162619 266223450
590813788 255929270
684959961 124722366
637104303 185991878
658099407 149964244
644477653 163747193
629865818 145399129
637707691 149105898
636937596 133975567
635561724 125673653
634816588 133167460
637701111 128272593
...

result:

ok guessed correctly in 60 attempts

Test #49:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

1000000000
578976162 694728094
666153135 280831109
327360792 563583251
297824028 159757755
854219587 929436444
460390381 832365483
987567449 634213850
98469578 251109538
944809302 481723864
677170595 880700440
198614846 365879131
461155623 643107319
678508352 3140362
735559067 778090303
539726903 78...

output:

500000000 500000000
567595247 736292648
714534345 590539985
524404804 605943296
468607178 566875516
575859907 533015696
498861663 586794703
544246640 561055874
523393439 556726847
536708172 541253056
538869870 553461204
532233653 553137342
528407071 559146614
528437872 554507323
531364047 556918237
...

result:

ok guessed correctly in 58 attempts

Test #50:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1000000000
170796070 52540735
366447636 243092285
156318697 350164112
636061293 12510303
769202843 1844532
196831661 91639981
33028280 231289767
549512862 15989031
329809034 53364718
87574335 77615618
144649124 33145775
104121609 23644827
584485583 3016677
57578755 11343302
289269918 3172987
9025692...

output:

500000000 500000000
377380298 295106774
432977820 141441766
208259560 174801480
317508195 157159936
381659419 162823698
337409853 100774916
322520579 116926355
324229873 96327011
303226861 47644318
291825313 28669273
284644334 16436428
279943564 11086416
282458478 14139223
281248723 11376371
2812240...

result:

ok guessed correctly in 58 attempts

Extra Test:

score: 0
Extra Test Passed