QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#165790#7178. Bishopsucup-team987#AC ✓21ms7160kbC++1711.4kb2023-09-05 21:45:292023-09-05 21:45:29

Judging History

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

  • [2023-09-05 21:45:29]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:7160kb
  • [2023-09-05 21:45:29]
  • 提交

answer

/**
 * date   : 2023-09-05 22:45:20
 * author : Nyaan
 */

#define NDEBUG

// old version of ARC139C

/**
 *  date : 2022-04-17 17:40:33
 */

#define NDEBUG
using namespace std;

// intrinstic
#include <immintrin.h>


#include <algorithm>

#include <array>

#include <bitset>

#include <cassert>

#include <cctype>

#include <cfenv>

#include <cfloat>

#include <chrono>

#include <cinttypes>

#include <climits>

#include <cmath>

#include <complex>

#include <cstdarg>

#include <cstddef>

#include <cstdint>

#include <cstdio>

#include <cstdlib>

#include <cstring>

#include <deque>

#include <fstream>

#include <functional>

#include <initializer_list>

#include <iomanip>

#include <ios>

#include <iostream>

#include <istream>

#include <iterator>

#include <limits>

#include <list>

#include <map>

#include <memory>

#include <new>

#include <numeric>

#include <ostream>

#include <queue>

#include <random>

#include <set>

#include <sstream>

#include <stack>

#include <streambuf>

#include <string>

#include <tuple>

#include <type_traits>

#include <typeinfo>

#include <unordered_map>

#include <unordered_set>

#include <utility>

#include <vector>


// utility
namespace Nyaan {
using ll = long long;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
using u128 = __uint128_t;

template <typename T>
using V = vector<T>;
template <typename T>
using VV = vector<vector<T>>;
using vi = vector<int>;
using vl = vector<long long>;
using vd = V<double>;
using vs = V<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<long long>>;

template <typename T, typename U>
struct P : pair<T, U> {
  template <typename... Args>
  P(Args... args) : pair<T, U>(args...) {}

  using pair<T, U>::first;
  using pair<T, U>::second;

