QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#255743#7756. Omniscia Spares Noneucup-team087#AC ✓1ms3956kbC++2022.0kb2023-11-18 16:57:082023-11-18 16:57:09

Judging History

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

  • [2023-11-18 16:57:09]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3956kb
  • [2023-11-18 16:57:08]
  • 提交

answer

#line 1 "library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u32 = unsigned int;
using u64 = unsigned long long;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'000'000'000;
template <>
constexpr ll infty<ll> = ll(infty<int>) * infty<int> * 2;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * infty<ll>;
template <>
constexpr double infty<double> = infty<ll>;
template <>
constexpr long double infty<long double> = infty<ll>;

using pi = pair<ll, ll>;
using vi = vector<ll>;
template <class T>
using vc = vector<T>;
template <class T>
using vvc = vector<vc<T>>;
template <class T>
using vvvc = vector<vvc<T>>;
template <class T>
using vvvvc = vector<vvvc<T>>;
template <class T>
using vvvvvc = vector<vvvvc<T>>;
template <class T>
using pq = priority_queue<T>;
template <class T>
using pqg = priority_queue<T, vector<T>, greater<T>>;

#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__))))

// https://trap.jp/post/1224/
#define FOR1(a) for (ll _ = 0; _ < ll(a); ++_)
#define FOR2(i, a) for (ll i = 0; i < ll(a); ++i)
#define FOR3(i, a, b) for (ll i = a; i < ll(b); ++i)
#define FOR4(i, a, b, c) for (ll i = a; i < ll(b); i += (c))
#define FOR1_R(a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR2_R(i, a) for (ll i = (a)-1; i >= ll(0); --i)
#define FOR3_R(i, a, b) for (ll i = (b)-1; i >= ll(a); --i)
#define overload4(a, b, c, d, e, ...) e
#define overload3(a, b, c, d, ...) d
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FOR_R(...) overload3(__VA_ARGS__, FOR3_R, FOR2_R, FOR1_R)(__VA_ARGS__)

#define FOR_subset(t, s) \
  for (ll t = (s); t >= 0; t = (t == 0 ? -1 : (t - 1) & (s)))
#define all(x) x.begin(), x.end()
#define len(x) ll(x.size())
#define elif else if

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second

#define stoi stoll

int popcnt(int x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(ll x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
int popcnt_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

template <typename T>
T floor(T a, T b) {
  return a / b - (a % b && (a ^ b) < 0);
}
template <typename T>
T ceil(T x, T y) {
  return floor(x + y - 1, y);
}
template <typename T>
T bmod(T x, T y) {
  return x - y * floor(x, y);
}
template <typename T>
pair<T, T> divmod(T x, T y) {
  T q = floor(x, y);
  return {q, x - q * y};
}

template <typename T, typename U>
T SUM(const vector<U> &A) {
  T sm = 0;
  for (auto &&a: A) sm += a;
  return sm;
}

#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) \
  sort(all(x)), x.erase(unique(all(x)), x.end()), x.shrink_to_fit()

template <typename T>
T POP(deque<T> &que) {
  T a = que.front();
  que.pop_front();
  return a;
}
template <typename T>
T POP(pq<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(pqg<T> &que) {
  T a = que.top();
  que.pop();
  return a;
}
template <typename T>
T POP(vc<T> &que) {
  T a = que.back();
  que.pop_back();
  return a;
}

template <typename F>
ll binary_search(F check, ll ok, ll ng, bool check_ok = true) {
  if (check_ok) assert(check(ok));
  while (abs(ok - ng) > 1) {
    auto x = (ng + ok) / 2;
    (check(x) ? ok : ng) = x;
  }
  return ok;
}
template <typename F>
double binary_search_real(F check, double ok, double ng, int iter = 100) {
  FOR(iter) {
    double x = (ok + ng) / 2;
    (check(x) ? ok : ng) = x;
  }
  return (ok + ng) / 2;
}

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);
}

// ? は -1
vc<int> s_to_vi(const string &S, char first_char) {
  vc<int> A(S.size());
  FOR(i, S.size()) { A[i] = (S[i] != '?' ? S[i] - first_char : -1); }
  return A;
}

template <typename T, typename U>
vector<T> cumsum(vector<U> &A, int off = 1) {
  int N = A.size();
  vector<T> B(N + 1);
  FOR(i, N) { B[i + 1] = B[i] + A[i]; }
  if (off == 0) B.erase(B.begin());
  return B;
}

// stable sort
template <typename T>
vector<int> argsort(const vector<T> &A) {
  vector<int> ids(len(A));
  iota(all(ids), 0);
  sort(all(ids),
       [&](int i, int j) { return (A[i] == A[j] ? i < j : A[i] < A[j]); });
  return ids;
}

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}
#endif
#line 1 "library/other/io.hpp"
#define FASTIO
#include <unistd.h>

