QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#781101#8241. Master of Both VmaspyAC ✓1358ms170144kbC++2328.8kb2024-11-25 14:48:012024-11-25 14:48:03

Judging History

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

  • [2024-11-25 14:48:03]
  • 评测
  • 测评结果:AC
  • 用时:1358ms
  • 内存:170144kb
  • [2024-11-25 14:48:01]
  • 提交

answer

#line 1 "/home/maspy/compro/library/my_template.hpp"
#if defined(LOCAL)
#include <my_template_compiled.hpp>
#else

// https://codeforces.com/blog/entry/96344
#pragma GCC optimize("Ofast,unroll-loops")
// いまの CF だとこれ入れると動かない?
// #pragma GCC target("avx2,popcnt")

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i128 = __int128;
using u128 = unsigned __int128;
using f128 = __float128;

template <class T>
constexpr T infty = 0;
template <>
constexpr int infty<int> = 1'010'000'000;
template <>
constexpr ll infty<ll> = 2'020'000'000'000'000'000;
template <>
constexpr u32 infty<u32> = infty<int>;
template <>
constexpr u64 infty<u64> = infty<ll>;
template <>
constexpr i128 infty<i128> = i128(infty<ll>) * 2'000'000'000'000'000'000;
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_sgn(int x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u32 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(ll x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(u64 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
// (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 kth_bit(int k) {
  return T(1) << k;
}
template <typename T>
bool has_kth_bit(T x, int k) {
  return x >> k & 1;
}

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

template <typename T, typename... Vectors>
void concat(vc<T> &first, const Vectors &... others) {
  vc<T> &res = first;
  (res.insert(res.end(), others.begin(), others.end()), ...);
}
#endif
#line 1 "/home/maspy/compro/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;

#if defined(LOCAL)
#define SHOW(...) SHOW_IMPL(__VA_ARGS__, SHOW6, SHOW5, SHOW4, SHOW3, SHOW2, SHOW1)(__VA_ARGS__)
#define SHOW_IMPL(_1, _2, _3, _4, _5, _6, NAME, ...) NAME
#define SHOW1(x) print(#x, "=", (x)), flush()
#define SHOW2(x, y) print(#x, "=", (x), #y, "=", (y)), flush()
#define SHOW3(x, y, z) print(#x, "=", (x), #y, "=", (y), #z, "=", (z)), flush()
#define SHOW4(x, y, z, w) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w)), flush()
#define SHOW5(x, y, z, w, v) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v)), flush()
#define SHOW6(x, y, z, w, v, u) print(#x, "=", (x), #y, "=", (y), #z, "=", (z), #w, "=", (w), #v, "=", (v), #u, "=", (u)), flush()
#else
#define SHOW(...)
#endif

#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 "/home/maspy/compro/library/geo/angle_sort.hpp"

#line 2 "/home/maspy/compro/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+=(const Point p) {
    x += p.x, y += p.y;
    return *this;
  }
  Point operator-=(const Point p) {
    x -= p.x, y -= p.y;
    return *this;
  }
  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(const Point& other) const { return x * other.x + y * other.y; }
  T det(const Point& other) const { 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};
  }
  Point rot90(bool ccw) { return (ccw ? Point{-y, x} : Point{y, -x}); }
};

#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, typename U>
REAL dist(Point<T> A, Point<U> B) {
  REAL dx = REAL(A.x) - REAL(B.x);
  REAL dy = REAL(A.y) - REAL(B.y);
  return sqrt(dx * dx + dy * dy);
}

// ax+by+c
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) {
    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;
  }
};
#line 4 "/home/maspy/compro/library/geo/angle_sort.hpp"

// lower: -1, origin: 0, upper: 1
template <typename T>
int lower_or_upper(const Point<T>& p) {
  if (p.y != 0) return (p.y > 0 ? 1 : -1);
  if (p.x > 0) return -1;
  if (p.x < 0) return 1;
  return 0;
}

// L<R:-1, L==R:0, L>R:1
template <typename T>
int angle_comp_3(const Point<T>& L, const Point<T>& R) {
  int a = lower_or_upper(L), b = lower_or_upper(R);
  if (a != b) return (a < b ? -1 : +1);
  T det = L.det(R);
  if (det > 0) return -1;
  if (det < 0) return 1;
  return 0;
}
// 偏角ソートに対する argsort
template <typename T>
vector<int> angle_sort(vector<Point<T>>& P) {
  vc<int> I(len(P));
  FOR(i, len(P)) I[i] = i;
  sort(all(I), [&](auto& L, auto& R) -> bool { return angle_comp_3(P[L], P[R]) == -1; });
  return I;
}

// 偏角ソートに対する argsort
template <typename T>
vector<int> angle_sort(vector<pair<T, T>>& P) {
  vc<Point<T>> tmp(len(P));
  FOR(i, len(P)) tmp[i] = Point<T>(P[i]);
  return angle_sort<T>(tmp);
}
#line 1 "/home/maspy/compro/library/ds/offline_query/add_remove_query.hpp"
/*
・時刻 t に x を追加する
・時刻 t に x を削除する
があるときに,
・時刻 [l, r) に x を追加する
に変換する. 同じキーが複数回来ると困るので適当なラベルをつけておこう.
*/
template <typename X, bool monotone>
struct Add_Remove_Query {
  map<X, int> MP;
  vc<tuple<int, int, X>> dat;
  map<X, vc<int>> ADD;
  map<X, vc<int>> RM;

  void add(int time, X x) {
    if (monotone) return add_monotone(time, x);
    ADD[x].eb(time);
  }
  void remove(int time, X x) {
    if (monotone) return remove_monotone(time, x);
    RM[x].eb(time);
  }

  // すべてのクエリが終わった現在時刻を渡す
  vc<tuple<int, int, X>> calc(int time) {
    if (monotone) return calc_monotone(time);
    vc<tuple<int, int, X>> dat;
    for (auto&& [x, A]: ADD) {
      vc<int> B;
      if (RM.count(x)) {
        B = RM[x];
        RM.erase(x);
      }
      if (len(B) < len(A)) B.eb(time);
      assert(len(A) == len(B));

      sort(all(A));
      sort(all(B));
      FOR(i, len(A)) {
        assert(A[i] <= B[i]);
        if (A[i] < B[i]) dat.eb(A[i], B[i], x);
      }
    }
    assert(len(RM) == 0);
    return dat;
  }

private:
  void add_monotone(int time, X x) {
    assert(!MP.count(x));
    MP[x] = time;
  }
  void remove_monotone(int time, X x) {
    auto it = MP.find(x);
    assert(it != MP.end());
    int t = (*it).se;
    MP.erase(it);
    if (t == time) return;
    dat.eb(t, time, x);
  }
  vc<tuple<int, int, X>> calc_monotone(int time) {
    for (auto&& [x, t]: MP) {
      if (t == time) continue;
      dat.eb(t, time, x);
    }
    return dat;
  }
};
#line 2 "/home/maspy/compro/library/ds/fastset.hpp"

// 64-ary tree
// space: (N/63) * u64
struct FastSet {
  static constexpr u32 B = 64;
  int n, log;
  vvc<u64> seg;

  FastSet() {}
  FastSet(int n) { build(n); }

  int size() { return n; }

  template <typename F>
  FastSet(int n, F f) {
    build(n, f);
  }

