QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#298036#7906. Almost Convexucup-team180#AC ✓59ms4012kbC++2041.5kb2024-01-05 16:19:482024-01-05 16:19:48

Judging History

你现在查看的是最新测评结果

  • [2024-01-05 16:19:48]
  • 评测
  • 测评结果:AC
  • 用时:59ms
  • 内存:4012kb
  • [2024-01-05 16:19:48]
  • 提交

answer

#pragma region Macros
#ifdef noimi
#include "my_template.hpp"
#else
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <immintrin.h>

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cfenv>
#include <cfloat>
#include <chrono>
#include <cinttypes>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdarg>
#include <cstddef>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <immintrin.h>
#include <initializer_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <streambuf>
#include <string>
#include <tuple>
#include <type_traits>
#include <utility>
#include <variant>

#ifdef noimi
#define oj_local(a, b) b
#else
#define oj_local(a, b) a
#endif

#define LOCAL if(oj_local(0, 1))
#define OJ if(oj_local(1, 0))

using namespace std;
using ll = long long;
using ull = unsigned long long int;
using i128 = __int128_t;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
template <typename T> using vc = vector<T>;
template <typename T> using vvc = vector<vc<T>>;
template <typename T> using vvvc = vector<vvc<T>>;
using vi = vc<int>;
using vl = vc<ll>;
using vpi = vc<pii>;
using vpl = vc<pll>;
template <class T> using pq = priority_queue<T>;
template <class T> using pqg = priority_queue<T, vector<T>, greater<T>>;
template <typename T> int si(const T &x) { return x.size(); }
template <class T, class S> inline bool chmax(T &a, const S &b) { return (a < b ? a = b, 1 : 0); }
template <class T, class S> inline bool chmin(T &a, const S &b) { return (a > b ? a = b, 1 : 0); }
vi iota(int n) {
    vi a(n);
    return iota(a.begin(), a.end(), 0), a;
}
template <typename T> vi iota(const vector<T> &a, bool greater = false) {
    vi res(a.size());
    iota(res.begin(), res.end(), 0);
    sort(res.begin(), res.end(), [&](int i, int j) {
        if(greater) return a[i] > a[j];
        return a[i] < a[j];
    });
    return res;
}

// macros
#define overload5(a, b, c, d, e, name, ...) name
#define overload4(a, b, c, d, name, ...) name
#define endl '\n'
#define REP0(n) for(ll jidlsjf = 0; jidlsjf < n; ++jidlsjf)
#define REP1(i, n) for(ll i = 0; i < (n); ++i)
#define REP2(i, a, b) for(ll i = (a); i < (b); ++i)
#define REP3(i, a, b, c) for(ll i = (a); i < (b); i += (c))
#define rep(...) overload4(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__)
#define per0(n) for(int jidlsjf = 0; jidlsjf < (n); ++jidlsjf)
#define per1(i, n) for(ll i = (n)-1; i >= 0; --i)
#define per2(i, a, b) for(ll i = (a)-1; i >= b; --i)
#define per3(i, a, b, c) for(ll i = (a)-1; i >= (b); i -= (c))
#define per(...) overload4(__VA_ARGS__, per3, per2, per1, per0)(__VA_ARGS__)
#define fore0(a) rep(a.size())
#define fore1(i, a) for(auto &&i : a)
#define fore2(a, b, v) for(auto &&[a, b] : v)
#define fore3(a, b, c, v) for(auto &&[a, b, c] : v)
#define fore4(a, b, c, d, v) for(auto &&[a, b, c, d] : v)
#define fore(...) overload5(__VA_ARGS__, fore4, fore3, fore2, fore1, fore0)(__VA_ARGS__)
#define setbits(j, n) for(ll iiiii = (n), j = lowbit(iiiii); iiiii; iiiii ^= 1 << j, j = lowbit(iiiii))
#define perm(v) for(bool permrepflag = true; (permrepflag ? exchange(permrepflag, false) : next_permutation(all(v)));)
#define fi first
#define se second
#define pb push_back
#define ppb pop_back
#define ppf pop_front
#define eb emplace_back
#define drop(s) cout << #s << endl, exit(0)
#define si(c) (int)(c).size()
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define lbg(c, x) distance((c).begin(), lower_bound(all(c), (x), greater{}))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define ubg(c, x) distance((c).begin(), upper_bound(all(c), (x), greater{}))
#define rng(v, l, r) v.begin() + (l), v.begin() + (r)
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define SORT(v) sort(all(v))
#define REV(v) reverse(all(v))
#define UNIQUE(x) SORT(x), x.erase(unique(all(x)), x.end())
template <typename T = ll, typename S> T SUM(const S &v) { return accumulate(all(v), T(0)); }
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define overload2(_1, _2, name, ...) name
#define vec(type, name, ...) vector<type> name(__VA_ARGS__)
#define vv(type, name, h, ...) vector<vector<type>> name(h, vector<type>(__VA_ARGS__))
#define vvv(type, name, h, w, ...) vector<vector<vector<type>>> name(h, vector<vector<type>>(w, vector<type>(__VA_ARGS__)))
#define vvvv(type, name, a, b, c, ...)                                                                                                                         \
    vector<vector<vector<vector<type>>>> name(a, vector<vector<vector<type>>>(b, vector<vector<type>>(c, vector<type>(__VA_ARGS__))))
constexpr pii dx4[4] = {pii{1, 0}, pii{0, 1}, pii{-1, 0}, pii{0, -1}};
constexpr pii dx8[8] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

namespace yesno_impl {
const string YESNO[2] = {"NO", "YES"};
const string YesNo[2] = {"No", "Yes"};
const string yesno[2] = {"no", "yes"};
const string firstsecond[2] = {"second", "first"};
const string FirstSecond[2] = {"Second", "First"};
const string possiblestr[2] = {"impossible", "possible"};
const string Possiblestr[2] = {"Impossible", "Possible"};
void YES(bool t = 1) { cout << YESNO[t] << endl; }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { cout << YesNo[t] << endl; }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { cout << yesno[t] << endl; }
void no(bool t = 1) { yes(!t); }
void first(bool t = 1) { cout << firstsecond[t] << endl; }
void First(bool t = 1) { cout << FirstSecond[t] << endl; }
void possible(bool t = 1) { cout << possiblestr[t] << endl; }
void Possible(bool t = 1) { cout << Possiblestr[t] << endl; }
}; // namespace yesno_impl
using namespace yesno_impl;

#define INT(...)                                                                                                                                               \
    int __VA_ARGS__;                                                                                                                                           \
    IN(__VA_ARGS__)
#define INTd(...)                                                                                                                                              \
    int __VA_ARGS__;                                                                                                                                           \
    IN2(__VA_ARGS__)
#define LL(...)                                                                                                                                                \
    ll __VA_ARGS__;                                                                                                                                            \
    IN(__VA_ARGS__)
#define LLd(...)                                                                                                                                               \
    ll __VA_ARGS__;                                                                                                                                            \
    IN2(__VA_ARGS__)
#define STR(...)                                                                                                                                               \
    string __VA_ARGS__;                                                                                                                                        \
    IN(__VA_ARGS__)
#define CHR(...)                                                                                                                                               \
    char __VA_ARGS__;                                                                                                                                          \
    IN(__VA_ARGS__)
#define DBL(...)                                                                                                                                               \
    double __VA_ARGS__;                                                                                                                                        \
    IN(__VA_ARGS__)
#define VEC(type, name, size)                                                                                                                                  \
    vector<type> name(size);                                                                                                                                   \
    IN(name)
#define VECd(type, name, size)                                                                                                                                 \
    vector<type> name(size);                                                                                                                                   \
    IN2(name)
#define VEC2(type, name1, name2, size)                                                                                                                         \
    vector<type> name1(size), name2(size);                                                                                                                     \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i])
#define VEC2d(type, name1, name2, size)                                                                                                                        \
    vector<type> name1(size), name2(size);                                                                                                                     \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i])
#define VEC3(type, name1, name2, name3, size)                                                                                                                  \
    vector<type> name1(size), name2(size), name3(size);                                                                                                        \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i])
#define VEC3d(type, name1, name2, name3, size)                                                                                                                 \
    vector<type> name1(size), name2(size), name3(size);                                                                                                        \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i])