  P &operator+=(const P &r) {
    first += r.first;
    second += r.second;
    return *this;
  }
  P &operator-=(const P &r) {
    first -= r.first;
    second -= r.second;
    return *this;
  }
  P &operator*=(const P &r) {
    first *= r.first;
    second *= r.second;
    return *this;
  }
  template <typename S>
  P &operator*=(const S &r) {
    first *= r, second *= r;
    return *this;
  }
  P operator+(const P &r) const { return P(*this) += r; }
  P operator-(const P &r) const { return P(*this) -= r; }
  P operator*(const P &r) const { return P(*this) *= r; }
  template <typename S>
  P operator*(const S &r) const {
    return P(*this) *= r;
  }
  P operator-() const { return P{-first, -second}; }
};

using pl = P<ll, ll>;
using pi = P<int, int>;
using vp = V<pl>;

constexpr int inf = 1001001001;
constexpr long long infLL = 4004004004004004004LL;

template <typename T>
int sz(const T &t) {
  return t.size();
}

template <typename T, typename U>
inline bool amin(T &x, U y) {
  return (y < x) ? (x = y, true) : false;
}
template <typename T, typename U>
inline bool amax(T &x, U y) {
  return (x < y) ? (x = y, true) : false;
}

template <typename T>
inline T Max(const vector<T> &v) {
  return *max_element(begin(v), end(v));
}
template <typename T>
inline T Min(const vector<T> &v) {
  return *min_element(begin(v), end(v));
}
template <typename T>
inline long long Sum(const vector<T> &v) {
  return accumulate(begin(v), end(v), 0LL);
}

template <typename T>
int lb(const vector<T> &v, const T &a) {
  return lower_bound(begin(v), end(v), a) - begin(v);
}
template <typename T>
int ub(const vector<T> &v, const T &a) {
  return upper_bound(begin(v), end(v), a) - begin(v);
}

constexpr long long TEN(int n) {
  long long ret = 1, x = 10;
  for (; n; x *= x, n >>= 1) ret *= (n & 1 ? x : 1);
  return ret;
}

template <typename T, typename U>
pair<T, U> mkp(const T &t, const U &u) {
  return make_pair(t, u);
}

template <typename T>
vector<T> mkrui(const vector<T> &v, bool rev = false) {
  vector<T> ret(v.size() + 1);
  if (rev) {
    for (int i = int(v.size()) - 1; i >= 0; i--) ret[i] = v[i] + ret[i + 1];
  } else {
    for (int i = 0; i < int(v.size()); i++) ret[i + 1] = ret[i] + v[i];
  }
  return ret;
};

template <typename T>
vector<T> mkuni(const vector<T> &v) {
  vector<T> ret(v);
  sort(ret.begin(), ret.end());
  ret.erase(unique(ret.begin(), ret.end()), ret.end());
  return ret;
}

template <typename F>
vector<int> mkord(int N,F f) {
  vector<int> ord(N);
  iota(begin(ord), end(ord), 0);
  sort(begin(ord), end(ord), f);
  return ord;
}

template <typename T>
vector<int> mkinv(vector<T> &v) {
  int max_val = *max_element(begin(v), end(v));
  vector<int> inv(max_val + 1, -1);
  for (int i = 0; i < (int)v.size(); i++) inv[v[i]] = i;
  return inv;
}

vector<int> mkiota(int n) {
  vector<int> ret(n);
  iota(begin(ret), end(ret), 0);
  return ret;
}

template <typename T>
T mkrev(const T &v) {
  T w{v};
  reverse(begin(w), end(w));
  return w;
}

template <typename T>
bool nxp(vector<T> &v) {
  return next_permutation(begin(v), end(v));
}



#define inV(T, v, n) \
  vector<T> v(n);    \
  in(v)

#define inVV(T, v, h, w)                \
  vector<vector<T>> v(h, vector<T>(w)); \
  in(v);

template <typename T>
using minpq = priority_queue<T, vector<T>, greater<T>>;

// 区間:半開区間 (ng, ok] または [ok, ng)
template <typename T, typename F>
T binary_search(T ng, T ok, const F& f) {
  if constexpr (is_integral<T>::value == true) {
    while (abs(ok - ng) > 1) {
      T x = (ok + ng) / 2;
      (f(x) ? ok : ng) = x;
    }
    return ok;
  } else {
    for (int iter = 0; iter < 60; iter++) {
      T x = (ok + ng) / 2;
      (f(x) ? ok : ng) = x;
    }
    return ok;
  }
}

// 解区間 (l, r)
template <typename T, typename F>
void ternary_search(T l, T r, const F& f, bool greater = false) {
  if constexpr (is_integral<T>::value == true) {
    while (abs(l - r) > 2) {
      T llr = (l * 2 + r * 1) / 3;
      T lrr = (l * 1 + r * 2) / 3;
      bool flag = f(llr) < f(lrr);
      if (flag != greater) {
        r = lrr;
      } else {
        l = llr;
      }
    }
    return (l + r) / 2;
  } else {
    for (int iter = 0; iter < 80; iter++) {
      T llr = (l * 2 + r * 1) / 3;
      T lrr = (l * 1 + r * 2) / 3;
      bool flag = f(llr) < f(lrr);
      if (flag != greater) {
        r = lrr;
      } else {
        l = llr;
      }
    }
    return (l + r) / 2;
  }
}

}  // namespace Nyaan