  void build(int m) {
    seg.clear();
    n = m;
    do {
      seg.push_back(vc<u64>((m + B - 1) / B));
      m = (m + B - 1) / B;
    } while (m > 1);
    log = len(seg);
  }
  template <typename F>
  void build(int n, F f) {
    build(n);
    FOR(i, n) { seg[0][i / B] |= u64(f(i)) << (i % B); }
    FOR(h, log - 1) {
      FOR(i, len(seg[h])) { seg[h + 1][i / B] |= u64(bool(seg[h][i])) << (i % B); }
    }
  }

  bool operator[](int i) const { return seg[0][i / B] >> (i % B) & 1; }
  void insert(int i) {
    assert(0 <= i && i < n);
    for (int h = 0; h < log; h++) { seg[h][i / B] |= u64(1) << (i % B), i /= B; }
  }
  void add(int i) { insert(i); }
  void erase(int i) {
    assert(0 <= i && i < n);
    u64 x = 0;
    for (int h = 0; h < log; h++) {
      seg[h][i / B] &= ~(u64(1) << (i % B));
      seg[h][i / B] |= x << (i % B);
      x = bool(seg[h][i / B]);
      i /= B;
    }
  }
  void remove(int i) { erase(i); }

  // min[x,n) or n
  int next(int i) {
    assert(i <= n);
    chmax(i, 0);
    for (int h = 0; h < log; h++) {
      if (i / B == seg[h].size()) break;
      u64 d = seg[h][i / B] >> (i % B);
      if (!d) {
        i = i / B + 1;
        continue;
      }
      i += lowbit(d);
      for (int g = h - 1; g >= 0; g--) {
        i *= B;
        i += lowbit(seg[g][i / B]);
      }
      return i;
    }
    return n;
  }

  // max [0,x], or -1
  int prev(int i) {
    assert(i >= -1);
    if (i >= n) i = n - 1;
    for (int h = 0; h < log; h++) {
      if (i == -1) break;
      u64 d = seg[h][i / B] << (63 - i % B);
      if (!d) {
        i = i / B - 1;
        continue;
      }
      i -= __builtin_clzll(d);
      for (int g = h - 1; g >= 0; g--) {
        i *= B;
        i += topbit(seg[g][i / B]);
      }
      return i;
    }
    return -1;
  }

  bool any(int l, int r) { return next(l) < r; }

  // [l, r)
  template <typename F>
  void enumerate(int l, int r, F f) {
    for (int x = next(l); x < r; x = next(x + 1)) f(x);
  }

  string to_string() {
    string s(n, '?');
    for (int i = 0; i < n; ++i) s[i] = ((*this)[i] ? '1' : '0');
    return s;
  }
};
#line 2 "/home/maspy/compro/library/ds/rollback_array.hpp"

template <typename T>
struct Rollback_Array {
  int N;
  vc<T> dat;
  vc<pair<int, T>> history;

  Rollback_Array() {}
  Rollback_Array(vc<T> x) : N(len(x)), dat(x) {}
  Rollback_Array(int N) : N(N), dat(N) {}
  template <typename F>
  Rollback_Array(int N, F f) : N(N) {
    dat.reserve(N);
    FOR(i, N) dat.eb(f(i));
  }

  int time() { return len(history); }
  void rollback(int t) {
    FOR_R(i, t, time()) {
      auto& [idx, v] = history[i];
      dat[idx] = v;
    }
    history.resize(t);
  }
  T get(int idx) { return dat[idx]; }
  void set(int idx, T x) {
    history.eb(idx, dat[idx]);
    dat[idx] = x;
  }

  vc<T> get_all() {
    vc<T> res(N);
    FOR(i, N) res[i] = get(i);
    return res;
  }
};
#line 8 "main.cpp"

using P = Point<ll>;

void solve() {
  Add_Remove_Query<int, true> ARQ;
  vc<pair<P, P>> dat;
  LL(Q);
  vc<int> QtoI(Q);

  FOR(q, Q) {
    STR(S);
    if (S == "+") {
      int i = len(dat);
      P a, b;
      read(a, b);
      dat.eb(a, b);
      ARQ.add(q, i);
      QtoI[q] = i;
    }
    elif (S == "-") {
      INT(i);
      --i;
      i = QtoI[i];
      ARQ.remove(q, i);
    }
    else {
      assert(0);
    }
  }

  int N = len(dat);
  vc<P> dir(N), rdir(N);
  FOR(i, N) {
    P p = dat[i].se - dat[i].fi;
    int g = gcd(abs(p.x), abs(p.y));
    p.x /= g, p.y /= g;
    P q = -p;
    if (angle_comp_3(p, q) == 1) swap(p, q), swap(dat[i].fi, dat[i].se);
    dir[i] = p, rdir[i] = q;
  }
  vc<P> DIR;
  concat(DIR, dir, rdir);
  UNIQUE(DIR);
  vc<int> drk(N);
  {
    auto I = angle_sort(DIR);
    DIR = rearrange(DIR, I);
    map<P, int> MP;
    FOR(i, len(DIR)) MP[DIR[i]] = i;
    FOR(i, N) drk[i] = MP[dir[i]];
  }

  int M = len(DIR);
  FastSet FS(M);
  Rollback_Array<P> point(3);
  Rollback_Array<P> L(M), R(M);
  int npoint = 0;

  // rollback_dfs
  auto upd = ARQ.calc(Q);
  string ANS(Q, '?');
  vc<int> I(len(upd));
  iota(all(I), 0);

  auto dfs = [&](auto& dfs, vc<int>& upd_query_I, int begin, int end) -> void {
    if (begin == end) return;
    vc<int> FS_history;
    int np = npoint;
    int ptime = point.time();
    int Ltime = L.time();
    int Rtime = R.time();

    // SHOW(npoint);
    // FOR(i, npoint) SHOW(i, point.get(i));

    bool valid = 1;

    auto add = [&](int X) -> void {
      P A = dat[X].fi, B = dat[X].se;
      int m = drk[X];
      if (npoint == 0) {
        FS_history.eb(m);
        FS.insert(m);
        L.set(m, A);
        R.set(m, B);
        point.set(0, A);
        point.set(1, B);
        npoint = 2;
        return;
      }
      if (npoint == 2) {
        int now = FS.next(0);
        SHOW(now);
        assert(FS.next(now + 1) == M);
        P S = L.get(now), T = R.get(now);
        if ((S - T).det(A - B) == 0) {
          // 平行
          SHOW(M, now, m);
          SHOW(DIR[now], S, T);
          SHOW(DIR[m], A, B);
          assert(now == m);
          int c = ccw(S, T, A);
          if (c == 0) {
            P d = dir[X];
            if (S.dot(d) > A.dot(d)) { L.set(m, A); }
            if (T.dot(d) < B.dot(d)) { R.set(m, B); }
            return;
          }
          if (c == 1) {
            point.set(2, A);
            npoint = 3;
            int rm = m + M / 2;
            FS.insert(rm);
            FS_history.eb(rm);
            L.set(rm, B);
            R.set(rm, A);
            return;
          }
          int rm = m + M / 2;
          point.set(2, A);
          npoint = 3;
          FS.insert(rm);
          FS_history.eb(rm);
          L.set(rm, T), R.set(rm, S);
          L.set(m, A), R.set(m, B);
          return;
        }
        if (ccw(S, T, A) != 0) {
          point.set(2, A);
          npoint = 3;
        } else {
          point.set(2, B);
          npoint = 3;
        }
        // 線分 ST の向き
        if (ccw(S, T, point.get(2)) < 0) {
          FS_history.eb(now);
          FS.erase(now);
          FS_history.eb(now + M / 2);
          FS.insert(now + M / 2);
          L.set(now + M / 2, T);
          R.set(now + M / 2, S);
        }
      }
      assert(npoint == 3);
      FOR(i, 3) {
        P p = point.get(i);
        if (ccw(A, B, p) == 0) continue;
        if (ccw(A, B, p) == 1) break;
        swap(A, B);
        m += M / 2;
        break;
      }
      // upd dir==m
      P d = DIR[m];
      assert(A.dot(d) < B.dot(d));
      if (FS[m]) {
        P S = L.get(m), T = R.get(m);
        if (ccw(S, T, A) != 0) {
          valid = 0;
          return;
        }
        if (S.dot(d) > A.dot(d)) { L.set(m, A); }
        if (T.dot(d) < B.dot(d)) { R.set(m, B); }
      } else {
        FS.insert(m);
        FS_history.eb(m);
        L.set(m, A), R.set(m, B);
      }
      // check at m
      int l = FS.prev(m - 1), r = FS.next(m + 1);
      if (l == -1) l = FS.prev(M - 1);
      if (r == M) r = FS.next(0);
      array<P, 6> six;
      six[0] = L.get(l), six[1] = R.get(l);
      six[2] = L.get(m), six[3] = R.get(m);
      six[4] = L.get(r), six[5] = R.get(r);
      FOR(k, 0, 4) {
        if (ccw(six[k], six[k + 1], six[k + 2]) == -1) valid = 0;
      }
    };

    vc<int> IL, IR;
    int mid = (begin + end) / 2;
    for (auto&& i: upd_query_I) {
      auto [a, b, X] = upd[i];
      if (a <= begin && end <= b) {
        // X で表される update query を処理する
        SHOW("-----------ADD", X);
        add(X);
      } else {
        if (a < mid) IL.eb(i);
        if (mid < b) IR.eb(i);
      }
    }
    if (valid) {
      if (begin + 1 == end) {
        // 求値クエリ
        int qid = begin;
        ANS[qid] = '1';
      } else {
        dfs(dfs, IL, begin, mid);
        dfs(dfs, IR, mid, end);
      }
    } else {
      FOR(q, begin, end) ANS[q] = '0';
    }
    // rollback
    // SHOW(npoint, np);
    // SHOW(FS.to_string());
    // SHOW(FS_history);
    npoint = np;
    point.rollback(ptime);
    L.rollback(Ltime);
    R.rollback(Rtime);
    while (len(FS_history)) {
      int i = POP(FS_history);
      if (FS[i])
        FS.erase(i);
      else
        FS.insert(i);
    }
  };
  dfs(dfs, I, 0, Q);

  print(ANS);
}