#define VEC4(type, name1, name2, name3, name4, size)                                                                                                           \
    vector<type> name1(size), name2(size), name3(size), name4(size);                                                                                           \
    for(int i = 0; i < size; i++) IN(name1[i], name2[i], name3[i], name4[i]);
#define VEC4d(type, name1, name2, name3, name4, size)                                                                                                          \
    vector<type> name1(size), name2(size), name3(size), name4(size);                                                                                           \
    for(int i = 0; i < size; i++) IN2(name1[i], name2[i], name3[i], name4[i]);
#define VV(type, name, h, w)                                                                                                                                   \
    vector<vector<type>> name(h, vector<type>(w));                                                                                                             \
    IN(name)
#define VVd(type, name, h, w)                                                                                                                                  \
    vector<vector<type>> name(h, vector<type>(w));                                                                                                             \
    IN2(name)
int scan() { return getchar(); }
void scan(int &a) { cin >> a; }
void scan(long long &a) { cin >> a; }
void scan(char &a) { cin >> a; }
void scan(double &a) { cin >> a; }
void scan(string &a) { cin >> a; }
template <class T, class S> void scan(pair<T, S> &p) { scan(p.first), scan(p.second); }
template <class T> void scan(vector<T> &);
template <class T> void scan(vector<T> &a) {
    for(auto &i : a) scan(i);
}
template <class T> void scan(T &a) { cin >> a; }
void IN() {}
void IN2() {}
template <class Head, class... Tail> void IN(Head &head, Tail &...tail) {
    scan(head);
    IN(tail...);
}
template <class Head, class... Tail> void IN2(Head &head, Tail &...tail) {
    scan(head);
    --head;
    IN2(tail...);
}

template <int p = -1> void pat() {}
template <int p = -1, class Head, class... Tail> void pat(Head &h, Tail &...tail) {
    h += p;
    pat<p>(tail...);
}

template <typename T, typename S> T ceil(T x, S y) {
    assert(y);
    return (y < 0 ? ceil(-x, -y) : (x > 0 ? (x + y - 1) / y : x / y));
}

template <typename T, typename S> T floor(T x, S y) {
    assert(y);
    return (y < 0 ? floor(-x, -y) : (x > 0 ? x / y : x / y - (x % y == 0 ? 0 : 1)));
}
template <typename T, typename S, typename U> U bigmul(const T &x, const S &y, const U &lim) { // clamp(x * y, -lim, lim)
    if(x < 0 and y < 0) return bigmul(-x, -y, lim);
    if(x < 0) return -bigmul(-x, y, lim);
    if(y < 0) return -bigmul(x, -y, lim);
    return y == 0 or x <= lim / y ? x * y : lim;
}
template <class T> T POW(T x, int n) {
    T res = 1;
    for(; n; n >>= 1, x *= x)
        if(n & 1) res *= x;
    return res;
}
template <class T, class S> T POW(T x, S n, const ll &mod) {
    T res = 1;
    x %= mod;
    for(; n; n >>= 1, x = x * x % mod)
        if(n & 1) res = res * x % mod;
    return res;
}
vector<pll> factor(ll x) {
    vector<pll> ans;
    for(ll i = 2; i * i <= x; i++)
        if(x % i == 0) {
            ans.push_back({i, 1});
            while((x /= i) % i == 0) ans.back().second++;
        }
    if(x != 1) ans.push_back({x, 1});
    return ans;
}
template <class T> vector<T> divisor(T x) {
    vector<T> ans;
    for(T i = 1; i * i <= x; i++)
        if(x % i == 0) {
            ans.pb(i);
            if(i * i != x) ans.pb(x / i);
        }
    return ans;
}
template <typename T> void zip(vector<T> &x) {
    vector<T> y = x;
    UNIQUE(y);
    for(int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); }
}
template <class S> void fold_in(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void fold_in(vector<S> &v, Head &&a, Tail &&...tail) {
    for(auto e : a) v.emplace_back(e);
    fold_in(v, tail...);
}
template <class S> void renumber(vector<S> &v) {}
template <typename Head, typename... Tail, class S> void renumber(vector<S> &v, Head &&a, Tail &&...tail) {
    for(auto &&e : a) e = lb(v, e);
    renumber(v, tail...);
}
template <class S, class... Args> vector<S> zip(vector<S> &head, Args &&...args) {
    vector<S> v;
    fold_in(v, head, args...);
    sort(all(v)), v.erase(unique(all(v)), v.end());
    renumber(v, head, args...);
    return v;
}

template <typename S> void rearrange(const vector<S> &id) {}
template <typename S, typename T> void rearrange_exec(const vector<S> &id, vector<T> &v) {
    vector<T> w(v.size());
    rep(i, si(id)) w[i] = v[id[i]];
    v.swap(w);
}
// 並び替える順番, 並び替える vector 達
template <typename S, typename Head, typename... Tail> void rearrange(const vector<S> &id, Head &a, Tail &...tail) {
    rearrange_exec(id, a);
    rearrange(id, tail...);
}

template <typename T> vector<T> RUI(const vector<T> &v) {
    vector<T> res(v.size() + 1);
    for(int i = 0; i < v.size(); i++) res[i + 1] = res[i] + v[i];
    return res;
}
template <typename T> void zeta_supersetsum(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] += f[b | i];
}

template <typename T> void zeta_subsetsum(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] += f[b];
}
template <typename T> void mobius_subset(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b] -= f[b | i];
}
template <typename T> void mobius_superset(vector<T> &f) {
    int n = f.size();
    for(int i = 1; i < n; i <<= 1) rep(b, n) if(!(i & b)) f[b | i] -= f[b];
}
// 反時計周りに 90 度回転
template <typename T> void rot(vector<vector<T>> &v) {
    if(empty(v)) return;
    int n = v.size(), m = v[0].size();
    vector<vector<T>> res(m, vector<T>(n));
    rep(i, n) rep(j, m) res[m - 1 - j][i] = v[i][j];
    v.swap(res);
}

vector<int> counter(const vector<int> &v, int max_num = -1) {
    if(max_num == -1) max_num = MAX(v);
    vector<int> res(max_num + 1);
    fore(e, v) res[e]++;
    return res;
}

// x in [l, r)
template <class T, class S> bool inc(const T &x, const S &l, const S &r) { return l <= x and x < r; }
template <class T, class S> bool inc(const T &x, const pair<S, S> &p) { return p.first <= x and x < p.second; }

// 便利関数
constexpr ll ten(int n) { return n == 0 ? 1 : ten(n - 1) * 10; }
constexpr ll tri(ll n) { return n * (n + 1) / 2; }
// l + ... + r
constexpr ll tri(ll l, ll r) { return (l + r) * (r - l + 1) / 2; }
ll max(int x, ll y) { return max((ll)x, y); }
ll max(ll x, int y) { return max(x, (ll)y); }
int min(int x, ll y) { return min((ll)x, y); }
int min(ll x, int y) { return min(x, (ll)y); }
// bit 演算系
#define bit(i) (1LL << i)       // (1 << i)
#define test(b, i) (b >> i & 1) // b の i bit 目が立っているか
ll pow2(int i) { return 1LL << i; }
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(ll t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
int lowbit(signed a) { return a == 0 ? 32 : __builtin_ctz(a); }
int lowbit(ll a) { return a == 0 ? 64 : __builtin_ctzll(a); }
// int allbit(int n) { return (1 << n) - 1; }
constexpr ll mask(int n) { return (1LL << n) - 1; }
// int popcount(signed t) { return __builtin_popcount(t); }
// int popcount(ll t) { return __builtin_popcountll(t); }
int popcount(uint64_t t) { return __builtin_popcountll(t); }
static inline uint64_t popcount64(uint64_t x) {
    uint64_t m1 = 0x5555555555555555ll;
    uint64_t m2 = 0x3333333333333333ll;
    uint64_t m4 = 0x0F0F0F0F0F0F0F0Fll;
    uint64_t h01 = 0x0101010101010101ll;

    x -= (x >> 1) & m1;
    x = (x & m2) + ((x >> 2) & m2);
    x = (x + (x >> 4)) & m4;

    return (x * h01) >> 56;
}
bool ispow2(int i) { return i && (i & -i) == i; }

ll rnd(ll l, ll r) { //[l, r)
#ifdef noimi
    static mt19937_64 gen;
#else
    static mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count());
#endif
    return uniform_int_distribution<ll>(l, r - 1)(gen);
}
ll rnd(ll n) { return rnd(0, n); }