// bit operation
namespace Nyaan {
__attribute__((target("popcnt"))) inline int popcnt(const u64 &a) {
  return _mm_popcnt_u64(a);
}
inline int lsb(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int ctz(const u64 &a) { return a ? __builtin_ctzll(a) : 64; }
inline int msb(const u64 &a) { return a ? 63 - __builtin_clzll(a) : -1; }
template <typename T>
inline int gbit(const T &a, int i) {
  return (a >> i) & 1;
}
template <typename T>
inline void sbit(T &a, int i, bool b) {
  if (gbit(a, i) != b) a ^= T(1) << i;
}
constexpr long long PW(int n) { return 1LL << n; }
constexpr long long MSK(int n) { return (1LL << n) - 1; }
}  // namespace Nyaan

// inout
namespace Nyaan {

template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << p.first << " " << p.second;
  return os;
}
template <typename T, typename U>
istream &operator>>(istream &is, pair<T, U> &p) {
  is >> p.first >> p.second;
  return is;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  int s = (int)v.size();
  for (int i = 0; i < s; i++) os << (i ? " " : "") << v[i];
  return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
  for (auto &x : v) is >> x;
  return is;
}

istream &operator>>(istream &is, __int128_t &x) {
  string S;
  is >> S;
  x = 0;
  int flag = 0;
  for (auto &c : S) {
    if (c == '-') {
      flag = true;
      continue;
    }
    x *= 10;
    x += c - '0';
  }
  if (flag) x = -x;
  return is;
}

istream &operator>>(istream &is, __uint128_t &x) {
  string S;
  is >> S;
  x = 0;
  for (auto &c : S) {
    x *= 10;
    x += c - '0';
  }
  return is;
}

ostream &operator<<(ostream &os, __int128_t x) {
  if (x == 0) return os << 0;
  if (x < 0) os << '-', x = -x;
  string S;
  while (x) S.push_back('0' + x % 10), x /= 10;
  reverse(begin(S), end(S));
  return os << S;
}
ostream &operator<<(ostream &os, __uint128_t x) {
  if (x == 0) return os << 0;
  string S;
  while (x) S.push_back('0' + x % 10), x /= 10;
  reverse(begin(S), end(S));
  return os << S;
}

void in() {}
template <typename T, class... U>
void in(T &t, U &...u) {
  cin >> t;
  in(u...);
}

void out() { cout << "\n"; }
template <typename T, class... U, char sep = ' '>
void out(const T &t, const U &...u) {
  cout << t;
  if (sizeof...(u)) cout << sep;
  out(u...);
}

void outr() {}
template <typename T, class... U, char sep = ' '>
void outr(const T &t, const U &...u) {
  cout << t;
  outr(u...);
}

struct IoSetupNya {
  IoSetupNya() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    cerr << fixed << setprecision(7);
  }
} iosetupnya;

}  // namespace Nyaan

// debug

#ifdef NyaanDebug
#define trc(...) (void(0))
#else
#define trc(...) (void(0))
#endif

// macro
#define each(x, v) for (auto&& x : v)
#define each2(x, y, v) for (auto&& [x, y] : v)
#define all(v) (v).begin(), (v).end()
#define rep(i, N) for (long long i = 0; i < (long long)(N); i++)
#define repr(i, N) for (long long i = (long long)(N)-1; i >= 0; i--)
#define rep1(i, N) for (long long i = 1; i <= (long long)(N); i++)
#define repr1(i, N) for (long long i = (N); (long long)(i) > 0; i--)
#define reg(i, a, b) for (long long i = (a); i < (b); i++)
#define regr(i, a, b) for (long long i = (b)-1; i >= (a); i--)
#define fi first
#define se second
#define ini(...)   \
  int __VA_ARGS__; \
  in(__VA_ARGS__)
#define inl(...)         \
  long long __VA_ARGS__; \
  in(__VA_ARGS__)
#define ins(...)      \
  string __VA_ARGS__; \
  in(__VA_ARGS__)
#define in2(s, t)                           \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i]);                         \
  }
#define in3(s, t, u)                        \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i]);                   \
  }
#define in4(s, t, u, v)                     \
  for (int i = 0; i < (int)s.size(); i++) { \
    in(s[i], t[i], u[i], v[i]);             \
  }
#define die(...)             \
  do {                       \
    Nyaan::out(__VA_ARGS__); \
    return;                  \
  } while (0)

namespace Nyaan {
void solve();
}
int main() { Nyaan::solve(); }

//

using namespace Nyaan;

void wt(int S, vi x, vi y) {
  trc(S, x, y);
  assert(sz(x) == S);
  out(S);
  rep(i, S) out(x[i], y[i]);
  exit(0);
}