signed main() {
  INT(T);
  FOR(T) solve();
}

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

详细

Test #1:

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

input:

4
8
+ 0 0 1 0
+ 5 5 1 3
+ 2 0 2 1
+ 9 7 6 2
+ 1 2 2 2
- 4
+ 0 1 0 2
- 2
5
+ 0 0 1 1
+ 0 1 1 2
+ 0 2 1 3
- 2
+ 1 1 10 10
4
+ 0 0 1 1
+ 0 0 1 0
+ 0 0 0 1
- 1
4
+ 0 0 1 1
+ 0 0 1 1
- 1
- 2

output:

11000001
11011
1101
1111

result:

ok 4 lines

Test #2:

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

input:

10
17
+ -1 -3 -2 2
+ 0 0 2 3
- 1
+ 2 3 -3 0
+ 1 -1 -2 3
+ 0 -2 3 3
- 2
+ -3 1 1 -3
- 5
+ 0 -2 -1 1
- 4
- 6
+ -1 3 -1 -2
+ 2 3 0 1
- 10
- 8
+ -3 3 2 3
31
+ 3 0 2 1
+ 0 -3 1 0
- 2
- 1
+ 3 2 2 3
- 5
+ -3 3 -3 -2
- 7
+ -1 -1 3 3
- 9
+ 0 1 0 -2
+ -3 -2 2 0
+ -1 1 0 -2
- 13
- 12
- 11
+ 2 1 2 3
+ 0 -2 2 3
...

output:

10110000000000000
1111111111100011111101111111100
10
11100000011101
111000
11111101111
1
11111011
11111
11111

result:

ok 10 lines

Test #3:

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

input:

10
158
+ 2 -2 -4 7
- 1
+ 9 7 9 2
- 3
+ -10 -6 -7 -8
+ -8 1 10 2
- 6
+ 4 -5 -5 1
+ -9 -10 8 8
- 9
- 8
+ 10 4 -1 6
- 12
+ -3 -10 -4 -7
- 14
+ 5 -8 10 -1
- 5
+ -8 7 -3 1
- 18
- 16
+ 2 3 -1 6
- 21
+ 0 7 -4 4
+ -9 6 8 -9
- 24
+ -9 -1 0 -8
+ 9 -4 9 2
- 27
+ 9 -8 1 -3
- 26
- 23
+ -2 9 -8 1
+ -1 1 -4 0
+ 0 ...

output:

11111111011111111111111011110110000001111111010111111011111111000000000000000011001110000011111100011111111111000011111101000000000000111011101110110101111111
101111101010000100000000000000111000101000000000000000000100111000000000000000111100000111111100111001111111111111011110001110111101111111100...

result:

ok 10 lines

Test #4:

score: 0
Accepted
time: 5ms
memory: 4160kb

input:

10
284
+ 3 5 0 4
- 1
+ 8 -8 -6 1
- 3
+ -9 3 -1 -2
- 5
+ -6 -10 2 7
- 7
+ -4 5 2 -4
- 9
+ 7 -3 4 6
+ -3 8 10 -7
+ 1 1 10 8
- 11
+ 2 8 -3 -3
+ 2 7 -4 1
- 15
+ 2 -1 5 -8
- 12
- 18
- 16
- 13
+ 7 -4 8 0
- 23
+ 8 -10 -2 -6
+ -2 4 4 3
- 25
- 26
+ 6 8 9 6
+ 0 -8 -5 -4
+ 0 -7 -5 8
- 30
- 29
- 31
+ -2 -5 9 -4...

output:

11111111111000000001111111111101111110000000000000011110000000000000001111101111100001111111011111101100001111111111111111111111000000111110011111111111111111111111111011011011000000011111111111111000000000000010100100000000000000000000000000000000000000000011000000000100000000010000
111111011111001...

result:

ok 10 lines

Test #5:

score: 0
Accepted
time: 167ms
memory: 17840kb

input:

10
33754
+ -8 10 -6 0
- 1
+ 1 9 2 0
+ 4 -7 0 8
+ 0 -5 6 -5
- 3
+ 7 2 -5 -10
- 7
+ 10 -5 6 0
+ -1 -10 -6 8
- 4
- 9
- 5
+ 3 3 -6 3
+ 2 -5 -10 -10
+ -9 10 5 -4
- 14
+ -8 4 -1 -3
+ 10 -10 3 6
- 10
- 18
+ 1 -5 10 -3
+ 5 3 -5 8
+ -4 -4 1 -3
- 19
+ 2 -3 5 9
- 15
+ -1 0 -9 2
- 16
- 28
- 24
+ 10 5 -3 -1
- 26...