template <class t> void random_shuffle(vc<t> &a) { rep(i, si(a)) swap(a[i], a[rnd(0, i + 1)]); }

int in() {
    int x;
    cin >> x;
    return x;
}
ll lin() {
    unsigned long long x;
    cin >> x;
    return x;
}

template <class T, class S> pair<T, S> operator-(const pair<T, S> &x) { return pair<T, S>(-x.first, -x.second); }
template <class T, class S> pair<T, S> operator-(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi - y.fi, x.se - y.se); }
template <class T, class S> pair<T, S> operator+(const pair<T, S> &x, const pair<T, S> &y) { return pair<T, S>(x.fi + y.fi, x.se + y.se); }
template <class T> pair<T, T> operator&(const pair<T, T> &l, const pair<T, T> &r) { return pair<T, T>(max(l.fi, r.fi), min(l.se, r.se)); }
template <class T, class S> pair<T, S> operator+=(pair<T, S> &l, const pair<T, S> &r) { return l = l + r; }
template <class T, class S> pair<T, S> operator-=(pair<T, S> &l, const pair<T, S> &r) { return l = l - r; }
template <class T> bool intersect(const pair<T, T> &l, const pair<T, T> &r) { return (l.se < r.se ? r.fi < l.se : l.fi < r.se); }

template <class T> vector<T> &operator++(vector<T> &v) {
    fore(e, v) e++;
    return v;
}
template <class T> vector<T> operator++(vector<T> &v, int) {
    auto res = v;
    fore(e, v) e++;
    return res;
}
template <class T> vector<T> &operator--(vector<T> &v) {
    fore(e, v) e--;
    return v;
}
template <class T> vector<T> operator--(vector<T> &v, int) {
    auto res = v;
    fore(e, v) e--;
    return res;
}
template <class T> void connect(vector<T> &l, const vector<T> &r) { fore(e, r) l.eb(e); }
template <class T> vector<T> operator+(const vector<T> &l, const vector<T> &r) {
    vector<T> res(max(si(l), si(r)));
    rep(i, si(l)) res[i] += l[i];
    rep(i, si(r)) res[i] += r[i];
    return res;
}
template <class T> vector<T> operator-(const vector<T> &l, const vector<T> &r) {
    vector<T> res(max(si(l), si(r)));
    rep(i, si(l)) res[i] += l[i];
    rep(i, si(r)) res[i] -= r[i];
    return res;
}
template <class T> vector<T> &operator+=(const vector<T> &l, const vector<T> &r) {
    if(si(l) < si(r)) l.resize(si(r));
    rep(i, si(r)) l[i] += r[i];
    return l;
}
template <class T> vector<T> &operator-=(const vector<T> &l, const vector<T> &r) {
    if(si(l) < si(r)) l.resize(si(r));
    rep(i, si(r)) l[i] -= r[i];
    return l;
}
template <class T> vector<T> &operator+=(vector<T> &v, const T &x) {
    fore(e, v) e += x;
    return v;
}
template <class T> vector<T> &operator-=(vector<T> &v, const T &x) {
    fore(e, v) e -= x;
    return v;
}

template <typename T> struct edge {
    int from, to;
    T cost;
    int id;
    edge(int to, T cost) : from(-1), to(to), cost(cost) {}
    edge(int from, int to, T cost) : from(from), to(to), cost(cost) {}
    edge(int from, int to, T cost, int id) : from(from), to(to), cost(cost), id(id) {}
    constexpr bool operator<(const edge<T> &rhs) const noexcept { return cost < rhs.cost; }
    edge &operator=(const int &x) {
        to = x;
        return *this;
    }
    operator int() const { return to; }
    friend ostream operator<<(ostream &os, const edge &e) { return os << e.to; }
};
template <typename T> using Edges = vector<edge<T>>;

template <typename T = int> Edges<T> read_edges(int m, bool weighted = false) {
    Edges<T> res;
    res.reserve(m);
    for(int i = 0; i < m; i++) {
        int u, v, c = 0;
        scan(u), scan(v), u--, v--;
        if(weighted) scan(c);
        res.eb(u, v, c, i);
    }
    return res;
}

using Tree = vector<vector<int>>;
using Graph = vector<vector<int>>;
template <class T> using Wgraph = vector<vector<edge<T>>>;
Graph getG(int n, int m = -1, bool directed = false, int margin = 1) {
    Tree res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        cin >> a >> b;
        a -= margin, b -= margin;
        res[a].emplace_back(b);
        if(!directed) res[b].emplace_back(a);
    }
    return res;
}
Graph getTreeFromPar(int n, int margin = 1) {
    Graph res(n);
    for(int i = 1; i < n; i++) {
        int a;
        cin >> a;
        res[a - margin].emplace_back(i);
    }
    return res;
}
template <class T> Wgraph<T> getWg(int n, int m = -1, bool directed = false, int margin = 1) {
    Wgraph<T> res(n);
    if(m == -1) m = n - 1;
    while(m--) {
        int a, b;
        T c;
        scan(a), scan(b), scan(c);
        a -= margin, b -= margin;
        res[a].emplace_back(b, c);
        if(!directed) res[b].emplace_back(a, c);
    }
    return res;
}
void add(Graph &G, int x, int y) { G[x].eb(y), G[y].eb(x); }
template <class S, class T> void add(Wgraph<S> &G, int x, int y, T c) { G[x].eb(y, c), G[y].eb(x, c); }

#define TEST                                                                                                                                                   \
    INT(testcases);                                                                                                                                            \
    while(testcases--)

i128 abs(const i128 &x) { return x > 0 ? x : -x; }
istream &operator>>(istream &is, i128 &v) {
    string s;
    is >> s;
    v = 0;
    for(int i = 0; i < (int)s.size(); i++) {
        if(isdigit(s[i])) { v = v * 10 + s[i] - '0'; }
    }
    if(s[0] == '-') { v *= -1; }
    return is;
}

ostream &operator<<(ostream &os, const i128 &v) {
    if(v == 0) { return (os << "0"); }
    i128 num = v;
    if(v < 0) {
        os << '-';
        num = -num;
    }
    string s;
    for(; num > 0; num /= 10) { s.push_back((char)(num % 10) + '0'); }
    reverse(s.begin(), s.end());
    return (os << s);
}
namespace aux {
template <typename T, unsigned N, unsigned L> struct tp {
    static void output(std::ostream &os, const T &v) {
        os << std::get<N>(v) << (&os == &cerr ? ", " : " ");
        tp<T, N + 1, L>::output(os, v);
    }
};
template <typename T, unsigned N> struct tp<T, N, N> {
    static void output(std::ostream &os, const T &v) { os << std::get<N>(v); }
};
} // namespace aux
template <typename... Ts> std::ostream &operator<<(std::ostream &os, const std::tuple<Ts...> &t) {
    if(&os == &cerr) { os << '('; }
    aux::tp<std::tuple<Ts...>, 0, sizeof...(Ts) - 1>::output(os, t);
    if(&os == &cerr) { os << ')'; }
    return os;
}
template <typename T, typename S, typename U> std::ostream &operator<<(std::ostream &os, const priority_queue<T, S, U> &_pq) {
    auto pq = _pq;
    vector<T> res;
    while(!empty(pq)) res.emplace_back(pq.top()), pq.pop();
    return os << res;
}
template <class T, class S> ostream &operator<<(ostream &os, const pair<T, S> &p) {
    if(&os == &cerr) { return os << "(" << p.first << ", " << p.second << ")"; }
    return os << p.first << " " << p.second;
}
template <class Ch, class Tr, class Container> std::basic_ostream<Ch, Tr> &operator<<(std::basic_ostream<Ch, Tr> &os, const Container &x) {
    bool f = true;
    if(&os == &cerr) os << "[";
    for(auto &y : x) {
        if(&os == &cerr)
            os << (f ? "" : ", ") << y;
        else
            os << (f ? "" : " ") << y;
        f = false;
    }
    if(&os == &cerr) os << "]";
    return os;
}

#define dump(...) static_cast<void>(0)
#define dbg(...) static_cast<void>(0)

void OUT() { cout << endl; }
template <class Head, class... Tail> void OUT(const Head &head, const Tail &...tail) {
    cout << head;
    if(sizeof...(tail)) cout << ' ';
    OUT(tail...);
}

template <typename T> static constexpr T inf = numeric_limits<T>::max() / 2;
template <class T, class S> constexpr pair<T, S> inf<pair<T, S>> = {inf<T>, inf<S>};