void q() {
  ini(N, M);
  if (N == 1 and M == 1) {
    int S = 1;
    vi X{1}, Y{1};
    wt(S, X, Y);
  }
  if (N == M) {
    int S = N + M - 2;
    vi X, Y;
    rep1(i, N) {
      X.push_back(1), Y.push_back(i);
      if (i != 1 and i != N) X.push_back(N), Y.push_back(i);
    }
    wt(S, X, Y);
  }

  int rev = 0;
  if (N > M) rev = 1, swap(N, M);
  if (N % 2 == 1) {
    vi X, Y;
    rep1(i, N) {
      X.push_back(i);
      Y.push_back(1);
      X.push_back(i);
      Y.push_back(M);
    }
    int d = (N + 1) / 2;
    for (int j = d + 1; j + d <= M; j++) {
      X.push_back(d);
      Y.push_back(j);
    }
    if (rev) swap(X, Y);
    wt(N + M - 1, X, Y);
  }

  vi X, Y;
  rep1(i, N) {
    X.push_back(i), Y.push_back(1);
    X.push_back(i), Y.push_back(M);
  }
  int d = N / 2;
  for (int j = d + 2; j + d + 1 <= M; j += 2) {
    X.push_back(d + 0), Y.push_back(j);
    X.push_back(d + 1), Y.push_back(j);
  }
  int S = N + M - 1 - (M % 2 == 0);
  if (rev) swap(X, Y);
  wt(S, X, Y);
}

void Nyaan::solve() {
  int T = 1;

  // in(T);

  while (T--) q();
}

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

详细

Test #1:

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

input:

2 5

output:

6
1 1
1 5
2 1
2 5
1 3
2 3

result:

ok n: 2, m: 5, bishops: 6

Test #2:

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

input:

5 5

output:

8
1 1
1 2
5 2
1 3
5 3
1 4
5 4
1 5

result:

ok n: 5, m: 5, bishops: 8

Test #3:

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

input:

100000 100000

output:

199998
1 1
1 2
100000 2
1 3
100000 3
1 4
100000 4
1 5
100000 5
1 6
100000 6
1 7
100000 7
1 8
100000 8
1 9
100000 9
1 10
100000 10
1 11
100000 11
1 12
100000 12
1 13
100000 13
1 14
100000 14
1 15
100000 15
1 16
100000 16
1 17
100000 17
1 18
100000 18
1 19
100000 19
1 20
100000 20
1 21
100000 21
1 22
...

result:

ok n: 100000, m: 100000, bishops: 199998

Test #4:

score: 0
Accepted
time: 18ms
memory: 6924kb

input:

100000 99999

output:

199998
1 1
100000 1
1 2
100000 2
1 3
100000 3
1 4
100000 4
1 5
100000 5
1 6
100000 6
1 7
100000 7
1 8
100000 8
1 9
100000 9
1 10
100000 10
1 11
100000 11
1 12
100000 12
1 13
100000 13
1 14
100000 14
1 15
100000 15
1 16
100000 16
1 17
100000 17
1 18
100000 18
1 19
100000 19
1 20
100000 20
1 21
100000...

result:

ok n: 100000, m: 99999, bishops: 199998

Test #5:

score: 0
Accepted
time: 10ms
memory: 6372kb

input:

100000 50000

output:

149998
1 1
100000 1
1 2
100000 2
1 3
100000 3
1 4
100000 4
1 5
100000 5
1 6
100000 6
1 7
100000 7
1 8
100000 8
1 9
100000 9
1 10
100000 10
1 11
100000 11
1 12
100000 12
1 13
100000 13
1 14
100000 14
1 15
100000 15
1 16
100000 16
1 17
100000 17
1 18
100000 18
1 19
100000 19
1 20
100000 20
1 21
100000...

result:

ok n: 100000, m: 50000, bishops: 149998

Test #6:

score: 0
Accepted
time: 11ms
memory: 5300kb

input:

1 100000

output:

100000
1 1
1 100000
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 5...

result:

ok n: 1, m: 100000, bishops: 100000

Test #7:

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

input:

34535 99889

output:

134423
1 1
1 99889
2 1
2 99889
3 1
3 99889
4 1
4 99889
5 1
5 99889
6 1
6 99889
7 1
7 99889
8 1
8 99889
9 1
9 99889
10 1
10 99889
11 1
11 99889
12 1
12 99889
13 1
13 99889
14 1
14 99889
15 1
15 99889
16 1
16 99889
17 1
17 99889
18 1
18 99889
19 1
19 99889
20 1
20 99889
21 1
21 99889
22 1
22 99889
23 ...