output:

111000000000100000000000000000000000000000001111100000000011111011101111111111111110100100000000011011111111111111111110000101111111110111000000111100000101111100000000000000000000000101000001111000000000000000000000000001111111001111101100010111110101000000000000000000000001111111000000000000000000...

result:

ok 10 lines

Test #6:

score: 0
Accepted
time: 194ms
memory: 4232kb

input:

500
141
+ -7 6 5 -6
+ -3 -8 4 2
- 2
+ 3 0 -3 -8
- 1
+ -5 1 -5 7
- 6
+ 10 5 -10 7
- 8
+ 3 0 -7 3
+ -8 3 -3 -4
- 4
- 11
+ -10 8 -8 -9
+ -5 9 7 -3
- 15
- 14
+ 0 3 7 5
+ 2 10 5 -7
+ -7 -10 -4 9
- 18
+ -10 6 0 4
+ 2 -9 -8 0
- 22
- 23
- 20
- 19
+ 2 10 -8 -9
- 28
+ 3 -6 0 6
- 30
+ 5 8 -2 -7
+ 8 6 8 -2
+ -1...

output:

101011101101100010000000001010100000000000000000000000000000000000000000000111000100011111010000000001000000000000000000000000000000000000000
10101000111111000000000110000001000000010001011111111111111000000000000000000000000000000000000000000000111011111000000001000000111110111011001110000101010000...

result:

ok 500 lines

Test #7:

score: 0
Accepted
time: 270ms
memory: 14956kb

input:

10
62781
+ 23 -26 10 96
- 1
+ 20 -28 -25 -99
- 3
+ 50 73 -92 -40
- 5
+ -70 61 60 18
+ 40 76 16 32
+ -20 87 16 39
- 9
- 7
- 8
+ -13 19 26 -30
+ -86 -28 92 26
- 14
+ -32 24 65 -80
+ 10 63 -87 -13
- 17
- 16
+ -4 72 -33 25
- 20
+ -92 -2 58 -41
- 13
- 22
+ 23 -23 64 17
- 25
+ 18 -3 -87 -78
- 27
+ 36 -46 ...

output:

111111100011101101101011111111011111111111100010001001111101011001011110101111111111111111110111101111111111011111111111100111010010110011100111111101111011111000001011111111111000011110111110010101100111111110111111111000111000000011100111111111100101100001010011100000000000110011110111110111110111...

result:

ok 10 lines

Test #8:

score: 0
Accepted
time: 391ms
memory: 21188kb

input:

10
65716
+ -146 403 968 758
- 1
+ -15 -461 803 655
+ 174 420 419 -861
- 3
- 4
+ -479 -822 -74 -47
+ 999 11 -27 -918
+ -620 -29 -32 563
- 8
- 7
+ -286 197 -168 958
+ 147 98 -618 -153
+ 26 536 35 573
- 14
- 12
+ -244 220 -525 -408
- 13
+ -168 -193 233 -245
- 19
- 17
+ 69 -943 721 229
+ 640 336 728 974...

output:

111011110110000100001100101110000001000000010000011010001010111111111110100001011111111000011111111111111111111111111111111100010110101111111010001111111110000000110000000000000000000011111011111111111001010000001100100001001000011001010000001110111011000000101111011110111111110000000111111011100011...

result:

ok 10 lines

Test #9:

score: 0
Accepted
time: 560ms
memory: 65748kb

input:

1
500000
+ -9530 -35 -2215 -1210
- 1
+ 8992 9128 9924 -6405
- 3
+ 755 4434 -3673 -5136
- 5
+ -3715 6437 -5728 -2402
- 7
+ -676 -6492 -1358 -8488
+ -6971 7347 -2545 -8404
+ -6718 5160 8831 4326
- 10
- 11
- 9
+ -7578 -2510 2954 5763
- 15
+ -4193 -8463 3536 521
- 17
+ 3168 6404 -7593 3616
+ 3504 -4159 ...

output:

111111111100111111101111111111010101111111101001001110000000111111111101010101000111110011100001100000000010001111111111010111011001111111111111111111111100111000000011010100111111110111110101100000001100000100101111111110111011110101100011111110101010001000001111110101000011111111100000001110111111...

result:

ok single line: '111111111100111111101111111111...1100111111110001000011111111101'

Test #10:

score: 0
Accepted
time: 477ms
memory: 66048kb

input:

1
500000
+ 168739398 306199905 535387405 -791039446
- 1
+ 210862427 -525583474 -79584399 -301477002
- 3
+ 876472524 578769985 15624853 -65891518
- 5
+ 513503576 -339528352 32770966 129404283
- 7
+ -361355027 -456630266 673758537 636103130
+ 925711581 -129678392 454746528 202364931
+ 711511000 -35018...

output:

111111111000101000000001000000100011111111101111101111111110111111111111101111110010100000011000000000000000000000000000000000000000000000111111111111010011101110001111111110000110100001100000011100000000000000000000000000000000000000001111111111111000000011111000000000101110101101000000000000101111...

result:

ok single line: '111111111000101000000001000000...0000000000000000000000000000000'

Test #11:

score: 0
Accepted
time: 5ms
memory: 4140kb

input:

10
497
+ -499072 30380 -499036 32636
- 1
+ 434667 317957 435228 316912
+ 288507 -414267 288167 -414463
- 3
- 4
+ -487784 -117404 -487648 -118132
+ 238880 481293 239220 481158
- 7
+ 323438 -390912 323500 -390864
- 8
+ 490592 -41161 490772 -39491
- 12
- 10
+ -429218 316580 -429143 316703
- 15
+ -36847...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111000111111111111111111111111111...

result:

ok 10 lines

Test #12:

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

input:

500
17
+ 51 19 50 22
+ 33 -50 30 -51
- 1
+ -9 56 -1 55
+ -68 2 -67 10
+ -36 51 -41 49
- 6
+ -67 -7 -68 2
+ -61 35 -60 36
- 5
- 2
- 8
- 4
+ -41 49 -43 48
- 9
+ -61 35 -62 32
- 14
14
+ -26 -48 -30 -47
+ 51 16 48 21
- 2
- 1
+ 52 14 53 11
+ 31 35 36 33
- 5
+ -31 -46 -34 -42
+ -14 33 -19 30
+ -26 -48 -30...

output:

11111111111111111
11111111111111
111111
1111111111111111111111111111111111111111
11111
111111111111111111111111111111111111111111111111
111111
111111111111111111
1111111111111111111
111111111111111
111111110
11111111111111111111111111111111111111111111
111
1111111111111111
111111111
11111111111111
1...

result:

ok 500 lines

Test #13:

score: 0
Accepted
time: 8ms
memory: 4208kb

input:

10
1809
+ -361 954 -365 953
- 1
+ 932 437 931 440
- 3
+ 992 105 993 90
+ 543 889 545 888
- 5
- 6
+ 996 -39 997 -20
- 9
+ 634 836 637 834
+ -623 -843 -634 -836
+ 967 -303 966 -308
+ 647 827 654 822
+ -900 519 -904 510
+ 941 408 937 421
+ -602 856 -597 859
+ -811 669 -814 665
+ -926 -454 -931 -440
+ 9...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111001111111111111111111111111111111111111111111111111111110000111111111111111111111111111111110000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 10 lines