template <class T> void OUT2(const T &t, T INF = inf<T>, T res = -1) { OUT(t != INF ? t : res); }
template <class T> void OUT2(vector<T> &v, T INF = inf<T>, T res = -1) {
    fore(e, v) if(e == INF) e = res;
    OUT(v);
    fore(e, v) if(e == res) e = INF;
}

template <class F> struct REC {
    F f;
    REC(F &&f_) : f(forward<F>(f_)) {}
    template <class... Args> auto operator()(Args &&...args) const { return f(*this, forward<Args>(args)...); }
};

template <class S> vector<pair<S, int>> runLength(const vector<S> &v) {
    vector<pair<S, int>> res;
    for(auto &e : v) {
        if(res.empty() or res.back().fi != e)
            res.eb(e, 1);
        else
            res.back().se++;
    }
    return res;
}
vector<pair<char, int>> runLength(const string &v) {
    vector<pair<char, int>> res;
    for(auto &e : v) {
        if(res.empty() or res.back().fi != e)
            res.eb(e, 1);
        else
            res.back().se++;
    }
    return res;
}

struct string_converter {
    char start = 0;
    char type(const char &c) const { return (islower(c) ? 'a' : isupper(c) ? 'A' : isdigit(c) ? '0' : 0); }
    int convert(const char &c) {
        if(!start) start = type(c);
        return c - start;
    }
    int convert(const char &c, const string &chars) { return chars.find(c); }
    template <typename T> auto convert(const T &v) {
        vector<decltype(convert(v[0]))> ret;
        ret.reserve(size(v));
        for(auto &&e : v) ret.emplace_back(convert(e));
        return ret;
    }
    template <typename T> auto convert(const T &v, const string &chars) {
        vector<decltype(convert(v[0], chars))> ret;
        ret.reserve(size(v));
        for(auto &&e : v) ret.emplace_back(convert(e, chars));
        return ret;
    }
    int operator()(const char &v, char s = 0) {
        start = s;
        return convert(v);
    }
    int operator()(const char &v, const string &chars) { return convert(v, chars); }
    template <typename T> auto operator()(const T &v, char s = 0) {
        start = s;
        return convert(v);
    }
    template <typename T> auto operator()(const T &v, const string &chars) { return convert(v, chars); }
} toint;