// https://judge.yosupo.jp/submission/21623
namespace fastio {
static constexpr uint32_t SZ = 1 << 17;
char ibuf[SZ];
char obuf[SZ];
char out[100];
// pointer of ibuf, obuf
uint32_t pil = 0, pir = 0, por = 0;

struct Pre {
  char num[10000][4];
  constexpr Pre() : num() {
    for (int i = 0; i < 10000; i++) {
      int n = i;
      for (int j = 3; j >= 0; j--) {
        num[i][j] = n % 10 | '0';
        n /= 10;
      }
    }
  }
} constexpr pre;

inline void load() {
  memcpy(ibuf, ibuf + pil, pir - pil);
  pir = pir - pil + fread(ibuf + pir - pil, 1, SZ - pir + pil, stdin);
  pil = 0;
  if (pir < SZ) ibuf[pir++] = '\n';
}

inline void flush() {
  fwrite(obuf, 1, por, stdout);
  por = 0;
}

void rd(char &c) {
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
}

void rd(string &x) {
  x.clear();
  char c;
  do {
    if (pil + 1 > pir) load();
    c = ibuf[pil++];
  } while (isspace(c));
  do {
    x += c;
    if (pil == pir) load();
    c = ibuf[pil++];
  } while (!isspace(c));
}

template <typename T>
void rd_real(T &x) {
  string s;
  rd(s);
  x = stod(s);
}

template <typename T>
void rd_integer(T &x) {
  if (pil + 100 > pir) load();
  char c;
  do
    c = ibuf[pil++];
  while (c < '-');
  bool minus = 0;
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (c == '-') { minus = 1, c = ibuf[pil++]; }
  }
  x = 0;
  while ('0' <= c) { x = x * 10 + (c & 15), c = ibuf[pil++]; }
  if constexpr (is_signed<T>::value || is_same_v<T, i128>) {
    if (minus) x = -x;
  }
}

void rd(int &x) { rd_integer(x); }
void rd(ll &x) { rd_integer(x); }
void rd(i128 &x) { rd_integer(x); }
void rd(u32 &x) { rd_integer(x); }
void rd(u64 &x) { rd_integer(x); }
void rd(u128 &x) { rd_integer(x); }
void rd(double &x) { rd_real(x); }
void rd(long double &x) { rd_real(x); }
void rd(f128 &x) { rd_real(x); }

template <class T, class U>
void rd(pair<T, U> &p) {
  return rd(p.first), rd(p.second);
}
template <size_t N = 0, typename T>
void rd_tuple(T &t) {
  if constexpr (N < std::tuple_size<T>::value) {
    auto &x = std::get<N>(t);
    rd(x);
    rd_tuple<N + 1>(t);
  }
}
template <class... T>
void rd(tuple<T...> &tpl) {
  rd_tuple(tpl);
}

template <size_t N = 0, typename T>
void rd(array<T, N> &x) {
  for (auto &d: x) rd(d);
}
template <class T>
void rd(vc<T> &x) {
  for (auto &d: x) rd(d);
}

void read() {}
template <class H, class... T>
void read(H &h, T &... t) {
  rd(h), read(t...);
}

void wt(const char c) {
  if (por == SZ) flush();
  obuf[por++] = c;
}
void wt(const string s) {
  for (char c: s) wt(c);
}
void wt(const char *s) {
  size_t len = strlen(s);
  for (size_t i = 0; i < len; i++) wt(s[i]);
}