Test #14:

score: 0
Accepted
time: 827ms
memory: 38524kb

input:

10
104275
+ 340883885 329556805 340888560 329551890
+ 154821600 431205216 154823163 431204840
+ -129966240 437336766 -129962636 437337424
+ 389635897 -261853051 389635196 -261854306
+ 48354963 446559680 48353937 446559744
+ -280351776 381693711 -280350726 381694372
+ -124583550 -436914225 -124581096...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 10 lines

Test #15:

score: 0
Accepted
time: 1190ms
memory: 137224kb

input:

1
500000
+ 353218670 77614140 353218713 77613808
+ -264926375 271548127 -264927422 271547111
- 1
+ 200976280 317270872 200977493 317270253
+ 121636732 -344963162 121636028 -344963325
+ -316165639 -201243485 -316166218 -201242353
+ 181490259 -325714545 181488921 -325715114
+ 284984062 250358829 28498...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #16:

score: 0
Accepted
time: 994ms
memory: 88836kb

input:

10
59250
+ -410668522 268453889 -410671306 268448663
+ -180468421 444688061 -180474857 444686305
+ -232381336 427189455 -232379907 427190038
+ -325737420 372658010 -325740525 372655470
+ -205089632 -437644718 -205090457 -437644444
+ 322953042 -373224060 322959408 -373218912
+ -433008938 -216716988 -...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 10 lines

Test #17:

score: 0
Accepted
time: 986ms
memory: 166944kb

input:

1
500000
+ -355730988 -43886437 -355731063 -43885343
+ 357259533 24912658 357259583 24911269
+ -230424259 -298824000 -230425322 -298823278
+ -333834104 -159300575 -333833755 -159301592
+ 353869003 -70221575 353869031 -70221332
+ 235490905 -295588722 235491762 -295588115
+ -352910543 -73609596 -35291...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...0000000000000000000000000000000'

Test #18:

score: 0
Accepted
time: 1120ms
memory: 145348kb

input:

1
500000
+ 185756456 -323813773 185755201 -323814327
+ -925204766 799733358 -819231385 832521761
+ 78169987 345975579 -141640028 823648561
+ -106129575 -348015354 -106131232 -348015034
+ -143496249 795610744 -881077907 -784130755
+ 64822303 432155975 -456418710 846451535
+ 342896963 -130982835 34289...

output:

111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111100000000000000000000000000...0000000000000000000000000000000'

Test #19:

score: 0
Accepted
time: 1017ms
memory: 148344kb

input:

1
500000
+ 214214158 -309725751 214214411 -309725604
+ 268317336 -268210454 268316747 -268211045
+ -230542454 -299404564 -230543357 -299403950
+ 520604084 -309507261 -346845487 195920365
+ -155548016 -335807342 -155549181 -335806956
+ 164230514 332581759 164230211 332581868
+ 354425826 61275761 3544...

output:

111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111000000000000000000000000000...0000000000000000000000000000000'

Test #20:

score: 0
Accepted
time: 1079ms
memory: 149068kb

input:

1
500000
+ 20261495 -358164903 20260025 -358164946
+ -155485703 335495346 -155487191 335494855
+ -338263041 -147717611 -338262650 -147718904
+ -134252178 54248184 682503661 -630706290
+ 153330558 336081374 153329392 336081753
+ 320443642 192622282 320443059 192623511
+ 522117202 -889387172 -27926213...

output:

111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111000000000000000000000000000...0000000000000000000000000000000'

Test #21:

score: 0
Accepted
time: 1004ms
memory: 150436kb

input:

1
500000
+ 852265055 266637350 594612402 -344771369
+ 219760659 -306077887 219761240 -306077531
+ -89718439 -351196569 -89720148 -351196308
+ -355858652 55199982 -355858780 55198521
+ -879179765 -336212023 334430532 -136327414
+ -102538462 -349055730 -102536793 -349056033
+ -279314399 256920573 -279...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100000000000000000000000000000...0000000000000000000000000000000'

Test #22:

score: 0
Accepted
time: 1106ms
memory: 148636kb

input:

1
500000
+ -314296989 206105673 -314297642 206104438
+ 83275914 353463213 83274633 353463394
+ -114630733 347820742 -114629256 347821058
+ 272616913 -263086820 272617206 -263086511
+ 924670680 -912623253 985834434 334747505
+ 333943580 -159292208 333943852 -159291417
+ 353052383 -76512278 353052138 ...

output:

111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111100000000000000000000000000...0000000000000000000000000000000'

Test #23:

score: 0
Accepted
time: 996ms
memory: 147884kb

input:

1
500000
+ -235610458 -295663838 -235611613 -295663014
+ 330477745 -170539827 330478227 -170538568
+ 44217653 -356213176 44216875 -356213229
+ 351892663 86036309 351892463 86037660
+ 331828183 -166949052 331828646 -166947799
+ -316582999 -200760175 -316583537 -200759118
+ -50591527 356052058 -505933...

output:

111111111111111000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111111111111111000000000000000...0000000000000000000000000000000'

Test #24:

score: 0
Accepted
time: 1086ms
memory: 153356kb

input:

1
500000
+ -181663206 325817209 -181664201 325816788
+ -279725411 -256447937 -279724488 -256448986
+ -148103474 -171514160 -71344996 -728730212
+ 589009711 750260164 78880432 -179424234
+ 327484419 -177157304 327485032 -177155800
+ -972827761 -164805138 283888446 373797749
+ 278957870 -256662472 278...

output:

110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '110000000000000000000000000000...0000000000000000000000000000000'

Test #25:

score: 0
Accepted
time: 1038ms
memory: 143340kb

input:

1
500000
+ 257795456 -277755602 257796559 -277754614
+ 63128940 354346073 63130234 354345940
+ -9694470 -357428655 -9696057 -357428633
+ -319400084 196006279 -319399807 196006844
+ 328891096 173574658 328890983 173574945
+ 18463456 -357247802 18464970 -357247761
+ -179472596 326435177 -179474063 326...

output:

111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111111111111111111110000000000...0000000000000000000000000000000'

Test #26:

score: 0
Accepted
time: 1053ms
memory: 136612kb

input:

1
500000
+ 294997230 235954216 294996788 235954835
- 1
+ 937491422 404366755 480713712 -580631694
+ 629337346 -540723747 -971425949 -225255262
- 3
+ 466929012 -471142486 33551541 532164829
+ -357521858 -987723 -357521861 -985835
+ 147463174 -132569793 -621953939 -552007547
+ 411479516 -639789721 659...

output:

111010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '111010000000000000000000000000...0000000000000000000000000000000'

Test #27:

score: 0
Accepted
time: 962ms
memory: 114588kb

input:

1
500000
+ -356377958 39271765 -356378061 39270041
+ 539263942 -389424380 -836803144 -757126664
+ -13190610 357457218 -13188879 357457250
- 2
+ 178296436 -327375335 178296851 -327375164
+ 147703475 986586980 95569805 455551849
+ 983089256 235219893 -413823499 320294144
- 3
- 6
+ 794538116 7518304 38...

output:

100110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100110000000000000000000000000...0000000000000000000000000000000'

Test #28:

score: 0
Accepted
time: 799ms
memory: 76768kb

input:

1
500000
+ 107119802 347882977 107118351 347883260
+ -195920239 -319132761 -195919793 -319132978
+ -226110481 302244809 -226111766 302243976
+ -138154651 340750656 -138153072 340751090
+ -142723832 -339463732 -142724290 -339463599
+ 309815139 -213097381 309814948 -213097715
+ 94258148 -350371016 942...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #29:

score: 0
Accepted
time: 795ms
memory: 72404kb

input:

1
500000
+ 302050403 -226633451 302051184 -226632258
+ 6402007 357808077 6400736 357808088
+ -191457177 321326682 -191455750 321327354
+ -301159787 226938860 -301158997 226940069
+ -70763261 353908958 -70765007 353908753
+ -347756393 106044037 -347756134 106045384
+ 227980867 301386420 227980268 301...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #30:

score: 0
Accepted
time: 287ms
memory: 41424kb

input:

1
416666
+ 0 0 -192 -85
+ -95713728 -42372394 26051136 11533926
+ 90946944 40263841 -42835392 -18962714
+ -81755904 -36193149 47616192 21080956
+ -79135872 -35033239 42151488 18661686
+ 81337536 36009676 -10279872 -4550114
+ -58053696 -25699984 24781824 10971991
+ -87846912 -38889689 11667840 516632...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #31:

score: 0
Accepted
time: 235ms
memory: 38768kb

input:

1
497501
+ 0 0 196 401
+ 44053744 90131169 -81060308 -165841968
+ -44572556 -91191006 77827484 159229484
+ 69989444 143193494 -30681056 -62770131
+ 65239580 133475660 -70928480 -145113075
+ 12217464 24996739 -47626432 -97438987
+ 37488528 76699273 -55360396 -113262046
+ 10230416 20931401 -2398844 -4...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #32:

score: 0
Accepted
time: 173ms
memory: 38640kb

input:

1
499976
+ 0 0 882 934
+ 208989900 221311483 -121372020 -128527557
+ 91886760 97304303 -57004542 -60365171
+ 59452092 62957387 -47767356 -50583389
+ 38581326 40856145 -339257772 -359259181
+ -92708784 -98174425 123893658 131198229
+ 418051242 442698437 -196902090 -208510647
+ -348943014 -369515435 5...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #33:

score: 0
Accepted
time: 160ms
memory: 5020kb

input:

100
1378
+ 0 0 -24 -650
+ -7776792 -210620597 1660080 44961353
+ 1562328 42313903 -8835960 -239306397
+ -9397488 -254514447 4484880 121466353
+ 6572904 178017003 -6054048 -163962947
+ 6869712 186055553 -6888624 -186566047
+ 4766808 129101903 -4112016 -111366247
+ -10078200 -272950397 2939208 7960440...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 100 lines

Test #34:

score: 0
Accepted
time: 1290ms
memory: 147848kb

input:

1
500000
+ 496893553 583712105 -345736745 -368417520
+ 998665214 -798703832 -224803106 -405766747
+ 657391663 34054792 863952032 629665948
+ -992776827 645459023 -374876911 -170020320
+ 60059550 -148836411 -81655816 352054105
+ 924428454 421798333 23659691 338832274
+ -370032037 -110441042 -68247457...

output:

100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok single line: '100000000000000000000000000000...0000000000000000000000000000000'

Test #35:

score: 0
Accepted
time: 329ms
memory: 28092kb

input:

10
81570
+ -997674747 -992611379 -998014866 -990427970
+ -997479026 995625898 -999665382 990594820
+ 999907228 -890948031 999919845 -883943704
+ 999499954 -953872485 999186734 -964582865
+ 999464118 984196352 999403926 984458368
+ 998889175 -974757726 999750530 -945304181
+ 999976837 -764647777 9999...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 10 lines

Test #36:

score: 0
Accepted
time: 401ms
memory: 75500kb

input:

2
56736
+ -997693711 -999016552 -998605356 -998240693
+ -328696529 -999976985 -888549529 -999953360
+ -956624695 -999908884 -966156481 -999834658
+ 458719999 -999991581 570197598 -999993586
+ -998974711 -997926352 -997689441 -999020186
+ -999947181 954514321 -999949102 953496756
+ 999224419 -9865451...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 2 lines

Test #37:

score: 0
Accepted
time: 408ms
memory: 83624kb

input:

1
500000
+ -996548688 997058928 -997257576 996350040
+ -147056622 -998315248 -414928515 -998315248
+ 998959124 -996481870 998409644 -996756610
+ -926595217 999232304 -962262787 999232304
+ 996524640 -997422476 990476608 -998178480
+ -998064463 987466964 -997867858 989826224
+ 347741422 -998315248 -3...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #38:

score: 0
Accepted
time: 335ms
memory: 37252kb

input:

10
198318
+ -998239291 -994856920 -995786425 -997938726
+ -999540653 -984783838 -999670511 -966430574
+ -996369514 -997206127 -996277279 -997322012
+ 595545907 -999830909 346572669 -999830909
+ 999810605 921516359 999813974 920648280
+ 999619493 970759551 999821726 918650848
+ -951700907 999726479 -...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 10 lines

Test #39:

score: 0
Accepted
time: 407ms
memory: 83936kb

input:

1
500000
+ 931672074 999842624 948615154 999804117
+ 999427626 -985820882 999411006 -986082647
+ 942062802 -999663358 967993428 -999491632
+ 999017964 -992162396 998873265 -993657619
+ 952106554 999796182 961656314 999774478
+ -997547261 999696277 -995915084 999756728
+ 891349154 999934267 891346074...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #40:

score: 0
Accepted
time: 430ms
memory: 83956kb

input:

1
500000
+ 999956102 990105398 999932372 994393748
+ -958116090 999953952 -978668872 999932628
+ -999945490 923903749 -999955924 895309372
+ 991696501 999875345 967494307 999932519
+ 989604140 -999708544 988933380 -999712234
+ 985479784 -999731233 989049536 -999711595
+ -415754103 999998631 -7566054...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #41:

score: 0
Accepted
time: 435ms
memory: 83608kb

input:

1
500000
+ -992542508 999423611 -991738533 999439763
+ 999385864 992538677 998366191 997056038
+ 999992295 481645111 999990894 530993529
+ -999420994 -994056822 -999545052 -993314458
+ 990340365 -999453985 993687566 -998906373
+ 988793706 -999634351 989438896 -999589356
+ -999917226 -991087366 -9999...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #42:

score: 0
Accepted
time: 428ms
memory: 83272kb

input:

1
500000
+ 999566173 982457048 999560971 982894016
+ -999261980 -993975822 -999110844 -994542582
+ -995325663 -999431805 -995812631 -998877669
+ -977624635 -999772803 -979542129 -999761321
+ -999027404 -994855482 -998904396 -995316762
+ -998162965 -996203151 -996387324 -998223708
+ -998702496 993759...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #43:

score: 0
Accepted
time: 314ms
memory: 42508kb

input:

1
500000
+ -997206163 -998057548 -997917447 -997879727
+ -993182885 998641503 -994252957 998373985
+ 785416878 -998686251 850026193 -998686251
+ -998686251 -325178762 -998686251 508998417
+ -995364087 -998518067 -995215811 -998555136
+ 997725629 -994770141 997806928 -994607543
+ -998686251 -92212227...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #44:

score: 0
Accepted
time: 308ms
memory: 43068kb

input:

1
500000
+ 999379378 776034481 999379378 966050796
+ 996549678 998047703 996593244 997960571
+ 999344167 984750613 998894220 989250083
+ 999379378 -643290837 999379378 210103051
+ 999134609 986846193 998492240 993269883
+ 998383903 994353253 998422209 993970193
+ -994788517 -996359102 -996335451 -99...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #45:

score: 0
Accepted
time: 315ms
memory: 42428kb

input:

1
500000
+ -827307886 999358015 -950084340 999358015
+ -995379805 999263350 -996382009 998929282
+ 996500154 -997403116 996708900 -997368325
+ -998091985 440758068 -998091985 800537002
+ -998091985 -980593060 -998091985 -924844058
+ 439927364 -998091985 83121739 -998091985
+ 999163838 -989047780 999...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #46:

score: 0
Accepted
time: 312ms
memory: 42536kb

input:

1
500000
+ 996431538 -996939443 996438346 -996938592
+ 999523849 837941839 999523849 -21860519
+ -305827658 -997926151 -304001774 -997926151
+ -997926151 908173879 -997926151 -766832098
+ -996306545 -994174288 -995117550 -996552278
+ -428263466 -997926151 -534826230 -997926151
+ -997926151 235586319...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #47:

score: 0
Accepted
time: 329ms
memory: 42712kb

input:

1
500000
+ 999624524 -645994691 999624524 -175396504
+ 991136501 -999220247 991150526 -999219422
+ -981352050 -999517341 -981432081 -999513530
+ 999369539 996801657 999457247 996480061
+ 998575752 -996320243 998445413 -996971938
+ -212185951 999624524 37026436 999624524
+ 997893371 999575273 9981366...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #48:

score: 0
Accepted
time: 321ms
memory: 42532kb

input:

1
500000
+ 999118403 991043214 999301388 989579334
+ 992479341 999264466 992246304 999290359
+ 994951895 998650118 994528359 998861886
+ 999155247 990748462 999105703 991144814
+ 995127919 -998757252 995151991 -998755836
+ 996802612 996778246 997594887 994876786
+ -997392483 -994803494 -998920153 -9...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #49:

score: 0
Accepted
time: 313ms
memory: 42716kb

input:

1
500000
+ -803996981 999579736 -519068003 999579736
+ -987223485 -997820176 -984324719 -998043158
+ -993314993 999280630 -997276251 998148842
+ 990395631 999173554 990490127 999138118
+ 999579736 886145197 999579736 490415851
+ -987876854 -997738734 -989344112 -997494191
+ 999260198 -995764928 9992...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #50:

score: 0
Accepted
time: 315ms
memory: 42524kb

input:

1
500000
+ -998768095 695743596 -998768095 -973680839
+ 998563393 999896117 998663366 999596198
+ -995466985 -998742319 -995489680 -998724163
+ 999668183 -982669249 999835490 -979323109
+ 999896573 566517534 999896573 620408490
+ 999761711 989919515 999683744 991089020
+ 999017134 -992498634 9990152...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #51:

score: 0
Accepted
time: 899ms
memory: 77952kb

input:

1
500000
+ -357005569 36435654 -357005646 36434307
+ -167470786 -331974702 -167469998 -331974993
+ 291261292 -241900739 291261447 -241900533
+ 321551125 189909045 321550914 189909502
+ 320484180 192195752 320483849 192196454
+ 206659295 -314087182 206659789 -314086915
+ 136446239 340926044 136445652...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #52:

score: 0
Accepted
time: 914ms
memory: 76828kb

input:

1
500000
+ 340857320 134614598 340857018 134615727
+ 356402617 -23472817 356402555 -23474664
+ -255765077 -280225973 -255766081 -280225092
+ -312648037 -209212453 -312647780 -209212919
+ 309030009 -214367535 309030754 -214366241
+ -144054711 -339753192 -144053649 -339753505
+ 355156798 -47167742 355...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #53:

score: 0
Accepted
time: 906ms
memory: 76896kb

input:

1
500000
+ 169278276 -331332385 169278857 -331332166
+ 320220439 193989523 320220883 193988592
+ -351465403 -87121430 -351465222 -87122656
+ -118575895 -346407929 -118574766 -346408180
+ -74431231 353248406 -74433114 353248173
+ -327644260 176322468 -327643713 176323821
+ -340699383 137488302 -34069...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #54:

score: 0
Accepted
time: 934ms
memory: 82384kb

input:

1
500000
+ 14423598 -357921877 14423069 -357921888
+ 178817703 326646901 178818394 326646614
+ -271498610 264830511 -271499537 264829549
+ 222929667 303926079 222929146 303926407
+ 354240490 -64753875 354240384 -64754894
+ -356979584 29521962 -356979603 29521538
+ 351525821 -86437809 351525892 -8643...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #55:

score: 0
Accepted
time: 905ms
memory: 81948kb

input:

1
500000
+ -320164258 193909792 -320163938 193910463
+ 253504852 282154434 253504441 282154783
+ 69201181 354058855 69200302 354058955
+ 95029863 -350226139 95031632 -350225844
+ 182217833 -325458873 182218798 -325458462
+ -5265994 357775118 -5267525 357775107
+ -187613596 323338018 -187614477 32333...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #56:

score: 0
Accepted
time: 932ms
memory: 77084kb

input:

1
500000
+ -342949256 128278942 -342949621 128277483
+ 337371174 -149360800 337370888 -149361725
+ -231957662 -298260878 -231956421 -298261732
+ -149212563 -337597888 -149211665 -337598167
+ -137279867 -341087335 -137278335 -341087756
+ -258256975 -277539888 -258257806 -277539140
+ -338177515 145659...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #57:

score: 0
Accepted
time: 905ms
memory: 80836kb

input:

1
500000
+ -310000716 213485959 -310000171 213486916
+ 356236161 40294122 356236068 40295648
+ -158821271 335062735 -158819788 335063242
+ -263713629 -272090369 -263713409 -272090580
+ 100049550 350082620 100047733 350082945
+ -333778429 160248669 -333778804 160247572
+ 308520526 216135089 308520921...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #58:

score: 0
Accepted
time: 935ms
memory: 82172kb

input:

1
500000
+ 188148309 322893912 188149726 322893268
+ 338492816 146040175 338492529 146041133
+ 262346919 273826308 262346009 273827161
+ 325919803 -181088557 325920389 -181087166
+ -308428972 215732645 -308429337 215732023
+ -347176437 110531375 -347176184 110532623
+ -350010017 -94927473 -350009805...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #59:

score: 0
Accepted
time: 1191ms
memory: 162192kb

input:

1
500000
+ -357537463 85992 -357537464 88134
+ -357537463 85992 -357537462 83851
+ -357537462 83851 -357537461 81713
+ -357537460 79579 -357537461 81713
+ -357537459 77447 -357537460 79579
+ -357537459 77447 -357537458 75316
+ -357537458 75316 -357537457 73188
+ -357537456 71063 -357537457 73188
+ -...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #60:

score: 0
Accepted
time: 1183ms
memory: 170144kb

input:

1
500000
+ -357767090 290383 -357767089 288242
+ -357767088 286106 -357767089 288242
+ -357767087 283973 -357767088 286106
+ -357767086 281844 -357767087 283973
+ -357767086 281844 -357767085 279716
+ -357767085 279716 -357767084 277592
+ -357767084 277592 -357767083 275469
+ -357767083 275469 -3577...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #61:

score: 0
Accepted
time: 1181ms
memory: 161940kb

input:

1
500000
+ -358383817 -130468 -358383816 -132612
+ -358383816 -132612 -358383815 -134755
+ -358383814 -136894 -358383815 -134755
+ -358383813 -139032 -358383814 -136894
+ -358383812 -141169 -358383813 -139032
+ -358383811 -143305 -358383812 -141169
+ -358383811 -143305 -358383810 -145440
+ -35838381...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #62:

score: 0
Accepted
time: 1188ms
memory: 169660kb

input:

1
500000
+ -357004018 602876 -357004017 600732
+ -357004016 598589 -357004017 600732
+ -357004016 598589 -357004015 596451
+ -357004015 596451 -357004014 594315
+ -357004013 592182 -357004014 594315
+ -357004012 590050 -357004013 592182
+ -357004011 587920 -357004012 590050
+ -357004011 587920 -3570...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #63:

score: 0
Accepted
time: 1170ms
memory: 169820kb

input:

1
500000
+ -357493866 -27183 -357493867 -25039
+ -357493865 -29326 -357493866 -27183
+ -357493865 -29326 -357493864 -31468
+ -357493864 -31468 -357493863 -33609
+ -357493862 -35748 -357493863 -33609
+ -357493861 -37884 -357493862 -35748
+ -357493861 -37884 -357493860 -40019
+ -357493859 -42153 -3574...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #64:

score: 0
Accepted
time: 1165ms
memory: 161904kb

input:

1
500000
+ -357724824 -484607 -357724825 -482464
+ -357724824 -484607 -357724823 -486749
+ -357724823 -486749 -357724822 -488890
+ -357724821 -491028 -357724822 -488890
+ -357724821 -491028 -357724820 -493164
+ -357724819 -495296 -357724820 -493164
+ -357724819 -495296 -357724818 -497425
+ -35772481...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #65:

score: 0
Accepted
time: 1157ms
memory: 161724kb

input:

1
500000
+ -357716529 365649 -357716530 367793
+ -357716529 365649 -357716528 363507
+ -357716527 361369 -357716528 363507
+ -357716526 359236 -357716527 361369
+ -357716525 357108 -357716526 359236
+ -357716525 357108 -357716524 354984
+ -357716523 352867 -357716524 354984
+ -357716522 350758 -3577...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #66:

score: 0
Accepted
time: 1171ms
memory: 169684kb

input:

1
500000
+ -357403985 -238769 -357403986 -236627
+ -357403985 -238769 -357403984 -240909
+ -357403983 -243044 -357403984 -240909
+ -357403982 -245176 -357403983 -243044
+ -357403982 -245176 -357403981 -247307
+ -357403981 -247307 -357403980 -249432
+ -357403979 -251552 -357403980 -249432
+ -35740397...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #67:

score: 0
Accepted
time: 1177ms
memory: 126752kb

input:

1
500000
+ -129727711 343646832 -129728932 343646522
+ -283063817 252396454 -283063734 252396553
+ 91537241 -350443000 91535733 -350443239
+ 94382065 -349983201 94383522 -349982961
+ -28136601 357699649 -28138224 357699581
+ 218564857 -306598509 218565426 -306598167
+ 354380413 66666611 354380599 66...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #68:

score: 0
Accepted
time: 1358ms
memory: 155516kb

input:

1
500000
+ -5429075 357569043 -5427064 357569058
+ -2208485 357585796 -2209519 357585793
+ -334126180 -160248909 -334125705 -160250280
+ 338597226 143715006 338596954 143715935
+ 13986564 357445960 13984561 357446001
+ -352189702 -83876538 -352189535 -83877703
+ -133809855 -342065484 -133808981 -342...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #69:

score: 0
Accepted
time: 1230ms
memory: 149492kb

input:

1
500000
+ 228046282 300774832 228045483 300775364
+ 348363296 104031236 348362960 104033025
+ -99807667 -348978832 -99805964 -348979134
+ -350970542 93011544 -350970317 93012932
+ 341632998 133915156 341632597 133916669
- 2
+ 353932246 -65936737 353932070 -65938368
+ 295962378 234595494 295962912 2...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #70:

score: 0
Accepted
time: 1179ms
memory: 135436kb

input:

1
500000
+ 158686449 334628439 158685072 334628909
+ -321348537 191483736 -321347874 191485159
- 2
+ 351940453 -82979996 351940550 -82979314
+ -302388122 225897110 -302388949 225895831
+ -345211901 -120191853 -345212235 -120190394
+ 356469950 -36286345 356469852 -36288120
+ -257180222 278730586 -257...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #71:

score: 0
Accepted
time: 1061ms
memory: 107444kb

input:

1
500000
+ -286618754 247603072 -286619431 247602233
+ -114725410 -346604194 -114726128 -346604041
+ -138233322 340236525 -138234691 340236147
+ 187358880 322822165 187358131 322822500
+ -118858812 345057132 -118857380 345057451
- 2
+ 292959256 239296010 292958917 239296467
+ -345965045 -117699381 -...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #72:

score: 0
Accepted
time: 1250ms
memory: 161920kb

input:

1
500000
+ 991876160 -168305373 991876081 -168306192
+ 960401339 -356968926 960401437 -356968529
+ 995206057 -128501552 995206110 -128500807
+ 945824594 -410214913 945824789 -410214267
+ 888115208 -556511383 888114616 -556512564
+ 519927740 -905610286 519926685 -905610754
+ 965120110 -337089443 9651...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #73:

score: 0
Accepted
time: 1209ms
memory: 155580kb

input:

1
500000
+ 523530261 -904002386 523529152 -904002884
+ 469355241 -926215729 469354032 -926216180
+ 521689763 -904826302 521690740 -904825866
+ 209998663 -987631353 209997121 -987631546
+ 461603407 -929068832 461604616 -929068393
+ 963142586 -345613250 963142367 -345614178
+ 893604026 -545354258 8936...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #74:

score: 0
Accepted
time: 1245ms
memory: 163492kb

input:

1
500000
+ 183701129 -990680317 183702991 -990680118
+ 712198724 -784962848 712199791 -784961925
+ 796874875 -697965958 796875840 -697964780
+ 487422602 -919260812 487421315 -919261323
+ 144393601 -994369563 144394895 -994369458
+ 405033704 -947682610 405032514 -947682963
+ 592297786 -869236687 5922...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Test #75:

score: 0
Accepted
time: 1229ms
memory: 161968kb

input:

1
500000
+ 588911960 -871144220 588911187 -871144653
+ 969645976 -316385265 969645648 -316386832
+ 656220065 -828744279 656220882 -828743702
+ 91795467 -997788712 91794454 -997788762
+ 70590945 -998706612 70590382 -998706633
+ 710947953 -786042276 710948658 -786041669
+ 924857924 -472246451 92485765...

output:

111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok single line: '111111111111111111111111111111...1111111111111111111111111111111'

Extra Test:

score: 0
Extra Test Passed