result:

ok n: 34535, m: 99889, bishops: 134423

Test #8:

score: 0
Accepted
time: 13ms
memory: 5676kb

input:

12231 97889

output:

110119
1 1
1 97889
2 1
2 97889
3 1
3 97889
4 1
4 97889
5 1
5 97889
6 1
6 97889
7 1
7 97889
8 1
8 97889
9 1
9 97889
10 1
10 97889
11 1
11 97889
12 1
12 97889
13 1
13 97889
14 1
14 97889
15 1
15 97889
16 1
16 97889
17 1
17 97889
18 1
18 97889
19 1
19 97889
20 1
20 97889
21 1
21 97889
22 1
22 97889
23 ...

result:

ok n: 12231, m: 97889, bishops: 110119

Test #9:

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

input:

10000 100000

output:

109998
1 1
1 100000
2 1
2 100000
3 1
3 100000
4 1
4 100000
5 1
5 100000
6 1
6 100000
7 1
7 100000
8 1
8 100000
9 1
9 100000
10 1
10 100000
11 1
11 100000
12 1
12 100000
13 1
13 100000
14 1
14 100000
15 1
15 100000
16 1
16 100000
17 1
17 100000
18 1
18 100000
19 1
19 100000
20 1
20 100000
21 1
21 100...

result:

ok n: 10000, m: 100000, bishops: 109998

Test #10:

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

input:

13 99999

output:

100011
1 1
1 99999
2 1
2 99999
3 1
3 99999
4 1
4 99999
5 1
5 99999
6 1
6 99999
7 1
7 99999
8 1
8 99999
9 1
9 99999
10 1
10 99999
11 1
11 99999
12 1
12 99999
13 1
13 99999
7 8
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 18
7 19
7 20
7 21
7 22
7 23
7 24
7 25
7 26
7 27
7 28
7 29
7 30
7 31
7 32
7 33
7...

result:

ok n: 13, m: 99999, bishops: 100011

Test #11:

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

input:

21 99999

output:

100019
1 1
1 99999
2 1
2 99999
3 1
3 99999
4 1
4 99999
5 1
5 99999
6 1
6 99999
7 1
7 99999
8 1
8 99999
9 1
9 99999
10 1
10 99999
11 1
11 99999
12 1
12 99999
13 1
13 99999
14 1
14 99999
15 1
15 99999
16 1
16 99999
17 1
17 99999
18 1
18 99999
19 1
19 99999
20 1
20 99999
21 1
21 99999
11 12
11 13
11 14...

result:

ok n: 21, m: 99999, bishops: 100019

Test #12:

score: 0
Accepted
time: 18ms
memory: 6088kb

input:

49999 100000

output:

149998
1 1
1 100000
2 1
2 100000
3 1
3 100000
4 1
4 100000
5 1
5 100000
6 1
6 100000
7 1
7 100000
8 1
8 100000
9 1
9 100000
10 1
10 100000
11 1
11 100000
12 1
12 100000
13 1
13 100000
14 1
14 100000
15 1
15 100000
16 1
16 100000
17 1
17 100000
18 1
18 100000
19 1
19 100000
20 1
20 100000
21 1
21 100...

result:

ok n: 49999, m: 100000, bishops: 149998

Test #13:

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

input:

33333 99999

output:

133331
1 1
1 99999
2 1
2 99999
3 1
3 99999
4 1
4 99999
5 1
5 99999
6 1
6 99999
7 1
7 99999
8 1
8 99999
9 1
9 99999
10 1
10 99999
11 1
11 99999
12 1
12 99999
13 1
13 99999
14 1
14 99999
15 1
15 99999
16 1
16 99999
17 1
17 99999
18 1
18 99999
19 1
19 99999
20 1
20 99999
21 1
21 99999
22 1
22 99999
23 ...

result:

ok n: 33333, m: 99999, bishops: 133331

Test #14:

score: 0
Accepted
time: 10ms
memory: 5940kb

input:

23342 98876

output:

122216
1 1
1 98876
2 1
2 98876
3 1
3 98876
4 1
4 98876
5 1
5 98876
6 1
6 98876
7 1
7 98876
8 1
8 98876
9 1
9 98876
10 1
10 98876
11 1
11 98876
12 1
12 98876
13 1
13 98876
14 1
14 98876
15 1
15 98876
16 1
16 98876
17 1
17 98876
18 1
18 98876
19 1
19 98876
20 1
20 98876
21 1
21 98876
22 1
22 98876
23 ...

result:

ok n: 23342, m: 98876, bishops: 122216

Test #15:

score: 0
Accepted
time: 15ms
memory: 6080kb

input:

56713 91234

output:

147946
1 1
1 91234
2 1
2 91234
3 1
3 91234
4 1
4 91234
5 1
5 91234
6 1
6 91234
7 1
7 91234
8 1
8 91234
9 1
9 91234
10 1
10 91234
11 1
11 91234
12 1
12 91234
13 1
13 91234
14 1
14 91234
15 1
15 91234
16 1
16 91234
17 1
17 91234
18 1
18 91234
19 1
19 91234
20 1
20 91234
21 1
21 91234
22 1
22 91234
23 ...

result:

ok n: 56713, m: 91234, bishops: 147946

Test #16:

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

input:

99995 99995

output:

199988
1 1
1 2
99995 2
1 3
99995 3
1 4
99995 4
1 5
99995 5
1 6
99995 6
1 7
99995 7
1 8
99995 8
1 9
99995 9
1 10
99995 10
1 11
99995 11
1 12
99995 12
1 13
99995 13
1 14
99995 14
1 15
99995 15
1 16
99995 16
1 17
99995 17
1 18
99995 18
1 19
99995 19
1 20
99995 20
1 21
99995 21
1 22
99995 22
1 23
99995 ...

result:

ok n: 99995, m: 99995, bishops: 199988

Test #17:

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

input:

12345 54321

output:

66665
1 1
1 54321
2 1
2 54321
3 1
3 54321
4 1
4 54321
5 1
5 54321
6 1
6 54321
7 1
7 54321
8 1
8 54321
9 1
9 54321
10 1
10 54321
11 1
11 54321
12 1
12 54321
13 1
13 54321
14 1
14 54321
15 1
15 54321
16 1
16 54321
17 1
17 54321
18 1
18 54321
19 1
19 54321
20 1
20 54321
21 1
21 54321
22 1
22 54321
23 1...

result:

ok n: 12345, m: 54321, bishops: 66665

Test #18:

score: 0
Accepted
time: 21ms
memory: 6564kb

input:

90000 92000

output:

181998
1 1
1 92000
2 1
2 92000
3 1
3 92000
4 1
4 92000
5 1
5 92000
6 1
6 92000
7 1
7 92000
8 1
8 92000
9 1
9 92000
10 1
10 92000
11 1
11 92000
12 1
12 92000
13 1
13 92000
14 1
14 92000
15 1
15 92000
16 1
16 92000
17 1
17 92000
18 1
18 92000
19 1
19 92000
20 1
20 92000
21 1
21 92000
22 1
22 92000
23 ...

result:

ok n: 90000, m: 92000, bishops: 181998

Test #19:

score: 0
Accepted
time: 11ms
memory: 4984kb

input:

10000 70000

output:

79998
1 1
1 70000
2 1
2 70000
3 1
3 70000
4 1
4 70000
5 1
5 70000
6 1
6 70000
7 1
7 70000
8 1
8 70000
9 1
9 70000
10 1
10 70000
11 1
11 70000
12 1
12 70000
13 1
13 70000
14 1
14 70000
15 1
15 70000
16 1
16 70000
17 1
17 70000
18 1
18 70000
19 1
19 70000
20 1
20 70000
21 1
21 70000
22 1
22 70000
23 1...

result:

ok n: 10000, m: 70000, bishops: 79998

Test #20:

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

input:

10000 70001

output:

80000
1 1
1 70001
2 1
2 70001
3 1
3 70001
4 1
4 70001
5 1
5 70001
6 1
6 70001
7 1
7 70001
8 1
8 70001
9 1
9 70001
10 1
10 70001
11 1
11 70001
12 1
12 70001
13 1
13 70001
14 1
14 70001
15 1
15 70001
16 1
16 70001
17 1
17 70001
18 1
18 70001
19 1
19 70001
20 1
20 70001
21 1
21 70001
22 1
22 70001
23 1...