template <typename T>
void wt_integer(T x) {
  if (por > SZ - 100) flush();
  if (x < 0) { obuf[por++] = '-', x = -x; }
  int outi;
  for (outi = 96; x >= 10000; outi -= 4) {
    memcpy(out + outi, pre.num[x % 10000], 4);
    x /= 10000;
  }
  if (x >= 1000) {
    memcpy(obuf + por, pre.num[x], 4);
    por += 4;
  } else if (x >= 100) {
    memcpy(obuf + por, pre.num[x] + 1, 3);
    por += 3;
  } else if (x >= 10) {
    int q = (x * 103) >> 10;
    obuf[por] = q | '0';
    obuf[por + 1] = (x - q * 10) | '0';
    por += 2;
  } else
    obuf[por++] = x | '0';
  memcpy(obuf + por, out + outi + 4, 96 - outi);
  por += 96 - outi;
}

template <typename T>
void wt_real(T x) {
  ostringstream oss;
  oss << fixed << setprecision(15) << double(x);
  string s = oss.str();
  wt(s);
}

void wt(int x) { wt_integer(x); }
void wt(ll x) { wt_integer(x); }
void wt(i128 x) { wt_integer(x); }
void wt(u32 x) { wt_integer(x); }
void wt(u64 x) { wt_integer(x); }
void wt(u128 x) { wt_integer(x); }
void wt(double x) { wt_real(x); }
void wt(long double x) { wt_real(x); }
void wt(f128 x) { wt_real(x); }

template <class T, class U>
void wt(const pair<T, U> val) {
  wt(val.first);
  wt(' ');
  wt(val.second);
}
template <size_t N = 0, typename T>
void wt_tuple(const T t) {
  if constexpr (N < std::tuple_size<T>::value) {
    if constexpr (N > 0) { wt(' '); }
    const auto x = std::get<N>(t);
    wt(x);
    wt_tuple<N + 1>(t);
  }
}
template <class... T>
void wt(tuple<T...> tpl) {
  wt_tuple(tpl);
}
template <class T, size_t S>
void wt(const array<T, S> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}
template <class T>
void wt(const vector<T> val) {
  auto n = val.size();
  for (size_t i = 0; i < n; i++) {
    if (i) wt(' ');
    wt(val[i]);
  }
}

void print() { wt('\n'); }
template <class Head, class... Tail>
void print(Head &&head, Tail &&... tail) {
  wt(head);
  if (sizeof...(Tail)) wt(' ');
  print(forward<Tail>(tail)...);
}

// gcc expansion. called automaticall after main.
void __attribute__((destructor)) _d() { flush(); }
} // namespace fastio
using fastio::read;
using fastio::print;
using fastio::flush;

#define INT(...)   \
  int __VA_ARGS__; \
  read(__VA_ARGS__)
#define LL(...)   \
  ll __VA_ARGS__; \
  read(__VA_ARGS__)
#define U32(...)   \
  u32 __VA_ARGS__; \
  read(__VA_ARGS__)
#define U64(...)   \
  u64 __VA_ARGS__; \
  read(__VA_ARGS__)
#define STR(...)      \
  string __VA_ARGS__; \
  read(__VA_ARGS__)
#define CHAR(...)   \
  char __VA_ARGS__; \
  read(__VA_ARGS__)
#define DBL(...)      \
  double __VA_ARGS__; \
  read(__VA_ARGS__)

#define VEC(type, name, size) \
  vector<type> name(size);    \
  read(name)
#define VV(type, name, h, w)                     \
  vector<vector<type>> name(h, vector<type>(w)); \
  read(name)

void YES(bool t = 1) { print(t ? "YES" : "NO"); }
void NO(bool t = 1) { YES(!t); }
void Yes(bool t = 1) { print(t ? "Yes" : "No"); }
void No(bool t = 1) { Yes(!t); }
void yes(bool t = 1) { print(t ? "yes" : "no"); }
void no(bool t = 1) { yes(!t); }
#line 3 "main.cpp"

#line 2 "library/geo/base.hpp"
template <typename T>
struct Point {
  T x, y;

  Point() : x(0), y(0) {}

  template <typename A, typename B>
  Point(A x, B y) : x(x), y(y) {}

  template <typename A, typename B>
  Point(pair<A, B> p) : x(p.fi), y(p.se) {}

