QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#822568#9770. Middle Pointucup-team087#AC ✓0ms3948kbC++2315.4kb2024-12-20 14:16:262024-12-20 14:16:27

Judging History

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

  • [2024-12-20 14:16:27]
  • 评测
  • 测评结果:AC
  • 用时:0ms
  • 内存:3948kb
  • [2024-12-20 14:16:26]
  • 提交

answer

#line 1 "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(unsigned(x)) & 1 ? -1 : 1); }
int popcnt_sgn(u32 x) { return (__builtin_parity(x) & 1 ? -1 : 1); }
int popcnt_sgn(ll x) { return (__builtin_parityll(x) & 1 ? -1 : 1); }
int popcnt_sgn(u64 x) { return (__builtin_parityll(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 "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); }
void YA(bool t = 1) { print(t ? "YA" : "TIDAK"); }
void TIDAK(bool t = 1) { YES(!t); }
#line 3 "main.cpp"

vc<tuple<ll, ll, ll, ll>> solve(ll A, ll B, ll X, ll Y) {
  {
    ll g = gcd(A, X);
    if (g > 1) {
      auto ANS = solve(A / g, B, X / g, Y);
      for (auto& [a, b, c, d]: ANS) a *= g, c *= g;
      return ANS;
    }
  }
  {
    ll g = gcd(B, Y);
    if (g > 1) {
      auto ANS = solve(A, B / g, X, Y / g);
      for (auto& [a, b, c, d]: ANS) b *= g, d *= g;
      return ANS;
    }
  }

  if (A >= 1 && A & (A - 1)) return {};
  if (B >= 1 && B & (B - 1)) return {};

  if (A > B) {
    auto ANS = solve(B, A, Y, X);
    for (auto& [a, b, c, d]: ANS) swap(a, b), swap(c, d);
    return ANS;
  }

  if (A == 0) {
    assert(X == 0);
    vc<tuple<ll, ll, ll, ll>> ANS;
    ll L = 0, R = B;
    while (L < Y && Y < R) {
      ANS.eb(0, L, 0, R);
      ll M = (L + R) / 2;
      if (L <= Y && Y <= M) {
        R = M;
      } else {
        L = M;
      }
    }
    return ANS;
  }

  vc<tuple<ll, ll, ll, ll>> ANS;
  while (1) {
    if ((X == 0 || X == A) && (Y == 0 || Y == B)) break;
    if (2 * X <= A && 2 * Y <= B) {
      ANS.eb(0, 0, 2 * X, 2 * Y);
      X = 2 * X;
      Y = 2 * Y;
    }
    elif (2 * X <= A && 2 * Y > B) {
      ANS.eb(0, B, 2 * X, 2 * Y - B);
      X = 2 * X;
      Y = 2 * Y - B;
    }
    elif (2 * X > A && 2 * Y <= B) {
      ANS.eb(A, 0, 2 * X - A, 2 * Y);
      X = 2 * X - A;
      Y = 2 * Y;
    }
    elif (2 * X > A && 2 * Y > B) {
      ANS.eb(A, B, 2 * X - A, 2 * Y - B);
      X = 2 * X - A;
      Y = 2 * Y - B;
    }
    else {
      assert(0);
    }
  }
  reverse(all(ANS));
  return ANS;
}

void solve() {
  LL(A, B, X, Y);
  if ((X == 0 || X == A) && (Y == 0 || Y == B)) return print(0);
  auto ANS = solve(A, B, X, Y);
  if (ANS.empty()) return print(-1);
  print(len(ANS));
  for (auto& [a, b, c, d]: ANS) print(a, b, c, d);
}

signed main() { solve(); }

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 2
1 1

output:

1
0 0 2 2

result:

ok correct!

Test #2:

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

input:

8 8
5 0

output:

3
0 0 8 0
0 0 4 0
8 0 2 0

result:

ok correct!

Test #3:

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

input:

0 0
0 0

output:

0

result:

ok correct!

Test #4:

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

input:

2024 0
1012 0

output:

1
0 0 2024 0

result:

ok correct!

Test #5:

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

input:

2024 2024
2023 2023

output:

-1

result:

ok correct!

Test #6:

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

input:

8 6
7 3

output:

3
0 6 8 6
8 6 4 6
8 0 6 6

result:

ok correct!

Test #7:

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

input:

2024 2026
2024 2026

output:

0

result:

ok correct!

Test #8:

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

input:

1000000000 1000000000
70 0

output:

-1

result:

ok correct!

Test #9:

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

input:

3 6
2 4

output:

-1

result:

ok correct!

Test #10:

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

input:

7 7
7 2

output:

-1

result:

ok correct!

Test #11:

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

input:

6 2
5 2

output:

-1

result:

ok correct!

Test #12:

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

input:

5 7
5 5

output:

-1

result:

ok correct!

Test #13:

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

input:

4 7
2 3

output:

-1

result:

ok correct!

Test #14:

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

input:

8 2
2 2

output:

2
0 2 8 2
0 2 4 2

result:

ok correct!

Test #15:

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

input:

3 3
0 2

output:

-1

result:

ok correct!

Test #16:

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

input:

7 7
1 4

output:

-1

result:

ok correct!

Test #17:

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

input:

6 3
6 1

output:

-1

result:

ok correct!

Test #18:

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

input:

4 2
2 1

output:

1
0 0 4 2

result:

ok correct!

Test #19:

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

input:

7 2
3 2

output:

-1

result:

ok correct!

Test #20:

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

input:

2 7
0 3

output:

-1

result:

ok correct!

Test #21:

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

input:

1 7
1 0

output:

0

result:

ok correct!

Test #22:

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

input:

5 1
0 0

output:

0

result:

ok correct!

Test #23:

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

input:

8 7
4 3

output:

-1

result:

ok correct!

Test #24:

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

input:

180057652 674822131
110693180 428023738

output:

-1

result:

ok correct!

Test #25:

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

input:

62347541 812142018
42922107 486416913

output:

-1

result:

ok correct!

Test #26:

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

input:

239604722 244429197
78993837 108804105

output:

-1

result:

ok correct!

Test #27:

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

input:

416861903 381749084
375027630 373683256

output:

-1

result:

ok correct!

Test #28:

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

input:

594119084 519068971
429116021 298715088

output:

-1

result:

ok correct!

Test #29:

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

input:

536870912 536870912
233225286 372408647

output:

29
536870912 0 536870912 536870912
0 536870912 536870912 268435456
536870912 536870912 268435456 402653184
0 0 402653184 469762048
0 0 201326592 234881024
0 0 100663296 117440512
536870912 536870912 50331648 58720256
0 0 293601280 297795584
0 536870912 146800640 148897792
0 0 73400320 342884352
5368...

result:

ok correct!

Test #30:

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

input:

536870912 536870912
242171716 210314503

output:

29
536870912 0 536870912 536870912
536870912 536870912 536870912 268435456
0 536870912 536870912 402653184
0 0 268435456 469762048
0 0 134217728 234881024
0 0 67108864 117440512
536870912 0 33554432 58720256
0 0 285212672 29360128
536870912 536870912 142606336 14680064
536870912 0 339738624 27577548...

result:

ok correct!

Test #31:

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

input:

536870912 536870912
251118145 48220392

output:

29
0 536870912 536870912 536870912
0 536870912 268435456 536870912
0 536870912 134217728 536870912
0 0 67108864 536870912
0 0 33554432 268435456
0 536870912 16777216 134217728
536870912 536870912 8388608 335544320
0 536870912 272629760 436207616
0 0 136314880 486539264
536870912 0 68157440 243269632...

result:

ok correct!

Test #32:

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

input:

126070784 536870912
70206899 483718753

output:

29
126070784 0 126070784 536870912
126070784 0 126070784 268435456
126070784 0 126070784 134217728
126070784 0 126070784 67108864
126070784 0 126070784 33554432
126070784 536870912 126070784 16777216
126070784 536870912 126070784 276824064
126070784 0 126070784 406847488
126070784 0 126070784 203423...

result:

ok correct!

Test #33:

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

input:

134541312 536870912
92168682 321624642

output:

28
134541312 0 134541312 536870912
134541312 0 134541312 268435456
134541312 0 134541312 134217728
134541312 0 134541312 67108864
134541312 0 134541312 33554432
134541312 536870912 134541312 16777216
134541312 0 134541312 276824064
134541312 0 134541312 138412032
134541312 536870912 134541312 692060...

result:

ok correct!

Test #34:

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

input:

605171712 536870912
492293004 159530531

output:

29
605171712 0 605171712 536870912
605171712 536870912 605171712 268435456
605171712 0 605171712 402653184
605171712 0 605171712 201326592
605171712 0 605171712 100663296
605171712 536870912 605171712 50331648
605171712 0 605171712 293601280
605171712 0 605171712 146800640
605171712 0 605171712 7340...

result:

ok correct!

Test #35:

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

input:

816447488 872415232
107288296 282864296

output:

23
816447488 0 816447488 872415232
816447488 0 816447488 436207616
816447488 0 816447488 218103808
816447488 872415232 816447488 109051904
816447488 0 816447488 490733568
816447488 872415232 816447488 245366784
816447488 872415232 816447488 558891008
816447488 0 816447488 715653120
816447488 0 81644...

result:

ok correct!

Test #36:

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

input:

465043456 805306368
155625924 290419248

output:

24
465043456 0 465043456 805306368
465043456 0 465043456 402653184
465043456 0 465043456 201326592
465043456 0 465043456 100663296
465043456 0 465043456 50331648
465043456 805306368 465043456 25165824
465043456 805306368 465043456 415236096
0 0 465043456 610271232
465043456 0 232521728 305135616
465...

result:

ok correct!

Test #37:

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

input:

246022144 587202560
78513033 233147565

output:

24
246022144 0 246022144 587202560
246022144 587202560 246022144 293601280
246022144 587202560 246022144 440401920
246022144 587202560 246022144 513802240
246022144 0 246022144 550502400
246022144 587202560 246022144 275251200
246022144 587202560 246022144 431226880
0 587202560 246022144 509214720
0...

result:

ok correct!

Test #38:

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

input:

536870912 699163134
414335415 699163134

output:

29
0 699163134 536870912 699163134
536870912 699163134 268435456 699163134
536870912 699163134 402653184 699163134
0 699163134 469762048 699163134
536870912 699163134 234881024 699163134
536870912 699163134 385875968 699163134
0 699163134 461373440 699163134
536870912 699163134 230686720 699163134
5...

result:

ok correct!

Test #39:

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

input:

536870912 292943687
423281845 292943687

output:

29
0 292943687 536870912 292943687
0 292943687 268435456 292943687
536870912 292943687 134217728 292943687
0 292943687 335544320 292943687
536870912 292943687 167772160 292943687
536870912 292943687 352321536 292943687
0 292943687 444596224 292943687
536870912 292943687 222298112 292943687
0 2929436...

result:

ok correct!

Test #40:

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

input:

536870912 31948433
432228266 0

output:

28
0 0 536870912 0
0 0 268435456 0
536870912 0 134217728 0
0 0 335544320 0
536870912 0 167772160 0
0 0 352321536 0
536870912 0 176160768 0
536870912 0 356515840 0
536870912 0 446693376 0
536870912 0 491782144 0
0 0 514326528 0
0 0 257163264 0
0 0 128581632 0
536870912 0 64290816 0
0 0 300580864 0
53...

result:

ok correct!

Test #41:

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

input:

603979776 243951872
111389958 152469920

output:

25
0 243951872 603979776 243951872
603979776 243951872 301989888 243951872
0 243951872 452984832 243951872
603979776 243951872 226492416 243951872
0 243951872 415236096 243951872
603979776 243951872 207618048 243951872
0 243951872 405798912 243951872
0 243951872 202899456 243951872
603979776 2439518...

result:

ok correct!

Test #42:

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

input:

603979776 892103744
85336938 585443082

output:

25
0 892103744 603979776 892103744
0 892103744 301989888 892103744
603979776 892103744 150994944 892103744
603979776 892103744 377487360 892103744
0 892103744 490733568 892103744
0 892103744 245366784 892103744
603979776 892103744 122683392 892103744
0 892103744 363331584 892103744
603979776 8921037...

result:

ok correct!

Test #43:

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

input:

67108864 893081440
6587231 502358310

output:

26
0 893081440 67108864 893081440
67108864 893081440 33554432 893081440
67108864 893081440 50331648 893081440
67108864 893081440 58720256 893081440
67108864 893081440 62914560 893081440
0 893081440 65011712 893081440
67108864 893081440 32505856 893081440
0 893081440 49807360 893081440
67108864 89308...

result:

ok correct!

Test #44:

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

input:

536870912 536870912
233225286 536870912

output:

28
0 536870912 536870912 536870912
536870912 536870912 268435456 536870912
0 536870912 402653184 536870912
0 536870912 201326592 536870912
0 536870912 100663296 536870912
536870912 536870912 50331648 536870912
0 536870912 293601280 536870912
0 536870912 146800640 536870912
0 536870912 73400320 53687...

result:

ok correct!

Test #45:

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

input:

536870912 536870912
242171716 536870912

output:

27
0 536870912 536870912 536870912
0 536870912 268435456 536870912
0 536870912 134217728 536870912
0 536870912 67108864 536870912
536870912 536870912 33554432 536870912
0 536870912 285212672 536870912
536870912 536870912 142606336 536870912
536870912 536870912 339738624 536870912
536870912 536870912...

result:

ok correct!

Test #46:

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

input:

536870912 536870912
536870912 48220392

output:

26
536870912 0 536870912 536870912
536870912 0 536870912 268435456
536870912 536870912 536870912 134217728
536870912 536870912 536870912 335544320
536870912 536870912 536870912 436207616
536870912 0 536870912 486539264
536870912 0 536870912 243269632
536870912 0 536870912 121634816
536870912 5368709...

result:

ok correct!

Test #47:

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

input:

126070784 536870912
70206899 0

output:

12
0 0 126070784 0
0 0 63035392 0
0 0 31517696 0
126070784 0 15758848 0
0 0 70914816 0
126070784 0 35457408 0
126070784 0 80764096 0
126070784 0 103417440 0
0 0 114744112 0
0 0 57372056 0
0 0 28686028 0
126070784 0 14343014 0

result:

ok correct!

Test #48:

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

input:

536870912 536870912
33554432 1835008

output:

11
536870912 0 536870912 536870912
536870912 536870912 536870912 268435456
536870912 536870912 536870912 402653184
536870912 0 536870912 469762048
536870912 0 536870912 234881024
536870912 0 536870912 117440512
536870912 0 536870912 58720256
0 0 536870912 29360128
0 0 268435456 14680064
0 0 13421772...

result:

ok correct!

Test #49:

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

input:

134541312 536870912
0 321624642

output:

28
0 0 0 536870912
0 0 0 268435456
0 0 0 134217728
0 0 0 67108864
0 0 0 33554432
0 536870912 0 16777216
0 0 0 276824064
0 0 0 138412032
0 536870912 0 69206016
0 0 0 303038464
0 536870912 0 151519232
0 536870912 0 344195072
0 0 0 440532992
0 0 0 220266496
0 536870912 0 110133248
0 536870912 0 3235020...

result:

ok correct!

Test #50:

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

input:

605171712 536870912
605171712 159530531

output:

29
605171712 0 605171712 536870912
605171712 536870912 605171712 268435456
605171712 0 605171712 402653184
605171712 0 605171712 201326592
605171712 0 605171712 100663296
605171712 536870912 605171712 50331648
605171712 0 605171712 293601280
605171712 0 605171712 146800640
605171712 0 605171712 7340...

result:

ok correct!

Test #51:

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

input:

816447488 872415232
107288296 872415232

output:

14
0 872415232 816447488 872415232
0 872415232 408223744 872415232
0 872415232 204111872 872415232
816447488 872415232 102055936 872415232
0 872415232 459251712 872415232
816447488 872415232 229625856 872415232
816447488 872415232 523036672 872415232
0 872415232 669742080 872415232
0 872415232 33487...

result:

ok correct!

Test #52:

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

input:

465043456 805306368
155625924 805306368

output:

17
0 805306368 465043456 805306368
465043456 805306368 232521728 805306368
465043456 805306368 348782592 805306368
0 805306368 406913024 805306368
465043456 805306368 203456512 805306368
0 805306368 334249984 805306368
465043456 805306368 167124992 805306368
0 805306368 316084224 805306368
465043456...

result:

ok correct!

Test #53:

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

input:

246022144 587202560
0 233147565

output:

24
0 0 0 587202560
0 587202560 0 293601280
0 587202560 0 440401920
0 587202560 0 513802240
0 0 0 550502400
0 587202560 0 275251200
0 587202560 0 431226880
0 587202560 0 509214720
0 0 0 548208640
0 0 0 274104320
0 587202560 0 137052160
0 0 0 362127360
0 0 0 181063680
0 587202560 0 90531840
0 0 0 3388...

result:

ok correct!

Test #54:

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

input:

536870912 699163134
0 699163134

output:

0

result:

ok correct!

Test #55:

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

input:

536870912 292943687
423281845 0

output:

29
0 0 536870912 0
0 0 268435456 0
536870912 0 134217728 0
0 0 335544320 0
536870912 0 167772160 0
536870912 0 352321536 0
0 0 444596224 0
536870912 0 222298112 0
0 0 379584512 0
0 0 189792256 0
536870912 0 94896128 0
0 0 315883520 0
0 0 157941760 0
0 0 78970880 0
536870912 0 39485440 0
536870912 0 ...

result:

ok correct!

Test #56:

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

input:

536870912 31948433
0 0

output:

0

result:

ok correct!

Test #57:

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

input:

603979776 243951872
603979776 152469920

output:

3
603979776 0 603979776 243951872
603979776 0 603979776 121975936
603979776 243951872 603979776 60987968

result:

ok correct!

Test #58:

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

input:

603979776 892103744
603979776 585443082

output:

5
603979776 0 603979776 892103744
603979776 0 603979776 446051872
603979776 892103744 603979776 223025936
603979776 0 603979776 557564840
603979776 892103744 603979776 278782420

result:

ok correct!

Test #59:

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

input:

67108864 893081440
6587231 893081440

output:

26
0 893081440 67108864 893081440
67108864 893081440 33554432 893081440
67108864 893081440 50331648 893081440
67108864 893081440 58720256 893081440
67108864 893081440 62914560 893081440
0 893081440 65011712 893081440
67108864 893081440 32505856 893081440
0 893081440 49807360 893081440
67108864 89308...

result:

ok correct!

Test #60:

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

input:

276307968 0
139739247 0

output:

13
0 0 276307968 0
138153984 0 276307968 0
138153984 0 207230976 0
138153984 0 172692480 0
138153984 0 155423232 0
138153984 0 146788608 0
138153984 0 142471296 0
138153984 0 140312640 0
139233312 0 140312640 0
139233312 0 139772976 0
139503144 0 139772976 0
139638060 0 139772976 0
139705518 0 13977...

result:

ok correct!

Test #61:

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

input:

0 365756416
0 136488936

output:

13
0 0 0 365756416
0 0 0 182878208
0 91439104 0 182878208
0 91439104 0 137158656
0 114298880 0 137158656
0 125728768 0 137158656
0 131443712 0 137158656
0 134301184 0 137158656
0 135729920 0 137158656
0 136444288 0 137158656
0 136444288 0 136801472
0 136444288 0 136622880
0 136444288 0 136533584

result:

ok correct!

Test #62:

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

input:

0 214958080
0 164104960

output:

12
0 0 0 214958080
0 107479040 0 214958080
0 161218560 0 214958080
0 161218560 0 188088320
0 161218560 0 174653440
0 161218560 0 167936000
0 161218560 0 164577280
0 162897920 0 164577280
0 163737600 0 164577280
0 163737600 0 164157440
0 163947520 0 164157440
0 164052480 0 164157440

result:

ok correct!

Test #63:

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

input:

713613312 0
122478066 0

output:

12
0 0 713613312 0
0 0 356806656 0
0 0 178403328 0
89201664 0 178403328 0
89201664 0 133802496 0
111502080 0 133802496 0
111502080 0 122652288 0
117077184 0 122652288 0
119864736 0 122652288 0
121258512 0 122652288 0
121955400 0 122652288 0
122303844 0 122652288 0

result:

ok correct!

Test #64:

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

input:

0 122953728
0 4427655

output:

13
0 0 0 122953728
0 0 0 61476864
0 0 0 30738432
0 0 0 15369216
0 0 0 7684608
0 3842304 0 7684608
0 3842304 0 5763456
0 3842304 0 4802880
0 4322592 0 4802880
0 4322592 0 4562736
0 4322592 0 4442664
0 4382628 0 4442664
0 4412646 0 4442664

result:

ok correct!

Test #65:

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

input:

0 268435456
0 36705241

output:

28
0 0 0 268435456
0 0 0 134217728
0 0 0 67108864
0 33554432 0 67108864
0 33554432 0 50331648
0 33554432 0 41943040
0 33554432 0 37748736
0 35651584 0 37748736
0 36700160 0 37748736
0 36700160 0 37224448
0 36700160 0 36962304
0 36700160 0 36831232
0 36700160 0 36765696
0 36700160 0 36732928
0 367001...

result:

ok correct!

Test #66:

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

input:

0 805306368
0 482227593

output:

28
0 0 0 805306368
0 402653184 0 805306368
0 402653184 0 603979776
0 402653184 0 503316480
0 452984832 0 503316480
0 478150656 0 503316480
0 478150656 0 490733568
0 478150656 0 484442112
0 481296384 0 484442112
0 481296384 0 482869248
0 482082816 0 482869248
0 482082816 0 482476032
0 482082816 0 482...

result:

ok correct!

Test #67:

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

input:

805306368 0
635586921 0

output:

28
0 0 805306368 0
402653184 0 805306368 0
603979776 0 805306368 0
603979776 0 704643072 0
603979776 0 654311424 0
629145600 0 654311424 0
629145600 0 641728512 0
635437056 0 641728512 0
635437056 0 638582784 0
635437056 0 637009920 0
635437056 0 636223488 0
635437056 0 635830272 0
635437056 0 63563...

result:

ok correct!

Test #68:

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

input:

0 805306368
0 421144629

output:

28
0 0 0 805306368
0 402653184 0 805306368
0 402653184 0 603979776
0 402653184 0 503316480
0 402653184 0 452984832
0 402653184 0 427819008
0 415236096 0 427819008
0 415236096 0 421527552
0 418381824 0 421527552
0 419954688 0 421527552
0 420741120 0 421527552
0 421134336 0 421527552
0 421134336 0 421...

result:

ok correct!

Test #69:

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

input:

268435456 0
149676330 0

output:

27
0 0 268435456 0
134217728 0 268435456 0
134217728 0 201326592 0
134217728 0 167772160 0
134217728 0 150994944 0
142606336 0 150994944 0
146800640 0 150994944 0
148897792 0 150994944 0
148897792 0 149946368 0
149422080 0 149946368 0
149422080 0 149684224 0
149553152 0 149684224 0
149618688 0 14968...

result:

ok correct!

Extra Test:

score: 0
Extra Test Passed