template <class T, class F> T bin_search(T ok, T ng, const F &f) {
    while((ok > ng ? ok - ng : ng - ok) > 1) {
        T mid = ok + ng >> 1;
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}
template <class T, class F> T bin_search_double(T ok, T ng, const F &f, int iter = 80) {
    while(iter--) {
        // T mid = (ok + ng) / 2;
        T mid = sqrtl(ok * ng);
        (f(mid) ? ok : ng) = mid;
    }
    return ok;
}

struct Setup_io {
    Setup_io() {
        ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
        cout << fixed << setprecision(11);
    }
} setup_io;

#endif

#pragma endregion

namespace Geometry {
using T = ll;
constexpr T eps = 0;

bool eq(const T &x, const T &y) { return abs(x - y) <= eps; }
inline constexpr int type(T x, T y) {
    if(x == 0 and y == 0) return 0;
    if(y < 0 or (y == 0 and x > 0)) return -1;
    return 1;
}
struct Point {
    T x, y;
    constexpr Point(T _x = 0, T _y = 0) : x(_x), y(_y) {}
    constexpr Point operator+() const noexcept { return *this; }
    constexpr Point operator-() const noexcept { return Point(-x, -y); }
    constexpr Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
    constexpr Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
    constexpr Point &operator+=(const Point &p) { return x += p.x, y += p.y, *this; }
    constexpr Point &operator-=(const Point &p) { return x -= p.x, y -= p.y, *this; }
    constexpr T operator*(const Point &p) const { return x * p.x + y * p.y; }
    constexpr Point &operator*=(const T &k) { return x *= k, y *= k, *this; }
    constexpr Point operator*(const T &k) { return Point(x * k, y * k); }
    constexpr bool operator==(const Point &r) const noexcept { return r.x == x and r.y == y; }
    constexpr T cross(const Point &r) const { return x * r.y - y * r.x; }

    constexpr bool operator<(const Point &r) const { return pair(x, y) < pair(r.x, r.y); }

    // 1 : left, 0 : same, -1 : right
    constexpr int toleft(const Point &r) const {
        auto t = cross(r);
        return t > eps ? 1 : t < -eps ? -1 : 0;
    }

    constexpr bool arg_cmp(const Point &r) const {
        int L = type(x, y), R = type(r.x, r.y);
        if(L != R) return L < R;

        T X = x * r.y, Y = r.x * y;
        if(X != Y) return X > Y;
        return x < r.x;
    }
};
bool arg_cmp(const Point &l, const Point &r) { return l.arg_cmp(r); }
ostream &operator<<(ostream &os, const Point &p) { return os << p.x << " " << p.y; }
istream &operator>>(istream &is, Point &p) {
    is >> p.x >> p.y;
    return is;
}

struct Line {
    Point a, b;
    Line() = default;
    Line(Point a, Point b) : a(a), b(b) {}
    // ax + by = c
    Line(T A, T B, T C) {
        if(A == 0) {
            a = Point(0, C / B), b = Point(1, C / B);
        } else if(B == 0) {
            a = Point(C / A, 0), b = Point(C / A, 1);
        } else {
            a = Point(0, C / B), b = Point(C / A, 0);
        }
    }
    // 1 : left, 0 : same, -1 : right
    constexpr int toleft(const Point &r) const {
        auto t = (b - a).cross(r - a);
        return t > eps ? 1 : t < -eps ? -1 : 0;
    }

    friend std::ostream &operator<<(std::ostream &os, Line &ls) {
        return os << "{"
                  << "(" << ls.a.x << ", " << ls.a.y << "), (" << ls.b.x << ", " << ls.b.y << ")}";
    }
};
istream &operator>>(istream &is, Line &p) { return is >> p.a >> p.b; }

struct Segment : Line {
    Segment() = default;
    Segment(Point a, Point b) : Line(a, b) {}
};

ostream &operator<<(ostream &os, Segment &p) { return os << p.a << " to " << p.b; }
istream &operator>>(istream &is, Segment &p) {
    is >> p.a >> p.b;
    return is;
}

struct Circle {
    Point p;
    T r;
    Circle() = default;
    Circle(Point p, T r) : p(p), r(r) {}
};

using pt = Point;
using Points = vector<pt>;
using Polygon = Points;
T cross(const pt &x, const pt &y) { return x.x * y.y - x.y * y.x; }
T dot(const pt &x, const pt &y) { return x.x * y.x + x.y * y.y; }

T abs2(const pt &x) { return dot(x, x); }
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_1_C
// 点の回転方向
int ccw(const Point &a, Point b, Point c) {
    b = b - a, c = c - a;
    if(cross(b, c) > 0) return +1;   // "COUNTER_CLOCKWISE"
    if(cross(b, c) < 0) return -1;   // "CLOCKWISE"
    if(dot(b, c) < 0) return +2;     // "ONLINE_BACK"
    if(abs2(b) < abs2(c)) return -2; // "ONLINE_FRONT"
    return 0;                        // "ON_SEGMENT"
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 平行判定
bool parallel(const Line &a, const Line &b) { return (cross(a.b - a.a, b.b - b.a) == 0); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_A
// 垂直判定
bool orthogonal(const Line &a, const Line &b) { return (dot(a.a - a.b, b.a - b.b) == 0); }

bool intersect(const Line &l, const Point &p) { return abs(ccw(l.a, l.b, p)) != 1; }

bool intersect(const Line &l, const Line &m) { return !parallel(l, m); }

bool intersect(const Segment &s, const Point &p) { return ccw(s.a, s.b, p) == 0; }

bool intersect(const Line &l, const Segment &s) { return cross(l.b - l.a, s.a - l.a) * cross(l.b - l.a, s.b - l.a) <= 0; }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_B
bool intersect(const Segment &s, const Segment &t) { return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 && ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0; }

bool intersect(const Polygon &ps, const Polygon &qs) {
    int pl = si(ps), ql = si(qs), i = 0, j = 0;
    while((i < pl or j < ql) and (i < 2 * pl) and (j < 2 * ql)) {
        auto ps0 = ps[(i + pl - 1) % pl], ps1 = ps[i % pl];
        auto qs0 = qs[(j + ql - 1) % ql], qs1 = qs[j % ql];
        if(intersect(Segment(ps0, ps1), Segment(qs0, qs1))) return true;
        Point a = ps1 - ps0;
        Point b = qs1 - qs0;
        T v = cross(a, b);
        T va = cross(qs1 - qs0, ps1 - qs0);
        T vb = cross(ps1 - ps0, qs1 - ps0);

        if(!v and va < 0 and vb < 0) return false;
        if(!v and !va and !vb) {
            i += 1;
        } else if(v >= 0) {
            if(vb > 0)
                i += 1;
            else
                j += 1;
        } else {
            if(va > 0)
                j += 1;
            else
                i += 1;
        }
    }
    return false;
}

T norm(const Point &p) { return p.x * p.x + p.y * p.y; }
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 crosspoint(const Line &l, const Line &m) {
    T A = cross(l.b - l.a, m.b - m.a);
    T B = cross(l.b - l.a, l.b - m.a);
    if(A == 0 and B == 0) return m.a;
    return m.a + (m.b - m.a) * (B / A);
}

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_2_C
Point crosspoint(const Segment &l, const Segment &m) { return crosspoint(Line(l), Line(m)); }

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=CGL_3_B
// 凸性判定
bool is_convex(const Points &p) {
    int n = (int)p.size();
    for(int i = 0; i < n; i++) {
        if(ccw(p[(i + n - 1) % n], p[i], p[(i + 1) % n]) == -1) return false;
    }
    return true;
}

Points convex_hull(Points p) {
    int n = p.size(), k = 0;
    if(n <= 2) return p;
    sort(begin(p), end(p), [](pt x, pt y) { return (x.x != y.x ? x.x < y.x : x.y < y.y); });
    Points ch(2 * n);
    for(int i = 0; i < n; ch[k++] = p[i++]) {
        while(k >= 2 && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) <= 0) --k;
    }
    for(int i = n - 2, t = k + 1; i >= 0; ch[k++] = p[i--]) {
        while(k >= t && cross(ch[k - 1] - ch[k - 2], p[i] - ch[k - 1]) <= 0) --k;
    }
    ch.resize(k - 1);
    return ch;
}

// 面積の 2 倍
T area2(const Points &p) {
    T res = 0;
    rep(i, si(p)) { res += cross(p[i], p[i == si(p) - 1 ? 0 : i + 1]); }
    return res;
}

enum { _OUT, _ON, _IN };

int contains(const Polygon &Q, const Point &p) {
    bool in = false;
    for(int i = 0; i < Q.size(); i++) {
        Point a = Q[i] - p, b = Q[(i + 1) % Q.size()] - p;
        if(a.y > b.y) swap(a, b);
        if(a.y <= 0 && 0 < b.y && cross(a, b) < 0) in = !in;
        if(cross(a, b) == 0 && dot(a, b) <= 0) return _ON;
    }
    return in ? _IN : _OUT;
}

Polygon Minkowski_sum(const Polygon &P, const Polygon &Q) {
    vector<Segment> e1(P.size()), e2(Q.size()), ed(P.size() + Q.size());
    const auto cmp = [](const Segment &u, const Segment &v) { return (u.b - u.a).arg_cmp(v.b - v.a); };
    rep(i, P.size()) e1[i] = {P[i], P[(i + 1) % P.size()]};
    rep(i, Q.size()) e2[i] = {Q[i], Q[(i + 1) % Q.size()]};
    rotate(begin(e1), min_element(all(e1), cmp), end(e1));
    rotate(begin(e2), min_element(all(e2), cmp), end(e2));
    merge(all(e1), all(e2), begin(ed), cmp);
    const auto check = [](const Points &res, const Point &u) {
        const auto back1 = res.back(), back2 = *prev(end(res), 2);
        return eq(cross(back1 - back2, u - back2), eps) and dot(back1 - back2, u - back1) >= -eps;
    };
    auto u = e1[0].a + e2[0].a;
    Points res{u};
    res.reserve(P.size() + Q.size());
    for(const auto &v : ed) {
        u = u + v.b - v.a;
        while(si(res) >= 2 and check(res, u)) res.pop_back();
        res.eb(u);
    }
    if(res.size() and check(res, res[0])) res.pop_back();
    return res;
}

// -1 : on, 0 : out, 1 : in
// O(log(n))
int is_in(const Polygon &p, const Point &a) {
    if(p.size() == 1) return a == p[0] ? -1 : 0;
    if(p.size() == 2) return intersect(Segment(p[0], p[1]), a);
    if(a == p[0]) return -1;
    if((p[1] - p[0]).toleft(a - p[0]) == -1 || (p.back() - p[0]).toleft(a - p[0]) == 1) return 0;
    const auto cmp = [&](const Point &u, const Point &v) { return (u - p[0]).toleft(v - p[0]) == 1; };
    const size_t i = lower_bound(p.begin() + 1, p.end(), a, cmp) - p.begin();
    if(i == 1) return intersect(Segment(p[0], p[i]), a) ? -1 : 0;
    if(i == p.size() - 1 && intersect(Segment(p[0], p[i]), a)) return -1;
    if(intersect(Segment(p[i - 1], p[i]), a)) return -1;
    return (p[i] - p[i - 1]).toleft(a - p[i - 1]) > 0;
}

Points halfplane_intersection(vector<Line> L, const T inf = 1e9) {
    Point box[4] = {Point(inf, inf), Point(-inf, inf), Point(-inf, -inf), Point(inf, -inf)};
    rep(i, 4) { L.emplace_back(box[i], box[(i + 1) % 4]); }
    sort(all(L), [](const Line &l, const Line &r) { return (l.b - l.a).arg_cmp(r.b - r.a); });
    deque<Line> dq;
    int len = 0;
    auto check = [](const Line &a, const Line &b, const Line &c) { return a.toleft(crosspoint(b, c)) == -1; };
    rep(i, L.size()) {
        while(dq.size() > 1 and check(L[i], *(end(dq) - 2), *(end(dq) - 1))) dq.pop_back();
        while(dq.size() > 1 and check(L[i], dq[0], dq[1])) dq.pop_front();
        // dump(L[i], si(dq));

        if(dq.size() and eq(cross(L[i].b - L[i].a, dq.back().b - dq.back().a), 0)) {
            if(dot(L[i].b - L[i].a, dq.back().b - dq.back().a) < eps) return {};
            if(L[i].toleft(dq.back().a) == -1)
                dq.pop_back();
            else
                continue;
        }
        dq.emplace_back(L[i]);
    }

    while(dq.size() > 2 and check(dq[0], *(end(dq) - 2), *(end(dq) - 1))) dq.pop_back();
    while(dq.size() > 2 and check(dq.back(), dq[0], dq[1])) dq.pop_front();
    if(si(dq) < 3) return {};
    Polygon ret(dq.size());
    rep(i, dq.size()) ret[i] = crosspoint(dq[i], dq[(i + 1) % dq.size()]);
    return ret;
}
} // namespace Geometry

using namespace Geometry;

int main() {
    INT(n);
    Points P(n);
    fore(e, P) cin >> e.x >> e.y;

    auto C = convex_hull(P);

    vi used(n);
    rep(i, n) { fore(e, C) if(P[i].x == e.x and P[i].y == e.y) used[i] = true; }
    Points Q;
    rep(i, n) if(!used[i]) Q.eb(P[i]);

    int ans = 1;
    rep(i, si(C)) {
        auto a = C[i], b = C[(i + 1) % si(C)];
        vector<pair<Point, Point>> v;
        fore(e, Q) { v.eb(e - a, b - e); }
        sort(all(v), [&](pair<Point, Point> x, pair<Point, Point> y) {
            if(int k = x.fi.toleft(y.fi); k == -1) {
                return false;
            } else if(k == 1) {
                return true;
            } else {
                k = x.se.toleft(y.se);
                if(k == -1) return true;
                return false;
            }
        });
        bool flag = true;
        Point p;
        dump(v);
        fore(x, y, v) {
            if(flag) {
                ans++;
                p = y;
                flag = false;
            } else {
                // dump(p, y, p.toleft(y));
                if(p.toleft(y) == 1) {
                    ans++;
                    p = y;
                }
            }
        }
    }
    OUT(ans);
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3588kb

input:

7
1 4
4 0
2 3
3 1
3 5
0 0
2 4

output:

9

result:

ok 1 number(s): "9"

Test #2:

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

input:

5
4 0
0 0
2 1
3 3
3 1

output:

5

result:

ok 1 number(s): "5"

Test #3:

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

input:

3
0 0
3 0
0 3

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

6
0 0
3 0
3 2
0 2
1 1
2 1

output:

7

result:

ok 1 number(s): "7"

Test #5:

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

input:

4
0 0
0 3
3 0
3 3

output:

1

result:

ok 1 number(s): "1"

Test #6:

score: 0
Accepted
time: 6ms
memory: 3744kb

input:

2000
86166 617851
383354 -277127
844986 386868
-577988 453392
-341125 -386775
-543914 -210860
-429613 606701
-343534 893727
841399 339305
446761 -327040
-218558 -907983
787284 361823
950395 287044
-351577 -843823
-198755 138512
-306560 -483261
-487474 -857400
885637 -240518
-297576 603522
-748283 33...

output:

718

result:

ok 1 number(s): "718"

Test #7:

score: 0
Accepted
time: 6ms
memory: 3932kb

input:

2000
571314 -128802
-57762 485216
-713276 485201
-385009 -844644
371507 403789
338703 -272265
-913641 438001
-792118 -481524
709494 213762
-913577 432978
-397111 709021
840950 328210
-843628 452653
-20721 126607
-107804 -338102
930109 -89787
-949115 -76479
-862141 455623
991761 94852
-635475 625573
...

output:

658

result:

ok 1 number(s): "658"

Test #8:

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

input:

2000
-510540 -289561
-602648 -189950
-403224 944455
-369582 -41334
358122 -598933
-817147 470207
-440180 -735160
-705634 61719
319062 897001
-905089 -755682
-408371 -520115
-423336 548115
-590242 835990
208155 883477
-202087 142035
-71545 411206
570690 -673204
-228451 -903435
-732876 -570271
-246755...

output:

309

result:

ok 1 number(s): "309"

Test #9:

score: 0
Accepted
time: 4ms
memory: 4004kb

input:

2000
-532115 566389
138405 49337
398814 -97324
116833 113216
381728 877609
222402 641022
109920 952381
-113880 395181
13780 -572931
-676608 605202
-74328 -503839
-207767 926500
-663270 -146303
197877 280349
275865 -663892
-630214 3286
973786 304855
-493735 841584
394901 -505975
757960 204724
-373328...

output:

239

result:

ok 1 number(s): "239"

Test #10:

score: 0
Accepted
time: 4ms
memory: 3980kb

input:

2000
512636 509804
-661126 -592269
755566 -721837
-878213 441853
-236050 -89069
-181220 155656
203391 691764
940154 260513
747075 373881
620423 840991
-409624 335472
270937 -710659
-751290 -673585
250341 -193243
-250535 618887
-739996 543936
-547741 -213681
-82920 -364319
-611672 737719
930798 46731...

output:

1025

result:

ok 1 number(s): "1025"

Test #11:

score: 0
Accepted
time: 3ms
memory: 4004kb

input:

2000
943353 817289
237151 899722
682851 -464873
854225 205354
834550 257948
-260874 298196
-224572 -269157
-667301 881130
-45920 -696359
-634337 792620
-408527 -947513
582880 172669
921645 839423
833813 721080
-836662 -287230
-55783 -408594
108996 -122012
365647 -789544
313812 833502
970009 -737736
...

output:

218

result:

ok 1 number(s): "218"

Test #12:

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

input:

2000
619248 227987
-252490 -553032
148050 -479727
-333707 -591482
-40488 -503144
561909 255624
-402541 -798967
-245811 -610006
-146584 -517935
226433 -92580
-81939 -828480
72540 -845547
502613 220323
66708 -573015
601886 258752
406443 257854
232970 -671600
-37023 -683767
602339 456757
-440096 -71899...

output:

7

result:

ok 1 number(s): "7"

Test #13:

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

input:

2000
-602451 2956
85982 141739
-185932 -208897
-716095 58215
-468047 155612
-791626 -3105
75700 -484098
609608 -304849
689485 -106857
533177 -285261
-659400 -241162
-369302 165482
406663 265940
-353843 -788313
805885 -75440
-571955 -60471
351360 -81373
-510926 -59456
591713 179588
534794 -118
201630...

output:

66

result:

ok 1 number(s): "66"

Test #14:

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

input:

2000
41203 -675424
-158994 366628
-133859 -595680
435466 687630
687811 -35017
314337 133049
-384711 444777
54850 -760922
526166 282618
572292 94793
-324003 621393
-30308 242225
612969 -231837
-56628 -892609
-492077 58749
29597 -349591
198510 219502
380955 -59845
839171 -40068
88185 -820614
-572977 -...

output:

43

result:

ok 1 number(s): "43"

Test #15:

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

input:

2000
-814040 46114
-324077 -522697
388552 -604274
-252898 43028
-757069 141507
413462 -649779
-281915 -316285
-498931 -573214
-408766 670792
-271435 -393170
87187 731739
89312 -853584
-768680 -307261
-185324 234729
-70493 -354866
16452 164338
-650791 -518077
851196 -259322
-85395 -509349
241593 5074...

output:

129

result:

ok 1 number(s): "129"

Test #16:

score: 0
Accepted
time: 3ms
memory: 3932kb

input:

2000
23103 -796677
-148322 67634
-525131 -446626
2672 584671
-712789 -69579
-91150 -429393
-375635 -487235
-680553 -370975
793181 -383683
-234131 -462420
-734705 -171834
322671 -355011
760005 224249
700248 -352775
416862 -125857
-497951 717254
677084 -451876
-220123 616240
525973 -144881
-300828 553...

output:

1466

result:

ok 1 number(s): "1466"

Test #17:

score: 0
Accepted
time: 7ms
memory: 3704kb

input:

2000
-185174 470373
-772343 -70370
-182314 851727
661615 -250979
-581175 527646
332025 141502
-659052 -506788
-378459 -553180
11233 162287
469975 -572356
679074 217029
-137967 727723
581696 140544
452574 -319370
120895 129820
772655 -330960
122860 823902
-786221 147543
-206152 -373647
-212943 4820
6...

output:

2801

result:

ok 1 number(s): "2801"

Test #18:

score: 0
Accepted
time: 9ms
memory: 3800kb

input:

2000
-718158 695879
655921 595312
-509080 -860718
540612 244159
-83221 -865654
-460513 -542465
102321 -775593
328552 799263
-284269 -725108
152140 549502
-108610 465054
-97837 -449762
-772869 -171472
293831 -711723
508617 -157976
170737 323070
544222 385453
-633043 -233165
-620164 -459706
507218 338...

output:

14445

result:

ok 1 number(s): "14445"

Test #19:

score: 0
Accepted
time: 19ms
memory: 3980kb

input:

2000
-587991 -165467
-530325 -5525
-574943 180654
-496535 -748102
-436469 -160646
110285 237070
-822862 -141480
-177189 327799
-424868 331309
-999274 38095
-745710 192605
-234174 -804258
586432 -176239
-626756 499109
-562606 826724
890245 455480
-32262 -298900
550800 516690
-588632 -368654
405331 -3...

output:

64358

result:

ok 1 number(s): "64358"

Test #20:

score: 0
Accepted
time: 45ms
memory: 3976kb

input:

2000
441575 -414673
651578 -449237
287355 -489950
606811 -30288
-733692 679481
-652568 89883
-360110 616801
190405 -368787
-352383 935855
118240 73038
-374899 -927065
-22183 -491455
-146229 638417
998825 -48442
-374469 243261
988830 149043
-778607 -291542
-277026 -167975
372912 -405043
535321 425727...

output:

233885

result:

ok 1 number(s): "233885"

Test #21:

score: 0
Accepted
time: 57ms
memory: 3812kb

input:

2000
-369265 -366669
-225059 -65255
750236 -107534
-252341 967638
533029 -79205
-482639 504243
-164616 -477455
-219649 975578
222020 297565
-548636 -836060
595498 -345235
-971961 -235140
179392 983777
747498 664263
-458850 -513884
-456639 186799
508542 -359953
630300 5257
-294961 -599723
999627 2729...

output:

430546

result:

ok 1 number(s): "430546"

Test #22:

score: 0
Accepted
time: 58ms
memory: 3796kb

input:

2000
-586906 -809654
-279647 960102
-279925 501031
-76716 526333
-277891 -599253
171606 -289251
565124 -825005
-125381 -163097
-71257 -202933
999551 29949
286017 -698748
257733 358898
6047 18648
283230 -959051
221238 -975219
686818 32684
368089 -929790
-689242 449329
-547431 836850
612952 -790120
-9...

output:

484966

result:

ok 1 number(s): "484966"

Test #23:

score: 0
Accepted
time: 59ms
memory: 3992kb

input:

2000
-360385 -932803
6402 -568575
477942 -878390
361387 -497256
-383874 -126116
-838786 214745
157834 -987465
955879 293759
-91170 -521309
262250 964999
883045 -469287
350745 823160
999731 -23179
-791215 8792
208002 153508
-553609 549966
-345358 591962
-613852 198594
81698 996657
803702 98789
201163...

output:

513300

result:

ok 1 number(s): "513300"

Test #24:

score: 0
Accepted
time: 57ms
memory: 3756kb

input:

2000
-996201 87077
834777 -550587
-316381 948632
750921 -473436
-170208 -985408
-98642 17818
735787 -677212
80294 -996771
-420703 594219
995302 -96813
997685 68003
-680287 396657
-986559 163401
313494 442433
-774277 632845
809816 -586683
-569560 692991
956486 -291775
992620 -121264
998004 -63141
-64...

output:

528222

result:

ok 1 number(s): "528222"

Test #25:

score: 0
Accepted
time: 53ms
memory: 3764kb

input:

2000
-876642 481141
513009 -76454
48555 998820
-665181 11267
-681766 -551841
-724328 30683
-594565 -308913
799027 -601295
390878 658489
300660 953731
-227699 973731
621281 283696
871533 490336
-363638 931539
592572 805516
330089 201429
-282723 -959201
-351348 316419
-5935 -999982
-413615 -910451
-14...

output:

527976

result:

ok 1 number(s): "527976"

Test #26:

score: 0
Accepted
time: 56ms
memory: 3924kb

input:

2000
-496177 868221
-142749 -989758
-999462 -32767
-496370 452632
-50957 -998700
549450 25036
-389116 607514
164685 -287576
546553 837424
-356561 934271
250395 -662914
752586 452605
-803752 594963
-978350 206954
983866 178904
-712386 -247430
494205 -869345
777893 628396
-91446 995809
-373660 927565
...

output:

536419

result:

ok 1 number(s): "536419"

Test #27:

score: 0
Accepted
time: 56ms
memory: 3796kb

input:

2000
-20062 470240
889867 456219
84686 996407
-54908 580599
428693 -903450
-150993 -781447
-437742 -134074
-245186 -299633
216878 730546
-588614 808414
-945245 326360
-72396 -11572
-663429 748238
-538386 842697
463983 400770
716299 697792
161751 -986831
931604 -363474
-466293 884630
163252 -116392
4...

output:

541774

result:

ok 1 number(s): "541774"

Test #28:

score: 0
Accepted
time: 56ms
memory: 3832kb

input:

2000
125380 -992108
876963 480556
-954331 -298750
-872744 488177
-667627 744495
527592 -849497
-41014 -455304
13780 890561
-637070 -474060
858293 513158
-422631 -408446
792248 610198
272933 -962032
768663 -639653
957724 -287686
-655707 -72182
774032 633145
44910 -998991
767034 -220288
32566 -999469
...

output:

554369

result:

ok 1 number(s): "554369"

Test #29:

score: 0
Accepted
time: 56ms
memory: 3812kb

input:

2000
877194 480134
721871 -692027
-657316 -753614
-141802 690188
-984203 -177038
499512 866306
60213 331650
667197 -744880
790745 -612145
526658 70820
-975342 -220697
-818975 126696
-206901 13958
-217847 783500
-498782 460388
214283 -976771
124783 992183
-826617 562763
-869768 -493460
-360542 721516...

output:

556266

result:

ok 1 number(s): "556266"

Test #30:

score: 0
Accepted
time: 51ms
memory: 3812kb

input:

2000
-928276 -371891
693025 -720912
340453 -741801
-315399 948959
-999987 -5058
957766 -287546
-11785 -999930
-480620 876928
-591790 -806091
430900 -490816
232828 972517
709950 -704252
-784773 619782
-40706 -999171
972505 232879
57240 360935
837945 25369
-349605 -537128
-50451 -998726
357173 300683
...

output:

578226

result:

ok 1 number(s): "578226"

Test #31:

score: 0
Accepted
time: 53ms
memory: 3692kb

input:

2000
588463 808523
-653251 -757141
-216959 -976180
620816 -783955
-917704 397264
642866 765978
-965972 -258645
-662131 -749387
919793 -392403
81500 -385642
-860281 -509819
-976258 216610
-881856 -471517
781371 -274463
-769776 638313
996471 -83936
-149837 -988710
88728 -996055
621852 -125590
193779 4...

output:

599788

result:

ok 1 number(s): "599788"

Test #32:

score: 0
Accepted
time: 52ms
memory: 3820kb

input:

2000
-713963 -700183
149576 -48137
-904609 -426240
603724 -34474
-350076 178901
-692350 211723
-777299 -629130
-996510 -83463
343004 -939333
696533 554432
-288734 -640484
798029 602618
-327795 -944748
523003 852330
-49570 998770
263409 254892
-314451 619311
-368911 444305
-289455 -406382
-63806 -648...

output:

607941

result:

ok 1 number(s): "607941"

Test #33:

score: 0
Accepted
time: 52ms
memory: 3768kb

input:

2000
-979883 199570
812775 582577
-257939 966161
-874515 -484998
293436 -242001
749548 -288423
-671752 740775
-12769 999918
295251 955419
175054 -13528
-334691 -942327
539352 -842079
705797 -49973
348168 771901
859906 510451
121051 -572684
909626 -415426
-255421 -545286
962040 272906
-813562 581477
...

output:

605021

result:

ok 1 number(s): "605021"

Test #34:

score: 0
Accepted
time: 51ms
memory: 3696kb

input:

2000
748836 662754
853522 521056
501246 608578
-266167 963926
347098 937828
996632 -82002
300258 -953857
570683 -821169
-399685 -531914
-52991 -536271
-268825 -738298
-440252 449420
936398 350939
-183686 982984
-792809 -609469
-36070 -98167
-769325 638857
957390 288796
-272995 -796868
434336 -294938...

output:

609148

result:

ok 1 number(s): "609148"

Test #35:

score: 0
Accepted
time: 49ms
memory: 4012kb

input:

2000
-75848 997119
-878795 -477199
718319 -695713
-750620 -660733
791233 -261340
734828 678253
-298982 223462
-243124 618205
333026 -942917
-431834 -311408
102455 -779863
839939 542679
-888198 459459
-6972 999975
-989074 147415
619268 -785179
913472 -406900
857133 515094
-490437 715504
187406 842078...

output:

612907

result:

ok 1 number(s): "612907"

Test #36:

score: 0
Accepted
time: 49ms
memory: 3696kb

input:

2000
710449 252021
-605745 -795658
965777 259370
528796 -506543
7488 -999971
130196 134654
205176 -978725
360847 -549034
940307 340325
-878187 -478317
195786 -980646
-965779 -259362
-40526 404237
926277 -376843
659148 752012
799019 -601305
609935 184334
400162 64645
123163 -992386
440739 80681
61275...

output:

613033

result:

ok 1 number(s): "613033"

Test #37:

score: 0
Accepted
time: 45ms
memory: 3812kb

input:

2000
-280012 -148903
382702 395900
551170 834392
138094 -142893
747764 -321810
814783 -579764
855100 -518462
518036 855358
-308932 768160
-746881 -664957
-550707 -834698
-203567 979060
-94882 211708
954151 299324
995262 -97226
995211 97743
-361441 932394
-879179 -476490
492429 -870352
222424 -974949...

output:

613525

result:

ok 1 number(s): "613525"

Test #38:

score: 0
Accepted
time: 49ms
memory: 4004kb

input:

2000
-31467 999504
-691705 722179
330770 -943711
-868142 496314
534209 -845352
-948997 315285
708054 706157
50035 -880465
-926659 375902
883484 -468460
-569126 -321856
-203339 709769
-569574 -821939
-753190 -657801
997229 -74388
-559117 829088
797882 -602812
-145490 822289
-951880 306469
648629 -418...

output:

609202

result:

ok 1 number(s): "609202"

Test #39:

score: 0
Accepted
time: 48ms
memory: 4008kb

input:

2000
-33027 -231537
645986 -17185
894873 -446319
369601 -929190
-858847 512231
759587 -650405
821506 -570199
64855 -997894
770842 637025
532744 -331176
148586 -77740
-903364 -428872
-999964 -8474
-967232 253890
4771 -999988
-238462 -243104
-936126 351663
987061 160340
508004 131675
-413865 910337
18...

output:

610683

result:

ok 1 number(s): "610683"

Test #40:

score: 0
Accepted
time: 42ms
memory: 3820kb

input:

2000
315983 611022
-710308 -71198
-574424 -609685
286803 957989
-365263 930904
605616 -39979
261643 965164
-34821 -681407
971328 237742
-428673 903459
-348540 -413287
-716611 446376
-389197 -921154
-214771 -976664
469821 -882761
-288792 -516000
451431 892305
665222 46114
-712000 702178
-11820 237318...

output:

606866

result:

ok 1 number(s): "606866"

Test #41:

score: 0
Accepted
time: 44ms
memory: 3820kb

input:

2000
827570 -561361
106486 -994314
531932 -846786
85020 -821614
-861275 508137
-944596 328233
-654160 -756355
-599581 330073
-953317 -301970
-337499 541540
867483 497465
674219 -738530
742712 438360
-431377 463380
-976458 -215705
-920911 389771
-603054 797699
-651789 758400
993338 115232
-653951 756...

output:

605654

result:

ok 1 number(s): "605654"

Test #42:

score: 0
Accepted
time: 44ms
memory: 4004kb

input:

2000
660227 -171320
-66161 -85351
683277 -730158
980572 196158
395353 118603
97015 448847
428573 -903506
927991 372602
615713 -506850
-694999 719010
411175 911556
463884 885895
159594 -724246
8242 747837
605323 -795979
878479 -50570
-395291 918555
476675 -879079
593695 804689
-941633 336639
-875114 ...

output:

607199

result:

ok 1 number(s): "607199"

Test #43:

score: 0
Accepted
time: 43ms
memory: 4012kb

input:

2000
-404720 641654
376493 -278480
678653 734458
767939 -640522
-419247 -907872
-664244 69783
627003 -779016
-990939 -134306
346792 544624
136558 -725588
-595202 803575
-234031 -301953
-299941 -953957
-866081 499902
901591 -432588
200283 979738
-699910 714230
812341 -583182
357149 -381610
-957517 28...

output:

603919

result:

ok 1 number(s): "603919"

Test #44:

score: 0
Accepted
time: 43ms
memory: 3824kb

input:

2000
-599904 800071
-887152 -461476
703155 -711035
653695 756757
-230256 -973129
987562 157229
-610508 173456
-405774 110423
859552 -511046
-901289 433216
913048 407850
640724 -767771
999070 43110
209538 -620478
888118 459614
839191 543836
-676657 469821
525241 850953
-563829 -825890
-688034 -725678...

output:

598805

result:

ok 1 number(s): "598805"

Test #45:

score: 0
Accepted
time: 42ms
memory: 3760kb

input:

2000
956636 291284
-998398 -56572
-877970 -478715
-907198 -420702
512527 858670
-435307 900281
-445471 895295
247912 364785
-348233 -937407
-901447 -432888
-571179 820825
392021 -919956
574003 115097
-265057 -355995
912755 408506
-375400 926862
-993241 116070
695920 -718118
-284145 -958781
-472992 8...

output:

598251

result:

ok 1 number(s): "598251"

Test #46:

score: 0
Accepted
time: 41ms
memory: 3804kb

input:

2000
-764451 644681
531916 -198765
281641 -959519
-815218 -579153
-974347 225046
-949358 314195
28285 744344
69688 -997568
-775844 630924
973439 228945
621650 783294
-628873 -777507
29532 390971
778370 -93337
923334 -383997
-648844 -760921
-37277 -471652
975210 221278
535838 -634598
-843132 537705
1...

output:

588592

result:

ok 1 number(s): "588592"

Test #47:

score: 0
Accepted
time: 38ms
memory: 3808kb

input:

2000
113634 993522
296600 -955001
-983491 180954
969414 -245430
346546 -938032
-222652 -54964
-61422 998111
-183247 -983066
-700935 713224
-729527 683951
785401 -618986
734347 267059
-898291 439399
394552 918873
-999754 -22148
-999082 -42823
-261334 -965248
858996 -511981
388846 528044
398694 917083...

output:

580267

result:

ok 1 number(s): "580267"

Test #48:

score: 0
Accepted
time: 37ms
memory: 3824kb

input:

2000
-999844 17617
825619 -564226
-998793 49111
-342117 -939657
-964696 263365
348225 -937410
-534589 845111
972446 -233128
996396 84812
226108 974102
819673 -572831
787248 -616635
584981 -811046
-91377 -845586
399 -999999
-420017 -907516
-990854 134931
-8366 -653975
-971086 -238729
-910547 413403
7...

output:

574822

result:

ok 1 number(s): "574822"

Test #49:

score: 0
Accepted
time: 36ms
memory: 3992kb

input:

2000
-642241 766502
985145 -171722
960869 -277002
-770518 637417
-997009 -77276
389040 -921220
-625503 -780221
785285 619134
-869488 -493952
399502 -269138
605487 795854
-979953 -199227
-141150 -989988
-59731 -998214
-372142 -928175
430982 -902360
377383 926057
-253882 781247
-610587 -791948
-15523 ...

output:

569661

result:

ok 1 number(s): "569661"

Test #50:

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

input:

2000
-628838 -357590
978524 206130
-759844 650104
325497 945542
743026 669261
-626067 779768
809046 587744
785675 -618639
999954 9576
-917782 397082
594121 804375
479925 174875
362584 -392818
471020 -882122
-958352 -285587
203295 -979117
-101902 -994794
-307252 -951628
-522875 -852408
-999478 -32304...

output:

324930

result:

ok 1 number(s): "324930"

Test #51:

score: 0
Accepted
time: 6ms
memory: 3676kb

input:

2000
973483 228755
-923152 -384434
-974475 224492
-951197 308583
-301050 -953608
623065 782169
-4460 -999990
-347338 937739
-999141 41423
328894 -944366
-695142 -718871
840009 -542572
-226507 974009
472259 -881459
903505 428576
-559822 -828612
642699 766118
548513 -836141
764272 644893
178154 984002...

output:

180726

result:

ok 1 number(s): "180726"

Test #52:

score: 0
Accepted
time: 3ms
memory: 3792kb

input:

2000
-784353 -620314
995900 90455
-116566 -993182
881042 473036
177991 -984032
-999969 7783
655203 755452
-779179 626800
-181243 -983438
274776 -961507
609151 -793054
-1362 -843519
-566798 -823856
-530993 -847375
-951795 306733
62564 -998040
-959361 282180
-964809 -262948
185709 982604
-913941 40584...

output:

95123

result:

ok 1 number(s): "95123"

Test #53:

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

input:

2000
-378825 -925468
260691 -965422
854263 519839
-132682 -991158
-992506 122194
159239 987240
-986433 164163
-821638 -570008
936600 350399
-542405 840116
-116212 -993224
214672 976686
493136 -869952
-970476 241194
-744228 667925
-942833 333263
-884817 -465937
-941813 336134
714086 -700057
-931887 -...

output:

39222

result:

ok 1 number(s): "39222"

Test #54:

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

input:

2000
-982363 -186982
-654678 -755907
-468244 -883598
-999061 43307
-487654 873036
-996826 79600
-712944 -701220
-878254 -478193
-803280 595601
832745 -553656
-997294 73507
-969828 243790
449635 -893212
-180210 983627
582389 -812909
509250 860618
-845162 534508
-949329 314282
-976802 -214139
-414704 ...

output:

19811

result:

ok 1 number(s): "19811"

Test #55:

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

input:

2000
-944717 -327884
24164 -999707
988832 149033
545249 838273
54412 998518
996706 -81087
-632826 774293
971372 237560
-588936 -808179
-721351 -692569
909375 -415975
947390 320078
490265 -871573
770999 -636835
-877832 478968
-364048 -931380
995651 -93159
177569 -984108
945090 -326808
-107026 -994256...

output:

1

result:

ok 1 number(s): "1"

Extra Test:

score: 0
Extra Test Passed