  Point operator+(Point p) const { return {x + p.x, y + p.y}; }
  Point operator-(Point p) const { return {x - p.x, y - p.y}; }
  bool operator==(Point p) const { return x == p.x && y == p.y; }
  bool operator!=(Point p) const { return x != p.x || y != p.y; }
  Point operator-() const { return {-x, -y}; }
  Point operator*(T t) const { return {x * t, y * t}; }
  Point operator/(T t) const { return {x / t, y / t}; }

  bool operator<(Point p) const {
    if (x != p.x) return x < p.x;
    return y < p.y;
  }
  T dot(Point other) { return x * other.x + y * other.y; }
  T det(Point other) { return x * other.y - y * other.x; }

  double norm() { return sqrtl(x * x + y * y); }
  double angle() { return atan2(y, x); }

  Point rotate(double theta) {
    static_assert(!is_integral<T>::value);
    double c = cos(theta), s = sin(theta);
    return Point{c * x - s * y, s * x + c * y};
  }
};

#ifdef FASTIO
template <typename T>
void rd(Point<T>& p) {
  fastio::rd(p.x), fastio::rd(p.y);
}
template <typename T>
void wt(Point<T>& p) {
  fastio::wt(p.x);
  fastio::wt(' ');
  fastio::wt(p.y);
}
#endif

// A -> B -> C と進むときに、左に曲がるならば +1、右に曲がるならば -1
template <typename T>
int ccw(Point<T> A, Point<T> B, Point<T> C) {
  T x = (B - A).det(C - A);
  if (x > 0) return 1;
  if (x < 0) return -1;
  return 0;
}

template <typename REAL, typename T>
REAL dist(Point<T> A, Point<T> B) {
  A = A - B;
  T p = A.dot(A);
  return sqrt(REAL(p));
}

template <typename T>
struct Line {
  T a, b, c;

  Line(T a, T b, T c) : a(a), b(b), c(c) {}
  Line(Point<T> A, Point<T> B) {
    a = A.y - B.y, b = B.x - A.x, c = A.x * B.y - A.y * B.x;
  }
  Line(T x1, T y1, T x2, T y2) : Line(Point<T>(x1, y1), Point<T>(x2, y2)) {}

  template <typename U>
  U eval(Point<U> P) {
    return a * P.x + b * P.y + c;
  }

  template <typename U>
  T eval(U x, U y) {
    return a * x + b * y + c;
  }

  // 同じ直線が同じ a,b,c で表現されるようにする
  void normalize() {
    static_assert(is_same_v<T, int> || is_same_v<T, long long>);
    T g = gcd(gcd(abs(a), abs(b)), abs(c));
    a /= g, b /= g, c /= g;
    if (b < 0) { a = -a, b = -b, c = -c; }
    if (b == 0 && a < 0) { a = -a, b = -b, c = -c; }
  }

  bool is_parallel(Line other) { return a * other.b - b * other.a == 0; }
  bool is_orthogonal(Line other) { return a * other.a + b * other.b == 0; }
};

template <typename T>
struct Segment {
  Point<T> A, B;

  Segment(Point<T> A, Point<T> B) : A(A), B(B) {}
  Segment(T x1, T y1, T x2, T y2)
      : Segment(Point<T>(x1, y1), Point<T>(x2, y2)) {}

  bool contain(Point<T> C) {
    static_assert(is_integral<T>::value);
    T det = (C - A).det(B - A);
    if (det != 0) return 0;
    return (C - A).dot(B - A) >= 0 && (C - B).dot(A - B) >= 0;
  }

  Line<T> to_Line() { return Line(A, B); }
};

template <typename REAL>
struct Circle {
  Point<REAL> O;
  REAL r;
  Circle(Point<REAL> O, REAL r) : O(O), r(r) {}
  Circle(REAL x, REAL y, REAL r) : O(x, y), r(r) {}
  template <typename T>
  bool contain(Point<T> p) {
    REAL dx = p.x - O.x, dy = p.y - O.y;
    return dx * dx + dy * dy <= r * r;
  }
};

template <typename T>
struct Polygon {
  vc<Point<T>> points;
  T a;