result:

ok n: 10000, m: 70001, bishops: 80000

Test #21:

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

input:

10000 80000

output:

89998
1 1
1 80000
2 1
2 80000
3 1
3 80000
4 1
4 80000
5 1
5 80000
6 1
6 80000
7 1
7 80000
8 1
8 80000
9 1
9 80000
10 1
10 80000
11 1
11 80000
12 1
12 80000
13 1
13 80000
14 1
14 80000
15 1
15 80000
16 1
16 80000
17 1
17 80000
18 1
18 80000
19 1
19 80000
20 1
20 80000
21 1
21 80000
22 1
22 80000
23 1...

result:

ok n: 10000, m: 80000, bishops: 89998

Test #22:

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

input:

10000 80001

output:

90000
1 1
1 80001
2 1
2 80001
3 1
3 80001
4 1
4 80001
5 1
5 80001
6 1
6 80001
7 1
7 80001
8 1
8 80001
9 1
9 80001
10 1
10 80001
11 1
11 80001
12 1
12 80001
13 1
13 80001
14 1
14 80001
15 1
15 80001
16 1
16 80001
17 1
17 80001
18 1
18 80001
19 1
19 80001
20 1
20 80001
21 1
21 80001
22 1
22 80001
23 1...

result:

ok n: 10000, m: 80001, bishops: 90000

Test #23:

score: 0
Accepted
time: 11ms
memory: 5392kb

input:

10000 80002

output:

90000
1 1
1 80002
2 1
2 80002
3 1
3 80002
4 1
4 80002
5 1
5 80002
6 1
6 80002
7 1
7 80002
8 1
8 80002
9 1
9 80002
10 1
10 80002
11 1
11 80002
12 1
12 80002
13 1
13 80002
14 1
14 80002
15 1
15 80002
16 1
16 80002
17 1
17 80002
18 1
18 80002
19 1
19 80002
20 1
20 80002
21 1
21 80002
22 1
22 80002
23 1...

result:

ok n: 10000, m: 80002, bishops: 90000

Test #24:

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

input:

10000 79999

output:

89998
1 1
1 79999
2 1
2 79999
3 1
3 79999
4 1
4 79999
5 1
5 79999
6 1
6 79999
7 1
7 79999
8 1
8 79999
9 1
9 79999
10 1
10 79999
11 1
11 79999
12 1
12 79999
13 1
13 79999
14 1
14 79999
15 1
15 79999
16 1
16 79999
17 1
17 79999
18 1
18 79999
19 1
19 79999
20 1
20 79999
21 1
21 79999
22 1
22 79999
23 1...

result:

ok n: 10000, m: 79999, bishops: 89998

Test #25:

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

input:

10000 79998

output:

89996
1 1
1 79998
2 1
2 79998
3 1
3 79998
4 1
4 79998
5 1
5 79998
6 1
6 79998
7 1
7 79998
8 1
8 79998
9 1
9 79998
10 1
10 79998
11 1
11 79998
12 1
12 79998
13 1
13 79998
14 1
14 79998
15 1
15 79998
16 1
16 79998
17 1
17 79998
18 1
18 79998
19 1
19 79998
20 1
20 79998
21 1
21 79998
22 1
22 79998
23 1...

result:

ok n: 10000, m: 79998, bishops: 89996

Test #26:

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

input:

11111 100000

output:

111110
1 1
1 100000
2 1
2 100000
3 1
3 100000
4 1
4 100000
5 1
5 100000
6 1
6 100000
7 1
7 100000
8 1
8 100000
9 1
9 100000
10 1
10 100000
11 1
11 100000
12 1
12 100000
13 1
13 100000
14 1
14 100000
15 1
15 100000
16 1
16 100000
17 1
17 100000
18 1
18 100000
19 1
19 100000
20 1
20 100000
21 1
21 100...

result:

ok n: 11111, m: 100000, bishops: 111110

Test #27:

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

input:

1 1

output:

1
1 1

result:

ok n: 1, m: 1, bishops: 1

Extra Test:

score: 0
Extra Test Passed