QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#671554#9132. Painting FencesmaspyAC ✓152ms122864kbC++2316.5kb2024-10-24 13:19:562024-10-24 13:19:57

Judging History

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

  • [2024-10-24 13:19:57]
  • 评测
  • 测评结果:AC
  • 用时:152ms
  • 内存:122864kb
  • [2024-10-24 13:19:56]
  • 提交

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_mod_2(int x) { return __builtin_parity(x); }
int popcnt_mod_2(u32 x) { return __builtin_parity(x); }
int popcnt_mod_2(ll x) { return __builtin_parityll(x); }
int popcnt_mod_2(u64 x) { return __builtin_parityll(x); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 1, 2)
int topbit(int x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(u32 x) { return (x == 0 ? -1 : 31 - __builtin_clz(x)); }
int topbit(ll x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
int topbit(u64 x) { return (x == 0 ? -1 : 63 - __builtin_clzll(x)); }
// (0, 1, 2, 3, 4) -> (-1, 0, 1, 0, 2)
int lowbit(int x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(u32 x) { return (x == 0 ? -1 : __builtin_ctz(x)); }
int lowbit(ll x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }
int lowbit(u64 x) { return (x == 0 ? -1 : __builtin_ctzll(x)); }

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

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

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

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

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

template <class T, class S>
inline bool chmax(T &a, const S &b) {
  return (a < b ? a = b, 1 : 0);
}
template <class T, class S>
inline bool chmin(T &a, const S &b) {
  return (a > b ? a = b, 1 : 0);
}

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

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

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

// A[I[0]], A[I[1]], ...
template <typename T>
vc<T> rearrange(const vc<T> &A, const vc<int> &I) {
  vc<T> B(len(I));
  FOR(i, len(I)) B[i] = A[I[i]];
  return B;
}

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 1 "/home/maspy/compro/library/seq/cartesian_tree.hpp"
/*
辞書順で高さを unique して、木にしている。
極大長方形アルゴリズムで線形時間構築。
*/
template <typename T, bool IS_MIN>
struct CartesianTree {
  int n;
  vc<T>& A;
  vc<pair<int, int>> range;
  vc<int> lch, rch, par;
  int root;

  CartesianTree(vc<T>& A) : n(len(A)), A(A) {
    range.assign(n, {-1, -1});
    lch.assign(n, -1);
    rch.assign(n, -1);
    par.assign(n, -1);
    if (n == 1) {
      range[0] = {0, 1};
      root = 0;
      return;
    }
    auto is_sm = [&](int i, int j) -> bool {
      if (IS_MIN) return (A[i] < A[j]) || (A[i] == A[j] && i < j);
      return (A[i] > A[j]) || (A[i] == A[j] && i < j);
    };
    vc<int> st;
    FOR(i, n) {
      while (!st.empty() && is_sm(i, st.back())) {
        lch[i] = st.back();
        st.pop_back();
      }
      range[i].fi = (st.empty() ? 0 : st.back() + 1);
      st.eb(i);
    }
    st.clear();
    FOR_R(i, n) {
      while (!st.empty() && is_sm(i, st.back())) {
        rch[i] = st.back();
        st.pop_back();
      }
      range[i].se = (st.empty() ? n : st.back());
      st.eb(i);
    }
    FOR(i, n) if (lch[i] != -1) par[lch[i]] = i;
    FOR(i, n) if (rch[i] != -1) par[rch[i]] = i;
    FOR(i, n) if (par[i] == -1) root = i;
  }

  // (l, r, h)
  tuple<int, int, T> maximum_rectangle(int i) {
    auto [l, r] = range[i];
    return {l, r, A[i]};
  }

  // (l, r, h)
  T max_rectangle_area() {
    assert(IS_MIN);
    T res = 0;
    FOR(i, n) {
      auto [l, r, h] = maximum_rectangle(i);
      chmax(res, (r - l) * h);
    }
    return res;
  }

  ll count_subrectangle(bool baseline) {
    assert(IS_MIN);
    ll res = 0;
    FOR(i, n) {
      auto [l, r, h] = maximum_rectangle(i);
      ll x = (baseline ? h : h * (h + 1) / 2);
      res += x * (i - l + 1) * (r - i);
    }
    return res;
  }
};
#line 5 "main.cpp"

/*
dp[K][L]
[L,R) を K 回で全体にできるような最小の R
あとは極大長方形列挙
*/

void solve() {
  LL(H, W);
  auto calc = [&](int N) -> vvc<int> {
    vv(int, dp, 22, N);
    FOR(i, N) dp[0][i] = infty<int>;
    dp[0][0] = N;
    FOR(k, 1, 22) {
      auto check = [&](int L, int R) -> bool {
        int a = 2 * L - R, b = 2 * R - L;
        chmax(a, 0), chmin(b, N);
        return dp[k - 1][a] <= R || dp[k - 1][L] <= b;
      };
      int R = 0;
      FOR(L, N) {
        while (R < N && !check(L, R)) ++R;
        dp[k][L] = (check(L, R) ? R : infty<int>);
      }
    }
    return dp;
  };
  auto dp1 = calc(H), dp2 = calc(W);
  VEC(string, G, H);

  auto F = [&](vvc<int>& dp, int a, int b) -> int {
    SHOW(a, b);
    FOR(k, 22) {
      if (dp[k][a] <= b) return k;
    }
    assert(0);
    return infty<int>;
  };

  vc<int> A(W);
  int ans = infty<int>;
  FOR(i, H) {
    FOR(j, W) A[j] = (G[i][j] == '1' ? A[j] + 1 : 0);
    CartesianTree<int, 1> CT(A);
    FOR(j, W) {
      if (A[j] == 0) continue;
      auto [c, d] = CT.range[j];
      int b = 1 + i;
      int a = b - A[j];
      int x1 = F(dp1, a, b);
      int x2 = F(dp2, c, d);
      SHOW(a, b, c, d, x1, x2);
      chmin(ans, x1 + x2);
    }
  }
  print(ans);
}

signed main() { solve(); }

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4 4
1001
0100
0110
0110

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

input:

3 3
000
111
111

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

4 3
011
011
001
110

output:

2

result:

ok 1 number(s): "2"

Test #4:

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

input:

4 4
0011
1111
1111
1111

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

4 4
0000
0010
0100
1000

output:

4

result:

ok 1 number(s): "4"

Test #6:

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

input:

2 5
00010
00111

output:

2

result:

ok 1 number(s): "2"

Test #7:

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

input:

5 5
11111
11111
11111
01111
11111

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

5 5
00101
00000
00001
00000
00100

output:

6

result:

ok 1 number(s): "6"

Test #9:

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

input:

5 5
00000
00000
00001
10000
00000

output:

6

result:

ok 1 number(s): "6"

Test #10:

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

input:

10 10
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111
1111111111

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

10 10
0001000000
0000000000
0000000000
0000000001
0000000001
0000000001
0000000000
0000000000
0000000000
0000000001

output:

6

result:

ok 1 number(s): "6"

Test #12:

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

input:

10 10
1111111110
1111111110
1111111110
1111111110
1111111110
1111100110
1111100010
1111101110
1111101100
1111100000

output:

1

result:

ok 1 number(s): "1"

Test #13:

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

input:

10 10
0000000000
0000001000
0000000000
0000000000
0000000000
0100000000
0000000000
0000000100
0000000000
0000000000

output:

8

result:

ok 1 number(s): "8"

Test #14:

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

input:

30 31
0000000000000000000000000000000
0000000000000000000000000000000
1111111111111110000000000000011
1111111111111110000000000000011
1111111111111110000000000000011
1111111111111111111111111111111
1111111111111111111111111111111
1111111111111111111111111111100
1111111111111111111111111111100
111111...

output:

3

result:

ok 1 number(s): "3"

Test #15:

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

input:

30 31
0000000000000000000000000000000
0000000000000000000000000000000
0000000001000000000000000000000
0000000000000000000000100000000
0000000000000000000100000000000
0000000000000000001000000000000
0000000000000010000000000000000
0000000000000000000000000000000
0000000000000000000000000100110
000000...

output:

10

result:

ok 1 number(s): "10"

Test #16:

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

input:

30 31
0000000000000000000000000000000
0000000011111111111111000000000
0000000011111111111111000000000
1111111111111111111111000000000
1111111111111111111111000000000
1111111111111111111111000000000
1111111111111111111111000111100
1111111111111111111111000111100
1111111111111111111111000111100
111111...

output:

3

result:

ok 1 number(s): "3"

Test #17:

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

input:

30 31
0000001010000000000000000000000
0000000000000000000000000000000
0000000000000000001000000000000
0000010000000000000000000000000
0000000000000000000000000000000
0000000000000000000000000000000
0000001000010000000000000000000
0000100000010010000000000000000
0000000001000001000000010000000
000000...

output:

9

result:

ok 1 number(s): "9"

Test #18:

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

input:

50 50
01111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #19:

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

input:

50 50
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000...

output:

6

result:

ok 1 number(s): "6"

Test #20:

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

input:

50 50
00000000000000000000000000000000000000000000000000
00000000000000000000000001000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000...

output:

11

result:

ok 1 number(s): "11"

Test #21:

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

input:

50 50
00000111111111111111111111111111111111111111111111
00001111111111111111111111111111111111111111111111
00001111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #22:

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

input:

50 50
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000111111100
00000000000000000000000000000000000000000111111100
00111111111111111111111110000000000000000111111100
001111111111111111111111100000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #23:

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

input:

50 50
00000000000000000000000000000000000100000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000001
00000000000000000000000000000000000000000000000000
000000000000000000000000000000000001000...

output:

11

result:

ok 1 number(s): "11"

Test #24:

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

input:

1 20
01111111111111111111

output:

1

result:

ok 1 number(s): "1"

Test #25:

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

input:

1 20
00111111111111111111

output:

1

result:

ok 1 number(s): "1"

Test #26:

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

input:

1 20
00111111111111111110

output:

2

result:

ok 1 number(s): "2"

Test #27:

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

input:

1 100
0000000000000000000000000000000000000001000000000100000000000000000100000000000000000000000000000000

output:

7

result:

ok 1 number(s): "7"

Test #28:

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

input:

1 500
000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #29:

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

input:

1 500
000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #30:

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

input:

1 500
000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #31:

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

input:

1 500
000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #32:

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

input:

1 500
000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #33:

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

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #34:

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

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000010000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000001000000000000000000000000000000000000000000000000000...

output:

10

result:

ok 1 number(s): "10"

Test #35:

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

input:

1 1000
00000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #36:

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

input:

1 1000
00000000000000000000000000000000000010000010000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000001000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

9

result:

ok 1 number(s): "9"

Test #37:

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

input:

1 1000
00000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #38:

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

input:

1 1000
00000000000000000000000000000000000100000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000...

output:

10

result:

ok 1 number(s): "10"

Test #39:

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

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #40:

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

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000001100000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000...

output:

9

result:

ok 1 number(s): "9"

Test #41:

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

input:

1 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #42:

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

input:

1 1000
00000000010000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000010000000000000000000000000000010000000000000000000101000000...

output:

10

result:

ok 1 number(s): "10"

Test #43:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #44:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #45:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #46:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #47:

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

input:

500 500
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #48:

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

input:

500 500
0111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #49:

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

input:

500 500
1010101100000101011010110001000111111000100101101110001110101000111000111110011100000001111110111000011111011000000101001011010101011100001110100100011101010011101110010011011001011000001101110011010011111000000011110001001101000001011001011011010100100110010000111110010100011000000011100000...

output:

14

result:

ok 1 number(s): "14"

Test #50:

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

input:

500 500
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #51:

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

input:

500 500
0011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #52:

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

input:

500 500
1101011110100110010100101010110101001101011111001000011111001100000100010000000110001010101001010100110001101101010001100111010011100000001011011000001100110101101011000101000001001111001011000100010110011010111010001011100111100101001010010110100110010011001011001100011010101111001010101000...

output:

14

result:

ok 1 number(s): "14"

Test #53:

score: 0
Accepted
time: 16ms
memory: 5980kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #54:

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

input:

1000 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #55:

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

input:

1000 1000
00100011011101100111111101100101110110011010011011110100101111000001111110101110010010100111000101000000001000100000010001111011011000110011011100111100010000110010101100011000011011110011000100001110011011110010100100000111011110101000110010101100101101111110100001111100010111000010100000...

output:

16

result:

ok 1 number(s): "16"

Test #56:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #57:

score: 0
Accepted
time: 14ms
memory: 5912kb

input:

1000 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #58:

score: 0
Accepted
time: 34ms
memory: 5960kb

input:

1000 1000
00100111010100010110000010000001010001100100100010111001010100100110010000011000111100110110111100000011001111010001001011111010011001001100010000001100001000111100000000000101001011100010111010001011110011001000110111111101101111100001110110011011001001110100011101011110111000000010110000...

output:

16

result:

ok 1 number(s): "16"

Test #59:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #60:

score: 0
Accepted
time: 14ms
memory: 5964kb

input:

1000 1000
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #61:

score: 0
Accepted
time: 34ms
memory: 6168kb

input:

1000 1000
01001001110001101011000100011010111001101110000010110001001011001000100011111110111110010010001000011000100010000100101110111110011000011011001010010100011011010111010101100011001010010001010111100010101110100010011001110101110011110111001101000111100100100001110101111101010000111011001110...

output:

16

result:

ok 1 number(s): "16"

Test #62:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #63:

score: 0
Accepted
time: 14ms
memory: 5900kb

input:

1000 1000
00000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #64:

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

input:

1000 1000
01011111100000011011101110101010100000110001011011110001110010010010001001110000001100001111110011010011101100010101110100111110111111010111001101101110100011010101101100110111110011100001100100100001111110011000010111011010000010110011011001110111111001111011100001111111111101011010001110...

output:

16

result:

ok 1 number(s): "16"

Test #65:

score: 0
Accepted
time: 16ms
memory: 5968kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #66:

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

input:

1000 1000
00000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #67:

score: 0
Accepted
time: 39ms
memory: 5976kb

input:

1000 1000
01010101001010101010100000011011001001000001111010001100001001111101100111010111000100001111101010011000010011110000000101110111100111101000010001011110111011011101101000011000110011010010001001000100010010110100001000000000011010110111011000101000010100101001001101011101010001000001011110...

output:

16

result:

ok 1 number(s): "16"

Test #68:

score: 0
Accepted
time: 16ms
memory: 5920kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #69:

score: 0
Accepted
time: 14ms
memory: 5848kb

input:

1000 1000
00000000000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #70:

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

input:

1000 1000
00100001101111010011010111100111101010001110010010000100110010010011001100100001100110010010010011010011010110101101001011000111100110110011001011000011101010011010010101001100100010100001110010001101001101010110100110101010111101001011100110011100110001100001100101110110111100100000001101...

output:

16

result:

ok 1 number(s): "16"

Test #71:

score: 0
Accepted
time: 16ms
memory: 5892kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #72:

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

input:

1000 1000
00001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #73:

score: 0
Accepted
time: 39ms
memory: 5876kb

input:

1000 1000
00101111110110100010011001010111010011110100000011001101001101111001100110100111001100010110101111001000111001011100010010000101000101110100000101111001100010010000000100100010110011011101011110111000000101101100101001000100100101001111110111001010101001011011010001110100110000011000011001...

output:

16

result:

ok 1 number(s): "16"

Test #74:

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

input:

1000 1000
00000011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #75:

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

input:

1000 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #76:

score: 0
Accepted
time: 34ms
memory: 5920kb

input:

1000 1000
01001001010111011110110111100110111010101011101010100001110101011110000000000001001010000111010100000011110101001000110001000100000000001011011011100001011010011000101000100111011010101110100101011001111001000110111011011110010100011100111101110111000100001001111101000110010101011001001001...

output:

16

result:

ok 1 number(s): "16"

Test #77:

score: 0
Accepted
time: 16ms
memory: 5968kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #78:

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

input:

1000 1000
00011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #79:

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

input:

1000 1000
11011101010000101111011101011000010111001001011011100001101110110000101010100111111000101001000101001010111010111101101001000100010001010101000111000001001111111010110101011001001010011110001010011000100100111100010101110010001000010000001000100001100001000001000001000101111001100000010011...

output:

16

result:

ok 1 number(s): "16"

Test #80:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #81:

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

input:

1000 1000
01111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #82:

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

input:

1000 1000
11111010010000001000010101100100110000101011100101000000111100011111001110011001011010011001110100000100001100101001101011000111101000000001110100001000101010010110010110010110100110101011000100100011110000011000001000110010111010010001110110011100101100111111000011001101110100000001011011...

output:

16

result:

ok 1 number(s): "16"

Test #83:

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

input:

1000 300
000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #84:

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

input:

1000 300
011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #85:

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

input:

1000 301
101000010011000101110100110100011011011010111010011110100000111001100111001111101111110000011100000110000101011011000011111010111101000000110100011110101101101101111110010010000000000100111100011010101011101111100000001101001100001010100100101101011101111011010101000110011011011100000110100...

output:

15

result:

ok 1 number(s): "15"

Test #86:

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

input:

1000 300
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #87:

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

input:

1000 300
000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #88:

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

input:

1000 301
100110111001011001101001011000010101000100010100001100111110100110001101101110001101010110010011110000010100100010010101111010110011000111000010111000110111111101100101000011100100011000010000100001111100110001001011100111000011001011100010110000000100101101111110001110110000000100110010100...

output:

15

result:

ok 1 number(s): "15"

Test #89:

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

input:

300 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #90:

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

input:

300 1000
001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #91:

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

input:

301 1000
001110011101000010101001110010101101100001001111011101000000000101010011011010111100011011010001111111000011010000111000011010010101101011111000100100110101010001101100101000111111110001000010001101101100101111111100011011110100001110111001111110010000100000000011100011110110110111101000111...

output:

14

result:

ok 1 number(s): "14"

Test #92:

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

input:

300 1000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #93:

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

input:

300 1000
011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #94:

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

input:

301 1000
101111110001111110110111010100100101110000111001011111001110111110101101011011011000100010110111101101110001000101101100001110011101011100001100001011110001010011001101110101011001111101101000110101111110110101010011110101111011111011111101001011101011100010111011100011001101101001111101110...

output:

15

result:

ok 1 number(s): "15"

Test #95:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #96:

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

input:

1000 1000
00000000010000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000100001000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #97:

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

input:

1000 1000
00000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #98:

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

input:

1000 1000
00000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #99:

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

input:

1000 1000
00000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

18

result:

ok 1 number(s): "18"

Test #100:

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

input:

1000 1000
00000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000...

output:

19

result:

ok 1 number(s): "19"

Test #101:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #102:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000010000000000000000000000000100000...

output:

18

result:

ok 1 number(s): "18"

Test #103:

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

input:

1000 1000
00000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #104:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000001000001000000000001000000000000000000000000000000000000000010000000000000000000000000000010000000000000000000000000000000000000011000000000000000000000000000000000000000010000100000000000000000000000100000...

output:

19

result:

ok 1 number(s): "19"

Test #105:

score: 0
Accepted
time: 70ms
memory: 122864kb

input:

1 1000000
00000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #106:

score: 0
Accepted
time: 108ms
memory: 118724kb

input:

1 1000000
01111011100011101111011110000100101111000110100001110111110101010110110111111101010001010110001100011000101111101110010100100000111011011010110110011101011111111101010111110110011111100101101101011001110011110010001110100001011100110001011111110101001001001111110011011011001010101011110100...

output:

16

result:

ok 1 number(s): "16"

Test #107:

score: 0
Accepted
time: 79ms
memory: 122756kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

20

result:

ok 1 number(s): "20"

Test #108:

score: 0
Accepted
time: 80ms
memory: 122816kb

input:

1 1000000
00000000001111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #109:

score: 0
Accepted
time: 96ms
memory: 118672kb

input:

1 1000000
00001101000010010010110001100000000110011001101000101111101111111001011100011011010010010010110101010011100010010011011110110000001101000000111100110101000111111111000010000110010110010001010010111100001111011000000000011011100101110111000010100001001101000001001111011001100111110010101100...

output:

16

result:

ok 1 number(s): "16"

Test #110:

score: 0
Accepted
time: 81ms
memory: 122724kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #111:

score: 0
Accepted
time: 78ms
memory: 122604kb

input:

1 1000000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #112:

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

input:

1 1000000
00000001011000100011110111111000110101110011011001100111010100110011111100011101101000001111001101011000000101010110101011110000001100010111100010101111001111110010111011001001000111100010111011100101001111100010011011110011110101101110110000010111110000110011101011111010011011010010111100...

output:

16

result:

ok 1 number(s): "16"

Test #113:

score: 0
Accepted
time: 71ms
memory: 122608kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

20

result:

ok 1 number(s): "20"

Test #114:

score: 0
Accepted
time: 72ms
memory: 122620kb

input:

1 1000000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

0

result:

ok 1 number(s): "0"

Test #115:

score: 0
Accepted
time: 91ms
memory: 118572kb

input:

1 1000000
01010111111101010011001001001001011101100100110001100010101111001101010010111011101010001111110100010111001011000111100000111001001101111000101100010111111010010000110111111101010110010001100101000000110010001000110111111101011000101010111001001010011101101010110111111000110110101011101110...

output:

16

result:

ok 1 number(s): "16"

Test #116:

score: 0
Accepted
time: 63ms
memory: 122676kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #117:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #118:

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

input:

1 100000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #119:

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

input:

100000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1...

output:

2

result:

ok 1 number(s): "2"

Test #120:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001110000...

output:

4

result:

ok 1 number(s): "4"

Test #121:

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

input:

1 100000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #122:

score: 0
Accepted
time: 14ms
memory: 15192kb

input:

100000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

2

result:

ok 1 number(s): "2"

Test #123:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #124:

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

input:

1 100000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #125:

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

input:

100000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0...

output:

2

result:

ok 1 number(s): "2"

Test #126:

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

input:

300 300
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111100000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #127:

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

input:

1 100000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #128:

score: 0
Accepted
time: 14ms
memory: 15316kb

input:

100000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

2

result:

ok 1 number(s): "2"

Test #129:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #130:

score: 0
Accepted
time: 74ms
memory: 122648kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #131:

score: 0
Accepted
time: 145ms
memory: 120628kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

2

result:

ok 1 number(s): "2"

Test #132:

score: 0
Accepted
time: 127ms
memory: 120720kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

19

result:

ok 1 number(s): "19"

Test #133:

score: 0
Accepted
time: 16ms
memory: 5912kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

4

result:

ok 1 number(s): "4"

Test #134:

score: 0
Accepted
time: 78ms
memory: 122720kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #135:

score: 0
Accepted
time: 140ms
memory: 120804kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

2

result:

ok 1 number(s): "2"

Test #136:

score: 0
Accepted
time: 138ms
memory: 120796kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

19

result:

ok 1 number(s): "19"

Test #137:

score: 0
Accepted
time: 16ms
memory: 6176kb

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #138:

score: 0
Accepted
time: 67ms
memory: 122780kb

input:

1 1000000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

2

result:

ok 1 number(s): "2"

Test #139:

score: 0
Accepted
time: 146ms
memory: 120648kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

2

result:

ok 1 number(s): "2"

Test #140:

score: 0
Accepted
time: 144ms
memory: 120784kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

19

result:

ok 1 number(s): "19"

Test #141:

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

input:

1000 1000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

3

result:

ok 1 number(s): "3"

Test #142:

score: 0
Accepted
time: 75ms
memory: 122684kb

input:

1 1000000
00000000000000000000111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

2

result:

ok 1 number(s): "2"

Test #143:

score: 0
Accepted
time: 136ms
memory: 120708kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

2

result:

ok 1 number(s): "2"

Test #144:

score: 0
Accepted
time: 152ms
memory: 120608kb

input:

1000000 1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

output:

19

result:

ok 1 number(s): "19"

Test #145:

score: 0
Accepted
time: 16ms
memory: 6072kb

input:

10000 100
0000001000000000000100000000000000000000100000000000000000000000000000000000000000000001000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000001000000000000000001000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #146:

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

input:

100 10000
00100000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000010001000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #147:

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

input:

10000 100
0001000010000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #148:

score: 0
Accepted
time: 17ms
memory: 5912kb

input:

100 10000
00000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000100000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010...

output:

19

result:

ok 1 number(s): "19"

Test #149:

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

input:

10000 100
1000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000
0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000100000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #150:

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

input:

100 10000
00000000000000000000000000000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000001000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000100000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #151:

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

input:

10000 100
0000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000010000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #152:

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

input:

100 10000
00000000000000000001000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #153:

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

input:

10000 100
0000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000010000000000000100000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

output:

19

result:

ok 1 number(s): "19"

Test #154:

score: 0
Accepted
time: 14ms
memory: 6044kb

input:

100 10000
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000100000000000000...

output:

19

result:

ok 1 number(s): "19"

Extra Test:

score: 0
Extra Test Passed