  template <typename A, typename B>
  Polygon(vc<pair<A, B>> pairs) {
    for (auto&& [a, b]: pairs) points.eb(Point<T>(a, b));
    build();
  }
  Polygon(vc<Point<T>> points) : points(points) { build(); }

  int size() { return len(points); }

  template <typename REAL>
  REAL area() {
    return a * 0.5;
  }

  template <enable_if_t<is_integral<T>::value, int> = 0>
  T area_2() {
    return a;
  }

  bool is_convex() {
    FOR(j, len(points)) {
      int i = (j == 0 ? len(points) - 1 : j - 1);
      int k = (j == len(points) - 1 ? 0 : j + 1);
      if ((points[j] - points[i]).det(points[k] - points[j]) < 0) return false;
    }
    return true;
  }

private:
  void build() {
    a = 0;
    FOR(i, len(points)) {
      int j = (i + 1 == len(points) ? 0 : i + 1);
      a += points[i].det(points[j]);
    }
    if (a < 0) {
      a = -a;
      reverse(all(points));
    }
  }
};
#line 2 "library/geo/cross_point.hpp"

#line 4 "library/geo/cross_point.hpp"

// 平行でないことを仮定
template <typename REAL, typename T>
Point<REAL> cross_point(const Line<T> L1, const Line<T> L2) {
  T det = L1.a * L2.b - L1.b * L2.a;
  assert(det != 0);
  REAL x = -REAL(L1.c) * L2.b + REAL(L1.b) * L2.c;
  REAL y = -REAL(L1.a) * L2.c + REAL(L1.c) * L2.a;
  return Point<REAL>(x / det, y / det);
}

// 浮動小数点数はエラー
// 0: 交点なし
// 1: 一意な交点
// 2:2 つ以上の交点(整数型を利用して厳密にやる)
template <typename T>
int count_cross(Segment<T> S1, Segment<T> S2, bool include_ends) {
  static_assert(!std::is_floating_point<T>::value);
  Line<T> L1 = S1.to_Line();
  Line<T> L2 = S2.to_Line();
  if (L1.is_parallel(L2)) {
    if (L1.eval(S2.A) != 0) return 0;
    // 4 点とも同一直線上にある
    T a1 = S1.A.x, b1 = S1.B.x;
    T a2 = S2.A.x, b2 = S2.B.x;
    if (a1 == b1) {
      a1 = S1.A.y, b1 = S1.B.y;
      a2 = S2.A.y, b2 = S2.B.y;
    }
    if (a1 > b1) swap(a1, b1);
    if (a2 > b2) swap(a2, b2);
    T a = max(a1, a2);
    T b = min(b1, b2);
    if (a < b) return 2;
    if (a > b) return 0;
    return (include_ends ? 1 : 0);
  }
  // 平行でない場合
  T a1 = L2.eval(S1.A), b1 = L2.eval(S1.B);
  T a2 = L1.eval(S2.A), b2 = L1.eval(S2.B);
  if (a1 > b1) swap(a1, b1);
  if (a2 > b2) swap(a2, b2);
  bool ok1 = 0, ok2 = 0;

  if (include_ends) {
    ok1 = (a1 <= 0) && (0 <= b1);
    ok2 = (a2 <= 0) && (0 <= b2);
  } else {
    ok1 = (a1 < 0) && (0 < b1);
    ok2 = (a2 < 0) && (0 < b2);
  }
  return (ok1 && ok2 ? 1 : 0);
}

