QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#882147#10019. Gold CoinsQingyuAC ✓202ms4480kbC++268.3kb2025-02-04 21:28:242025-02-04 21:28:24

Judging History

This is the latest submission verdict.

  • [2025-02-04 21:28:24]
  • Judged
  • Verdict: AC
  • Time: 202ms
  • Memory: 4480kb
  • [2025-02-04 21:28:24]
  • Submitted

answer

#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <forward_list>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <optional>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template <typename T> bool chmax(T &m, const T q) { return m < q ? (m = q, true) : false; }
template <typename T> bool chmin(T &m, const T q) { return m > q ? (m = q, true) : false; }
const std::vector<std::pair<int, int>> grid_dxs{{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int floor_lg(long long x) { return x <= 0 ? -1 : 63 - __builtin_clzll(x); }
template <class T1, class T2> T1 floor_div(T1 num, T2 den) { return (num > 0 ? num / den : -((-num + den - 1) / den)); }
template <class T1, class T2> std::pair<T1, T2> operator+(const std::pair<T1, T2> &l, const std::pair<T1, T2> &r) { return std::make_pair(l.first + r.first, l.second + r.second); }
template <class T1, class T2> std::pair<T1, T2> operator-(const std::pair<T1, T2> &l, const std::pair<T1, T2> &r) { return std::make_pair(l.first - r.first, l.second - r.second); }
template <class T> std::vector<T> sort_unique(std::vector<T> vec) { sort(vec.begin(), vec.end()), vec.erase(unique(vec.begin(), vec.end()), vec.end()); return vec; }
template <class T> int arglb(const std::vector<T> &v, const T &x) { return std::distance(v.begin(), std::lower_bound(v.begin(), v.end(), x)); }
template <class T> int argub(const std::vector<T> &v, const T &x) { return std::distance(v.begin(), std::upper_bound(v.begin(), v.end(), x)); }
template <class IStream, class T> IStream &operator>>(IStream &is, std::vector<T> &vec) { for (auto &v : vec) is >> v; return is; }

template <class OStream, class T> OStream &operator<<(OStream &os, const std::vector<T> &vec);
template <class OStream, class T, size_t sz> OStream &operator<<(OStream &os, const std::array<T, sz> &arr);
template <class OStream, class T, class TH> OStream &operator<<(OStream &os, const std::unordered_set<T, TH> &vec);
template <class OStream, class T, class U> OStream &operator<<(OStream &os, const pair<T, U> &pa);
template <class OStream, class T> OStream &operator<<(OStream &os, const std::deque<T> &vec);
template <class OStream, class T> OStream &operator<<(OStream &os, const std::set<T> &vec);
template <class OStream, class T> OStream &operator<<(OStream &os, const std::multiset<T> &vec);
template <class OStream, class T> OStream &operator<<(OStream &os, const std::unordered_multiset<T> &vec);
template <class OStream, class T, class U> OStream &operator<<(OStream &os, const std::pair<T, U> &pa);
template <class OStream, class TK, class TV> OStream &operator<<(OStream &os, const std::map<TK, TV> &mp);
template <class OStream, class TK, class TV, class TH> OStream &operator<<(OStream &os, const std::unordered_map<TK, TV, TH> &mp);
template <class OStream, class... T> OStream &operator<<(OStream &os, const std::tuple<T...> &tpl);

template <class OStream, class T> OStream &operator<<(OStream &os, const std::vector<T> &vec) { os << '['; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <class OStream, class T, size_t sz> OStream &operator<<(OStream &os, const std::array<T, sz> &arr) { os << '['; for (auto v : arr) os << v << ','; os << ']'; return os; }
template <class... T> std::istream &operator>>(std::istream &is, std::tuple<T...> &tpl) { std::apply([&is](auto &&... args) { ((is >> args), ...);}, tpl); return is; }
template <class OStream, class... T> OStream &operator<<(OStream &os, const std::tuple<T...> &tpl) { os << '('; std::apply([&os](auto &&... args) { ((os << args << ','), ...);}, tpl); return os << ')'; }
template <class OStream, class T, class TH> OStream &operator<<(OStream &os, const std::unordered_set<T, TH> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <class OStream, class T> OStream &operator<<(OStream &os, const std::deque<T> &vec) { os << "deq["; for (auto v : vec) os << v << ','; os << ']'; return os; }
template <class OStream, class T> OStream &operator<<(OStream &os, const std::set<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <class OStream, class T> OStream &operator<<(OStream &os, const std::multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <class OStream, class T> OStream &operator<<(OStream &os, const std::unordered_multiset<T> &vec) { os << '{'; for (auto v : vec) os << v << ','; os << '}'; return os; }
template <class OStream, class T, class U> OStream &operator<<(OStream &os, const std::pair<T, U> &pa) { return os << '(' << pa.first << ',' << pa.second << ')'; }
template <class OStream, class TK, class TV> OStream &operator<<(OStream &os, const std::map<TK, TV> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
template <class OStream, class TK, class TV, class TH> OStream &operator<<(OStream &os, const std::unordered_map<TK, TV, TH> &mp) { os << '{'; for (auto v : mp) os << v.first << "=>" << v.second << ','; os << '}'; return os; }
#ifdef HITONANODE_LOCAL
const string COLOR_RESET = "\033[0m", BRIGHT_GREEN = "\033[1;32m", BRIGHT_RED = "\033[1;31m", BRIGHT_CYAN = "\033[1;36m", NORMAL_CROSSED = "\033[0;9;37m", RED_BACKGROUND = "\033[1;41m", NORMAL_FAINT = "\033[0;2m";
#define dbg(x) std::cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << ") " << __FILE__ << COLOR_RESET << std::endl
#define dbgif(cond, x) ((cond) ? std::cerr << BRIGHT_CYAN << #x << COLOR_RESET << " = " << (x) << NORMAL_FAINT << " (L" << __LINE__ << ") " << __FILE__ << COLOR_RESET << std::endl : std::cerr)
#else
#define dbg(x) ((void)0)
#define dbgif(cond, x) ((void)0)
#endif


int main() {
    int H, W;
    cin >> H >> W;
    vector A(H, vector<int>(W));
    cin >> A;

    vector<int> i2maxj(H, -1), j2maxi(W, -1);

    REP(i, H) REP(j, W) {
        if (A.at(i).at(j)) {
            chmax(i2maxj.at(i), j);
            chmax(j2maxi.at(j), i);
        }
    }

    vector cs(H + 1, vector<int>(W + 1));
    REP(i, H) REP(j, W) {
        cs.at(i + 1).at(j + 1) = cs.at(i + 1).at(j) + cs.at(i).at(j + 1) - cs.at(i).at(j) + A.at(i).at(j);
    }

    // [ilo, ihi) * [jlo, jhi)
    auto sum = [&](int ilo, int ihi, int jlo, int jhi) {
        return cs.at(ihi).at(jhi) - cs.at(ilo).at(jhi) - cs.at(ihi).at(jlo) + cs.at(ilo).at(jlo);
    };

    constexpr int inf = 1 << 27;
    vector dp(H + 1, vector<int>(W + 1, inf));

    IREP(x, dp.size()) IREP(y, dp.at(x).size()) {
        if (x >= H or y >= W or sum(x, H, y, W) == 0) {
            dp.at(x).at(y) = 0;
            continue;
        }

        vector<int> x2yhi = i2maxj;
        x2yhi.push_back(y);
        IFOR(i, 1, H + 1) chmax(x2yhi.at(i - 1), x2yhi.at(i));
        dbg(x2yhi);

        vector<int> xin_cs(H + 1);
        REP(i, H) xin_cs.at(i + 1) = xin_cs.at(i) + (sum(i, i + 1, y, W) > 0);

        vector<int> yin_cs(W + 1);
        REP(j, W) yin_cs.at(j + 1) = yin_cs.at(j) + (sum(x, H, j, j + 1) > 0);

        FOR(i, x, H) {
            const int j = x2yhi.at(i + 1);
            // if (sum(i + 1, H, j + 1, W)) continue;
            int s = (xin_cs.at(i + 1) - xin_cs.at(x)) * (yin_cs.at(j + 1) - yin_cs.at(y));
            s += dp.at(i + 1).at(y);
            s += dp.at(x).at(j + 1);
            chmin(dp.at(x).at(y), s);
        }
    }

    for (auto v : dp) dbg(v);

    int init = 0;
    for (auto v : A) init += accumulate(ALL(v), 0);

    cout << dp.at(0).at(0) - init << '\n';
}

詳細信息

Test #1:

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

input:

2 3
1 0 0
0 1 1

output:

1

result:

ok answer is '1'

Test #2:

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

input:

4 4
0 1 1 1
1 1 0 0
1 1 1 1
1 0 1 0

output:

2

result:

ok answer is '2'

Test #3:

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

input:

7 7
0 0 0 0 0 0 0
0 1 0 1 0 1 0
1 0 1 0 1 0 1
0 1 0 1 0 1 0
1 0 1 0 1 0 1
0 1 0 1 0 1 0
1 0 1 0 1 0 1

output:

18

result:

ok answer is '18'

Test #4:

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

input:

1 1
0

output:

0

result:

ok answer is '0'

Test #5:

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

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 1 0 1 1 1 0 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 1 0 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

7254

result:

ok answer is '7254'

Test #6:

score: 0
Accepted
time: 36ms
memory: 4480kb

input:

300 300
1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 0 1 0 1 0 0 1 0 0 0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 ...

output:

5967

result:

ok answer is '5967'

Test #7:

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

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 0 1 1 1 1 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 0 1 1 0 1 1 1 1 0 0 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 0 0 1 1 1 0 0 1 1 1 0 ...

output:

43169

result:

ok answer is '43169'

Test #8:

score: 0
Accepted
time: 102ms
memory: 4480kb

input:

300 300
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 0 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 1 0 0 1 1 1 1 0 0 1 0 1 0 1 0 1 1 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1 1 1 0 1 0 1 1 0 1 0 1 0 1 1 0 0 1 1 0 ...

output:

21832

result:

ok answer is '21832'

Test #9:

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

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 1 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 1 1 1 0 1 0 1 0 1 1 0 0 0 1 1 1 1 0 1 1 0 0 ...

output:

32815

result:

ok answer is '32815'

Test #10:

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

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 0 0 0 1 1 0 ...

output:

13379

result:

ok answer is '13379'

Test #11:

score: 0
Accepted
time: 53ms
memory: 4480kb

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 0 1 1 0 1 1 0 1 1 1 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 1 0 1 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 0 0 0 1 0 0 1 0 1 1 0 0 0 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 ...

output:

9968

result:

ok answer is '9968'

Test #12:

score: 0
Accepted
time: 185ms
memory: 4224kb

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 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 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 ...

output:

42158

result:

ok answer is '42158'

Test #13:

score: 0
Accepted
time: 44ms
memory: 4224kb

input:

300 300
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0 0 1 0 1 0 0 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 0 1 1 0 0 0 0 ...

output:

8275

result:

ok answer is '8275'

Test #14:

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

input:

300 300
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

0

result:

ok answer is '0'

Test #15:

score: 0
Accepted
time: 202ms
memory: 4480kb

input:

300 300
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 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 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:

0

result:

ok answer is '0'

Test #16:

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

input:

1 1
1

output:

0

result:

ok answer is '0'

Test #17:

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

input:

2 3
0 0 0
0 1 0

output:

0

result:

ok answer is '0'

Test #18:

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

input:

22 22
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 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:

0

result:

ok answer is '0'

Test #19:

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

input:

22 22
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 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 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:

0

result:

ok answer is '0'

Test #20:

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

input:

22 22
1 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 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 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:

0

result:

ok answer is '0'

Test #21:

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

input:

22 22
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 1 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 1 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 1 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 ...

output:

250

result:

ok answer is '250'

Test #22:

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

input:

22 22
1 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 1 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 1 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 1 0 0 0 0 0 0 0 0 ...

output:

231

result:

ok answer is '231'

Test #23:

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

input:

4 4
1 1 1 1
1 0 0 1
1 0 0 0
1 1 0 1

output:

1

result:

ok answer is '1'

Test #24:

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

input:

4 4
1 1 1 1
1 0 1 0
1 0 0 0
1 1 1 0

output:

1

result:

ok answer is '1'

Test #25:

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

input:

22 22
1 1 1 0 1 0 0 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1
1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 1 0
1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 0 1 1 1 0
0 0 0 1 1 0 0 0 0 1 0 1 1 1 0 0 1 0 0 1 1 0
0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 1 1 1 1 1 1
1 0 0 0 1 0 1 1 0 0 1 1 1 1 1 1 1 0 0 0 0 1
0 1 0 1 1 0 1 0 0 1 1 0 0 1 0 ...

output:

210

result:

ok answer is '210'

Test #26:

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

input:

22 22
1 1 1 0 0 0 1 1 1 0 0 0 0 1 1 0 1 0 1 1 1 1
1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1
0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 1 1 0 0 1 0 0
0 1 0 1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0
1 1 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0
1 0 0 0 0 1 1 0 1 1 0 0 1 1 0 0 0 1 0 0 0 0
1 1 0 0 1 0 0 1 1 0 0 1 1 0 1 ...

output:

194

result:

ok answer is '194'

Test #27:

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

input:

22 22
1 0 1 0 1 0 1 1 0 1 1 0 0 0 0 0 0 1 0 0 1 1
1 0 0 0 0 0 1 0 1 1 0 1 0 0 1 1 1 1 0 0 0 1
0 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 1 1 1 0 0 0
1 1 0 1 0 0 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 0
1 0 1 0 0 1 0 1 1 0 0 1 1 1 1 0 1 0 0 1 0 1
0 1 0 1 1 0 0 1 0 1 1 0 1 0 1 1 0 0 1 0 0 0
0 1 1 0 1 0 0 0 0 1 0 1 0 0 0 ...

output:

227

result:

ok answer is '227'

Test #28:

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

input:

22 22
1 0 1 0 0 1 1 1 0 1 0 0 1 1 0 0 0 1 0 1 1 1
0 0 0 0 1 1 0 1 1 0 1 0 1 0 0 0 1 0 0 0 1 1
1 0 1 1 1 1 0 1 0 1 0 1 0 1 1 1 0 1 1 0 1 0
1 1 0 0 1 1 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 1
0 0 0 0 1 1 0 0 0 0 1 0 1 0 1 1 0 1 0 1 1 0
1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 1
0 1 0 1 1 1 0 1 0 1 0 1 1 0 0 ...

output:

233

result:

ok answer is '233'

Test #29:

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

input:

22 22
0 1 1 0 0 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 1 1
1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 0 1 0 0 0 0 1
0 0 1 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0
0 1 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1 1
1 1 1 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 1 0 0
0 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 1 1 1 0 0
0 0 0 1 0 1 0 1 0 0 0 1 0 0 1 ...

output:

192

result:

ok answer is '192'

Test #30:

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

input:

22 22
1 1 0 0 1 1 1 0 0 1 0 1 1 1 0 0 1 1 0 0 1 1
1 0 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 0 1 1 0
0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 1 0 0 1 1 1 0 0 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0
0 0 0 0 1 0 1 0 1 1 0 1 1 1 0 1 0 0 1 0 0 1
0 1 0 1 0 1 1 1 1 1 1 1 0 1 1 ...

output:

233

result:

ok answer is '233'

Test #31:

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

input:

22 22
1 1 0 1 1 1 0 1 0 0 1 1 1 0 0 1 1 0 1 1 0 1
1 1 1 1 0 1 1 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1
0 0 1 0 1 0 0 1 0 1 1 1 1 0 0 0 0 0 1 0 1 0
1 1 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 0 0 1 0 0
0 1 1 0 1 1 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0
0 1 1 1 1 1 0 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 0 0 1 0 1 0 ...

output:

211

result:

ok answer is '211'

Test #32:

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

input:

22 22
1 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 1 1
1 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0
1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0
0 0 1 1 1 0 1 0 0 1 0 1 1 0 0 0 0 0 1 0 0 0
1 1 1 0 1 1 1 1 0 0 1 1 1 0 1 0 1 0 1 0 1 1
1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1
1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 ...

output:

194

result:

ok answer is '194'

Test #33:

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

input:

22 22
1 1 0 1 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 0 1
1 0 0 0 1 1 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 0
0 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 1 0 0 0
0 0 0 1 0 1 1 1 1 1 0 0 1 1 0 1 0 0 0 0 1 1
1 0 0 1 0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 1 0 0
0 0 1 0 1 0 0 1 1 1 0 0 0 1 1 0 0 0 1 0 0 1
1 0 0 1 0 1 1 0 0 0 0 0 0 0 1 ...

output:

228

result:

ok answer is '228'

Test #34:

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

input:

22 22
1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 0 1 0 0
1 1 1 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 1 0
1 1 1 0 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 0 0 1
1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 0 0 1 0 0
1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 1 1 0
1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1
1 0 1 0 1 1 1 1 1 1 0 1 1 1 1 ...

output:

154

result:

ok answer is '154'

Test #35:

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

input:

22 22
1 1 1 0 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0
1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 0 0 0 0 0 0
1 1 0 0 1 1 1 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0
1 1 1 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 0 0
1 1 1 1 1 1 1 0 0 0 1 0 1 1 1 1 1 0 1 1 1 0
1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0
1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 ...

output:

98

result:

ok answer is '98'

Test #36:

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

input:

22 22
1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0
1 1 1 0 1 1 1 0 1 1 0 1 0 0 0 0 0 0 0 0 0 0
1 1 0 1 1 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 1 1 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
1 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 0 1 0 1 0 0 0 0 0 0 0 0 0 ...

output:

36

result:

ok answer is '36'

Test #37:

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

input:

22 22
1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 0 0 0 0 0 0
0 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 0 1 0 0 0 1
1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 0 1 0 0 1 0 1
1 1 1 1 1 1 0 1 1 1 1 1 1 0 0 1 1 1 1 0 0 0
1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 0 1 0 1 1 0 0 0 1 0 1 0 1 0
1 1 0 1 1 0 0 0 0 1 0 0 0 0 0 ...

output:

120

result:

ok answer is '120'

Test #38:

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

input:

22 22
1 1 1 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 0 0 0 1
1 1 1 1 1 0 1 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0
1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0
1 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 0 0 0 0
1 1 1 1 0 1 1 1 0 1 0 0 0 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 0 0 0 0 1 1
1 0 1 1 1 1 0 0 0 0 1 1 0 0 1 ...

output:

95

result:

ok answer is '95'

Test #39:

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

input:

22 22
1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0
1 1 1 0 1 0 1 0 0 1 0 1 1 0 0 1 0 1 1 0 0 0
1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 0 0 1 0 1 0 1
1 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 0 0 1 1 1 0
1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0 1 0 0 0 1 0
1 1 0 0 1 1 1 0 0 1 1 0 1 0 1 0 0 0 0 0 0 1
1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 ...

output:

140

result:

ok answer is '140'

Test #40:

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

input:

22 22
1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 0 0
1 1 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 0 1 0 0 0 0
1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0
1 1 1 0 0 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0
1 1 1 0 0 1 1 1 0 0 0 0 0 1 0 ...

output:

69

result:

ok answer is '69'

Test #41:

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

input:

22 22
1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 0 0 0 0 0 0
1 1 1 1 1 1 0 0 1 0 0 0 1 1 0 0 0 0 0 0 0 0
1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 1 1 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0
0 1 0 1 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0
1 1 0 1 1 1 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0
1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 ...

output:

47

result:

ok answer is '47'

Test #42:

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

input:

22 22
1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 0 1
1 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 0 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 1 0
1 0 1 1 1 1 0 1 1 1 1 0 1 0 1 0 1 0 1 0 0 1
1 1 0 0 1 1 1 1 1 1 0 0 1 1 0 1 0 0 1 0 0 1
1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 ...

output:

163

result:

ok answer is '163'

Test #43:

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

input:

22 22
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 1 1 1 1 1 1 1 1 0 1
1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 ...

output:

107

result:

ok answer is '107'

Test #44:

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

input:

22 22
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 0 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0
1 0 0 1 0 1 1 0 0 1 0 0 1 0 1 0 0 1 1 1 1 0
1 1 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
1 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 ...

output:

8

result:

ok answer is '8'

Test #45:

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

input:

22 22
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 0 1 1 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1
1 1 1 1 0 1 1 0 1 1 1 0 1 1 1 0 1 0 0 1 1 0
1 1 0 1 0 1 1 0 1 1 0 0 0 0 1 1 1 0 1 0 1 1
1 1 1 0 0 0 1 0 1 0 1 1 0 1 0 1 1 1 1 1 1 0
1 1 1 1 1 1 1 0 1 0 0 0 1 1 0 ...

output:

94

result:

ok answer is '94'

Test #46:

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

input:

22 22
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 0 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 1 1
1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1
1 1 1 1 0 1 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1
1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 1 0 1 0 0
1 1 1 1 1 1 0 0 0 1 0 1 1 0 0 ...

output:

107

result:

ok answer is '107'

Test #47:

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

input:

22 22
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 0 1 1 1 1 1
1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0
1 1 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 0 1 1 0 1 1 1 0 1 1 1 0 1 1 0 1 1
1 1 1 1 1 1 0 1 0 1 1 0 0 1 0 1 1 1 1 0 0 1
1 1 1 0 1 1 0 0 1 0 0 1 0 0 1 ...

output:

66

result:

ok answer is '66'

Test #48:

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

input:

22 22
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 0 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1
1 0 0 0 0 0 1 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 1 1 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 ...

output:

5

result:

ok answer is '5'

Test #49:

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

input:

22 22
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 0 1 1 1 1 0 1 1 1 1
1 1 1 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 0 1 1 1 1 1 1 1
1 1 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 0
1 1 0 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 0 1 0 1
1 1 1 1 1 1 0 1 1 0 1 1 1 1 1 ...

output:

107

result:

ok answer is '107'

Test #50:

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

input:

22 22
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 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0
1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1
1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 0
1 1 1 0 1 0 0 1 1 1 1 0 0 1 1 ...

output:

112

result:

ok answer is '112'

Test #51:

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

input:

22 22
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 0 1 1 1 0 1 1 1 0 0 1 1 1 1 0 1 1 1
1 0 0 1 1 0 1 0 1 1 1 0 0 0 0 1 0 1 1 0 1 0
1 1 0 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 1 1 0 1
1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0
1 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 0 0 0 0 0 0 0 0 0 0 ...

output:

27

result:

ok answer is '27'

Test #52:

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

input:

100 100
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 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 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:

2951

result:

ok answer is '2951'

Test #53:

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

input:

100 100
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 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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 ...

output:

2925

result:

ok answer is '2925'

Test #54:

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

input:

100 100
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 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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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:

0

result:

ok answer is '0'

Test #55:

score: 0
Accepted
time: 43ms
memory: 4096kb

input:

200 200
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 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 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:

9860

result:

ok answer is '9860'

Test #56:

score: 0
Accepted
time: 47ms
memory: 4224kb

input:

200 200
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 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 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:

10374

result:

ok answer is '10374'

Test #57:

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

input:

200 200
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 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 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:

591

result:

ok answer is '591'

Test #58:

score: 0
Accepted
time: 94ms
memory: 4480kb

input:

250 250
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 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 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:

17436

result:

ok answer is '17436'

Test #59:

score: 0
Accepted
time: 114ms
memory: 4352kb

input:

250 250
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 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 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:

21319

result:

ok answer is '21319'

Test #60:

score: 0
Accepted
time: 113ms
memory: 4480kb

input:

250 250
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 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 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:

21529

result:

ok answer is '21529'

Test #61:

score: 0
Accepted
time: 201ms
memory: 4480kb

input:

300 300
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 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 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:

30999

result:

ok answer is '30999'

Test #62:

score: 0
Accepted
time: 55ms
memory: 4480kb

input:

300 300
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 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 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:

6040

result:

ok answer is '6040'

Test #63:

score: 0
Accepted
time: 185ms
memory: 4480kb

input:

300 300
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 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 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:

29023

result:

ok answer is '29023'

Test #64:

score: 0
Accepted
time: 187ms
memory: 4480kb

input:

300 300
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 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 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:

29080

result:

ok answer is '29080'

Test #65:

score: 0
Accepted
time: 202ms
memory: 4480kb

input:

300 300
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 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 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:

30944

result:

ok answer is '30944'

Test #66:

score: 0
Accepted
time: 141ms
memory: 4224kb

input:

300 300
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 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 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:

20984

result:

ok answer is '20984'

Test #67:

score: 0
Accepted
time: 201ms
memory: 4224kb

input:

300 300
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 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 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:

31247

result:

ok answer is '31247'

Test #68:

score: 0
Accepted
time: 66ms
memory: 4480kb

input:

300 300
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 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 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:

8014

result:

ok answer is '8014'

Test #69:

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

input:

300 300
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 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 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:

21539

result:

ok answer is '21539'