template <typename REAL, typename T>
vc<Point<REAL>> cross_point(const Circle<T> C, const Line<T> L) {
  T a = L.a, b = L.b, c = L.a * (C.O.x) + L.b * (C.O.y) + L.c;
  T r = C.r;
  // ax+by+c=0, x^2+y^2=r^2
  if (a == 0) {
    REAL y = REAL(-c) / b;
    REAL bbxx = b * b * r * r - c * c;
    if (bbxx < 0) return {};
    if (bbxx == 0) return {Point<REAL>(0 + C.O.x, y + C.O.y)};
    REAL x = sqrtl(bbxx) / b;
    return {Point<REAL>(-x + C.O.x, y + C.O.y),
            Point<REAL>(+x + C.O.x, y + C.O.y)};
  }
  T D = 4 * a * a * b * b - 4 * (a * a + b * b) * (c * c - a * a * r * r);
  if (D < 0) return {};
  REAL sqD = sqrtl(D);
  REAL y1 = (-2 * a * c + sqD) / (2 * (a * a + b * b));
  REAL y2 = (-2 * a * c - sqD) / (2 * (a * a + b * b));
  REAL x1 = (-b * y1 - c) / a;
  REAL x2 = (-b * y2 - c) / a;
  x1 += C.O.x, x2 += C.O.x;
  y1 += C.O.y, y2 += C.O.y;
  if (D == 0) return {Point<REAL>(x1, y1)};
  return {Point<REAL>(x1, y1), Point<REAL>(x2, y2)};
}

// https://codeforces.com/contest/2/problem/C
template <typename REAL, typename T>
tuple<bool, Point<T>, Point<T>> cross_point_circle(Circle<T> C1, Circle<T> C2) {
  using P = Point<T>;
  P O{0, 0};
  P A = C1.O, B = C2.O;
  if (A == B) return {false, O, O};
  T d = (B - A).norm();
  REAL cos_val = (C1.r * C1.r + d * d - C2.r * C2.r) / (2 * C1.r * d);
  if (cos_val < -1 || 1 < cos_val) return {false, O, O};
  REAL t = acos(cos_val);
  REAL u = (B - A).angle();
  P X = A + P{C1.r * cos(u + t), C1.r * sin(u + t)};
  P Y = A + P{C1.r * cos(u - t), C1.r * sin(u - t)};
  return {true, X, Y};
}
#line 6 "main.cpp"

using PO = Point<ll>;

void solve_odd() { return No(); }

void out(int N, vc<PO> point, vc<pi> edges) {
  assert(N == len(point));
  vc<int> deg(N);
  for (auto& [a, b]: edges) { deg[a]++, deg[b]++; }
  int M = len(edges);
  FOR(m2, M) FOR(m1, m2) {
    auto [a, b] = edges[m1];
    auto [c, d] = edges[m2];
    Segment<ll> seg1(point[a], point[b]);
    Segment<ll> seg2(point[c], point[d]);
    int cnt = count_cross(seg1, seg2, false);
    assert(cnt == 0);
  }
  // print(deg);
  Yes();
  for (auto& p: point) print(p);
  print(len(edges));
  for (auto& [a, b]: edges) print(1 + a, 1 + b);
}

void solve() {
  LL(N);
  if (N <= 4) {
    Yes();
    FOR(i, N) print(0, i);
    print(0);
    return;
  }
  if (N == 5) return No();
  if (N == 6) return No();
  if (N == 7) return No();
  if (N % 2 == 1) return solve_odd();

  PO A = {0, +100'000'000};
  PO B = {0, -100'000'000};
  PO C = {+100'000'000, 0};
  PO L = {500, 0};
  PO P = {1000, 0};
  PO Q = {2000, 0};
  PO R = {1500, 1000};
  PO S = {1500, -1000};
  int a = 0, b = 1, c = 2, l = 3, p = 4, q = 5, r = 6, s = 7;
  vc<PO> point = {A, B, C, L, P, Q, R, S};
  vc<pi> edges;
  edges.eb(a, b), edges.eb(b, c), edges.eb(c, a);
  edges.eb(a, l), edges.eb(a, p), edges.eb(a, r), edges.eb(a, q);
  edges.eb(b, l), edges.eb(b, p), edges.eb(b, s), edges.eb(b, q);
  edges.eb(l, p), edges.eb(p, r), edges.eb(p, s), edges.eb(r, q),
      edges.eb(s, q);
  edges.eb(c, q);
  while (len(point) < N) {
    int dx = 0, dy = 0;
    if (P.x == Q.x) {
      dy = (Q.y - P.y) / abs(Q.y - P.y);
    } else {
      dx = (Q.x - P.x) / abs(Q.x - P.x);
    }
    PO PP = {P.x + dx, P.y + dy};
    PO QQ = {Q.x - dx, Q.y - dy};
    int pp = len(point);
    int qq = len(point) + 1;
    edges.eb(p, pp), edges.eb(q, qq);
    edges.eb(pp, r), edges.eb(qq, r);
    edges.eb(pp, s), edges.eb(qq, s);
    point.eb(PP), point.eb(QQ);
    tie(P, Q, R, S) = mt(S, R, PP, QQ);
    tie(p, q, r, s) = mt(s, r, pp, qq);
  }
  // for (auto& x: point) print(x);
  edges.eb(p, q);
  out(N, point, edges);
}

signed main() {
  solve();
  return 0;
}

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

詳細信息

Test #1:

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

input:

3

output:

Yes
0 0
0 1
0 2
0

result:

ok OK, Accepted.

Test #2:

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

input:

4

output:

Yes
0 0
0 1
0 2
0 3
0

result:

ok OK, Accepted.

Test #3:

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

input:

1

output:

Yes
0 0
0

result:

ok OK, Accepted.

Test #4:

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

input:

2

output:

Yes
0 0
0 1
0

result:

ok OK, Accepted.

Test #5:

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

input:

5

output:

No

result:

ok OK, Accepted.

Test #6:

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

input:

6

output:

No

result:

ok OK, Accepted.

Test #7:

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

input:

7

output:

No

result:

ok OK, Accepted.

Test #8:

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

input:

8

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
18
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 6

result:

ok OK, Accepted.

Test #9:

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

input:

9

output:

No

result:

ok OK, Accepted.

Test #10:

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

input:

10

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
24
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 7

result:

ok OK, Accepted.

Test #11:

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

input:

11

output:

No

result:

ok OK, Accepted.

Test #12:

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

input:

12

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
30
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 12
11 9
12 9
11 10
12 10
10 9

result:

ok OK, Accepted.

Test #13:

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

input:

13

output:

No

result:

ok OK, Accepted.

Test #14:

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

input:

14

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
36
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 12
11 9
12 9
11 10
12 10
10 13
9 14
13 11
14 11
13 12
14 12
12 11

result:

ok OK, Accepted.

Test #15:

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

input:

15

output:

No

result:

ok OK, Accepted.

Test #16:

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

input:

16

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
42
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 12
11 9
12 9
11 10
12 10
10 13
9 14
13 11
14 11...

result:

ok OK, Accepted.

Test #17:

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

input:

17

output:

No

result:

ok OK, Accepted.

Test #18:

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

input:

18

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
48
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 12
11 9
12 9
11 10
12 10
10 13
9 ...

result:

ok OK, Accepted.

Test #19:

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

input:

19

output:

No

result:

ok OK, Accepted.

Test #20:

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

input:

20

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
54
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 12
11 9
12 9
1...

result:

ok OK, Accepted.

Test #21:

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

input:

21

output:

No

result:

ok OK, Accepted.

Test #22:

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

input:

22

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
60
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10 7
9 8
10 8
8 11
7 ...

result:

ok OK, Accepted.

Test #23:

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

input:

23

output:

No

result:

ok OK, Accepted.

Test #24:

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

input:

24

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
66
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5 9
6 10
9 7
10...

result:

ok OK, Accepted.

Test #25:

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

input:

25

output:

No

result:

ok OK, Accepted.

Test #26:

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

input:

26

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
72
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 7
5 8
7 6
8 6
3 6
5...

result:

ok OK, Accepted.

Test #27:

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

input:

27

output:

No

result:

ok OK, Accepted.

Test #28:

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

input:

28

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
78
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
2 8
2 6
4 5
5 ...

result:

ok OK, Accepted.

Test #29:

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

input:

29

output:

No

result:

ok OK, Accepted.

Test #30:

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

input:

30

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
84
1 2
2 3
3 1
1 4
1 5
1 7
1 6
2 4
2 5
...

result:

ok OK, Accepted.

Test #31:

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

input:

31

output:

No

result:

ok OK, Accepted.

Test #32:

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

input:

32

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
90
1 2
2 3
3 1
1 4
1...

result:

ok OK, Accepted.

Test #33:

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

input:

33

output:

No

result:

ok OK, Accepted.

Test #34:

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

input:

34

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
96
1 2...

result:

ok OK, Accepted.

Test #35:

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

input:

35

output:

No

result:

ok OK, Accepted.

Test #36:

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

input:

36

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #37:

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

input:

37

output:

No

result:

ok OK, Accepted.

Test #38:

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

input:

38

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #39:

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

input:

39

output:

No

result:

ok OK, Accepted.

Test #40:

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

input:

40

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #41:

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

input:

41

output:

No

result:

ok OK, Accepted.

Test #42:

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

input:

42

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #43:

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

input:

43

output:

No

result:

ok OK, Accepted.

Test #44:

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

input:

44

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #45:

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

input:

45

output:

No

result:

ok OK, Accepted.

Test #46:

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

input:

46

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #47:

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

input:

47

output:

No

result:

ok OK, Accepted.

Test #48:

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

input:

48

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #49:

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

input:

49

output:

No

result:

ok OK, Accepted.

Test #50:

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

input:

50

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #51:

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

input:

51

output:

No

result:

ok OK, Accepted.

Test #52:

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

input:

52

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #53:

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

input:

53

output:

No

result:

ok OK, Accepted.

Test #54:

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

input:

54

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #55:

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

input:

55

output:

No

result:

ok OK, Accepted.

Test #56:

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

input:

56

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #57:

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

input:

57

output:

No

result:

ok OK, Accepted.

Test #58:

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

input:

58

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #59:

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

input:

59

output:

No

result:

ok OK, Accepted.

Test #60:

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

input:

60

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #61:

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

input:

61

output:

No

result:

ok OK, Accepted.

Test #62:

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

input:

62

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #63:

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

input:

63

output:

No

result:

ok OK, Accepted.

Test #64:

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

input:

64

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #65:

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

input:

65

output:

No

result:

ok OK, Accepted.

Test #66:

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

input:

66

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #67:

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

input:

67

output:

No

result:

ok OK, Accepted.

Test #68:

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

input:

68

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #69:

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

input:

69

output:

No

result:

ok OK, Accepted.

Test #70:

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

input:

70

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #71:

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

input:

71

output:

No

result:

ok OK, Accepted.

Test #72:

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

input:

72

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #73:

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

input:

73

output:

No

result:

ok OK, Accepted.

Test #74:

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

input:

74

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #75:

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

input:

75

output:

No

result:

ok OK, Accepted.

Test #76:

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

input:

76

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #77:

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

input:

77

output:

No

result:

ok OK, Accepted.

Test #78:

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

input:

78

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #79:

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

input:

79

output:

No

result:

ok OK, Accepted.

Test #80:

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

input:

80

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #81:

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

input:

81

output:

No

result:

ok OK, Accepted.

Test #82:

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

input:

82

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #83:

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

input:

83

output:

No

result:

ok OK, Accepted.

Test #84:

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

input:

84

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #85:

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

input:

85

output:

No

result:

ok OK, Accepted.

Test #86:

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

input:

86

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #87:

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

input:

87

output:

No

result:

ok OK, Accepted.

Test #88:

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

input:

88

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #89:

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

input:

89

output:

No

result:

ok OK, Accepted.

Test #90:

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

input:

90

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #91:

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

input:

91

output:

No

result:

ok OK, Accepted.

Test #92:

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

input:

92

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #93:

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

input:

93

output:

No

result:

ok OK, Accepted.

Test #94:

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

input:

94

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #95:

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

input:

95

output:

No

result:

ok OK, Accepted.

Test #96:

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

input:

96

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #97:

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

input:

97

output:

No

result:

ok OK, Accepted.

Test #98:

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

input:

98

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Test #99:

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

input:

99

output:

No

result:

ok OK, Accepted.

Test #100:

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

input:

100

output:

Yes
0 100000000
0 -100000000
100000000 0
500 0
1000 0
2000 0
1500 1000
1500 -1000
1001 0
1999 0
1500 -999
1500 999
1998 0
1002 0
1500 998
1500 -998
1003 0
1997 0
1500 -997
1500 997
1996 0
1004 0
1500 996
1500 -996
1005 0
1995 0
1500 -995
1500 995
1994 0
1006 0
1500 994
1500 -994
1007 0
1993 0
1500 -...

result:

ok OK, Accepted.

Extra Test:

score: 0
Extra Test Passed