QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#534362 | #9224. Express Eviction | rogi52 | AC ✓ | 11ms | 6312kb | C++20 | 15.8kb | 2024-08-27 04:56:48 | 2024-08-27 04:56:48 |
Judging History
answer
#line 2 "cp-library/src/cp-template.hpp"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
using i32 = int;
using u32 = unsigned int;
using i64 = long long;
using u64 = unsigned long long;
using i128 = __int128_t;
template < class T > bool chmin(T& a, T b) { if(a > b) { a = b; return true; } return false; }
template < class T > bool chmax(T& a, T b) { if(a < b) { a = b; return true; } return false; }
template < class T, class U > T ceil (T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); }
template < class T, class U > T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); }
int popcnt(i32 x) { return __builtin_popcount(x); }
int popcnt(u32 x) { return __builtin_popcount(x); }
int popcnt(i64 x) { return __builtin_popcountll(x); }
int popcnt(u64 x) { return __builtin_popcountll(x); }
#line 2 "cp-library/src/utility/rep_itr.hpp"
template < class T > struct itr_rep {
T i, d;
constexpr itr_rep(const T i) noexcept : i(i), d(1) {}
constexpr itr_rep(const T i, const T d) noexcept : i(i), d(d) {}
void operator++() noexcept { i += d; }
constexpr int operator*() const noexcept { return i; }
constexpr bool operator!=(const itr_rep x) const noexcept { return d > 0 ? i < x.i : i > x.i; }
};
template < class T > struct rep {
const itr_rep< T > s, t;
constexpr rep(const T t) noexcept : s(0), t(t) {}
constexpr rep(const T s, const T t) noexcept : s(s), t(t) {}
constexpr rep(const T s, const T t, const T d) noexcept : s(s, d), t(t, d) {}
constexpr auto begin() const noexcept { return s; }
constexpr auto end () const noexcept { return t; }
};
template < class T > struct revrep {
const itr_rep < T > s, t;
constexpr revrep(const T t) noexcept : s(t - 1, -1), t(-1, -1) {}
constexpr revrep(const T s, const T t) noexcept : s(t - 1, -1), t(s - 1, -1) {}
constexpr revrep(const T s, const T t, const T d) noexcept : s(t - 1, -d), t(s - 1, -d) {}
constexpr auto begin() const noexcept { return s; }
constexpr auto end () const noexcept { return t; }
};
#line 3 "cp-library/src/utility/io.hpp"
/* 128bit integer */
istream& operator>>(istream& is, i128& x) {
std::string s; is >> s;
int pm = (s[0] == '-');
x = 0;
for(int i : rep(pm, int(s.size()))) x = x * 10 + (s[i] - '0');
if(pm) x *= -1;
return is;
}
ostream& operator<<(ostream& os, const i128& x) {
if(x == 0) return os << '0';
i128 y = x;
if(y < 0) { os << '-'; y *= -1; }
std::vector<int> ny;
while(y > 0) { ny.push_back(y % 10); y /= 10; }
for(int i : revrep(ny.size())) os << ny[i];
return os;
}
template < class S, class T > istream& operator>>(istream& is, std::pair< S, T >& x) { is >> x.first >> x.second; return is; }
template < class S, class T > ostream& operator<<(ostream& os, const std::pair< S, T >& x) { os << x.first << " " << x.second; return os; }
namespace scanner {
struct sca {
template < class T > operator T() {
T s; std::cin >> s; return s;
}
};
struct vec {
int n;
vec(int n) : n(n) {}
template < class T > operator std::vector< T >() {
std::vector< T > v(n);
for(T& x : v) std::cin >> x;
return v;
}
};
struct mat {
int h, w;
mat(int h, int w) : h(h), w(w) {}
template < class T > operator std::vector< std::vector< T > >() {
std::vector m(h, std::vector< T >(w));
for(std::vector< T >& v : m) for(T& x : v) std::cin >> x;
return m;
}
};
struct speedup {
speedup() {
std::cin.tie(0);
std::ios::sync_with_stdio(0);
}
} speedup_instance;
}
scanner::sca in() { return scanner::sca(); }
scanner::vec in(int n) { return scanner::vec(n); }
scanner::mat in(int h, int w) { return scanner::mat(h, w); }
namespace printer {
void precision(int d) { std::cout << std::fixed << std::setprecision(d); }
void flush() { std::cout.flush(); }
}
template < class T >
ostream& operator<<(ostream& os, const std::vector< T > a) {
int n = a.size();
for(int i : rep(n)) { os << a[i]; if(i != n - 1) os << ' '; }
return os;
}
int print() { std::cout << '\n'; return 0; }
template < class head, class... tail > int print(head&& h, tail&&... t) {
std::cout << h; if(sizeof...(tail)) std::cout << ' ';
return print(std::forward<tail>(t)...);
}
template < class T > int print_n(const std::vector< T > a) {
int n = a.size();
for(int i : rep(n)) std::cout << a[i] << "\n";
return 0;
}
#line 2 "cp-library/src/utility/key_val.hpp"
template < class K, class V >
struct key_val {
K key; V val;
key_val() {}
key_val(K key, V val) : key(key), val(val) {}
template < std::size_t Index >
std::tuple_element_t< Index, key_val >& get() {
if constexpr (Index == 0) return key;
if constexpr (Index == 1) return val;
}
};
namespace std {
template < class K, class V > struct tuple_size < key_val< K, V > > : integral_constant< size_t, 2 > {};
template < class K, class V > struct tuple_element < 0, key_val< K, V > > { using type = K; };
template < class K, class V > struct tuple_element < 1, key_val< K, V > > { using type = V; };
}
#line 2 "cp-library/src/utility/vec_op.hpp"
template < class T > key_val< int, T > max_of(const vector< T >& a) {
int i = std::max_element(a.begin(), a.end()) - a.begin();
return {i, a[i]};
}
template < class T > key_val< int, T > min_of(const vector< T >& a) {
int i = std::min_element(a.begin(), a.end()) - a.begin();
return {i, a[i]};
}
template < class S, class T > S sum_of(const vector< T >& a) {
S sum = 0;
for(const T x : a) sum += x;
return sum;
}
template < class S, class T > vector< S > freq_of(const vector< T >& a, T L, T R) {
vector< S > res(R - L, S(0));
for(const T x : a) res[x - L] += 1;
return res;
}
template < class S, class T > struct prefix_sum {
vector< S > s;
prefix_sum(const vector< T >& a) : s(a) {
s.insert(s.begin(), S(0));
for(int i : rep(a.size())) s[i + 1] += s[i];
}
// [L, R)
S sum(int L, int R) { return s[R] - s[L]; }
};
#line 3 "cp-library/src/utility/heap.hpp"
template < class T > using heap_min = std::priority_queue< T, std::vector< T >, std::greater< T > >;
template < class T > using heap_max = std::priority_queue< T, std::vector< T >, std::less< T > >;
#line 27 "cp-library/src/cp-template.hpp"
#line 1 "cp-library/src/algorithm/bin_search.hpp"
template < class T, class F >
T bin_search(T ok, T ng, F f) {
while(abs(ng - ok) > 1) {
T mid = (ok + ng) / 2;
(f(mid) ? ok : ng) = mid;
}
return ok;
}
template < class T, class F >
T bin_search_real(T ok, T ng, F f, int step = 80) {
while(step--) {
T mid = (ok + ng) / 2;
(f(mid) ? ok : ng) = mid;
}
return ok;
}
#line 2 "cp-library/src/algorithm/argsort.hpp"
template < class T > std::vector< int > argsort(const std::vector< T > &a) {
std::vector< int > ids((int)a.size());
std::iota(ids.begin(), ids.end(), 0);
std::sort(ids.begin(), ids.end(), [&](int i, int j) {
return a[i] < a[j] || (a[i] == a[j] && i < j);
});
return ids;
}
#line 1 "macro.hpp"
namespace macro {
using size_type = int;
template < class container > void sort(container& a) { std::sort(std:: begin(a), std:: end(a)); }
template < class container > void rsort(container& a) { std::sort(std::rbegin(a), std::rend(a)); }
template < class container > void reverse(container& a) { std::reverse(std::begin(a), std::end(a)); }
template < class container > void unique(container& a) {
std::sort(std::begin(a), std::end(a));
a.erase(std::unique(std::begin(a), std::end(a)), std::end(a));
}
template < class container > container sorted(const container& a) { container b = a; sort(b); return std::move(b); }
template < class container > container rsorted(const container& a) { container b = a; rsort(b); return std::move(b); }
template < class container, class compare > void sort(container& a, const compare& cmp) { std::sort(std::begin(a), std::end(a), cmp); }
template < class container, class compare > container sorted(const container& a, const compare& cmp) { container b = a; sort(b, cmp); return std::move(b); }
template < class container, class value > size_type lower_bound(const container& a, const value& x) { return std::lower_bound(std::begin(a), std::end(a), x) - std::begin(a); }
template < class container, class value > size_type upper_bound(const container& a, const value& x) { return std::upper_bound(std::begin(a), std::end(a), x) - std::begin(a); }
const std::vector<std::pair<size_type, size_type>> dir4 = { {+1, 0}, {-1, 0}, { 0, +1}, { 0, -1} };
const std::vector<std::pair<size_type, size_type>> dir8 = { {-1, -1}, {-1, 0}, {-1, +1}, { 0, -1}, { 0, +1}, {+1, -1}, {+1, 0}, {+1, +1} };
#ifdef _DEBUG
#define debug(x) std::cout << "[" << __LINE__ << "] " << #x << ": " << x << std::endl
#else
#define debug(x)
#endif
template < class container > void concat(container& a, const container& b) {
a.insert(std::end(a), std::begin(b), std::end(b));
}
std::vector<size_type> iota(const size_type n) {
std::vector<size_type> I(n);
std::iota(std::begin(I), std::end(I), 0);
return I;
}
template < class container > std::vector<size_type> sort_idx(const container& a) {
const size_type n = a.size();
std::vector<size_type> I = iota(n);
std::sort(std::begin(I), std::end(I), [&](size_type i, size_type j) { return a[i] < a[j] or (a[i] == a[j] and i < j); });
return I;
}
template < class container, class compare > std::vector<size_type> sort_idx(const container& a, const compare& cmp) {
const size_type n = a.size();
std::vector<size_type> I = iota(n);
std::sort(std::begin(I), std::end(I), [&](size_type i, size_type j) { return cmp(a[i], a[j]) or (a[i] == a[j] and i < j); });
return std::move(I);
}
struct grid {
using size_type = int;
size_type H, W;
grid(const size_type H, const size_type W) : H(H), W(W) {}
bool contains(const size_type i, const size_type j) {
return 0 <= i and i < H and 0 <= j and j < W;
}
};
using f64 = long double;
template < class T > vector< T >& operator++(vector< T >& a) { for(T& x : a) x++; return a; }
template < class T > vector< T >& operator--(vector< T >& a) { for(T& x : a) x--; return a; }
template < class T > vector< T > operator++(vector< T >& a, signed) { vector< T > res = a; for(T& x : a) x++; return res; }
template < class T > vector< T > operator--(vector< T >& a, signed) { vector< T > res = a; for(T& x : a) x--; return res; }
} // namespace macro
using namespace macro;
#line 1 "cp-library/src/graph/max_flow.hpp"
template < class Cap > struct mf_graph {
public:
explicit mf_graph(int n) : n(n), g(n) {}
int add_edge(int from, int to, Cap cap) {
assert(0 <= from and from < n);
assert(0 <= to and to < n);
assert(0 <= cap);
int m = pos.size();
pos.push_back({from, g[from].size()});
int from_id = g[from].size();
int to_id = g[to].size() + (from == to);
g[from].push_back(_edge{to, to_id, cap});
g[to].push_back(_edge{from, from_id, 0});
return m;
}
struct edge {
int from, to; Cap cap, flow;
};
edge get_edge(int i) {
int m = pos.size();
assert(0 <= i and i < m);
_edge e = g[pos[i].first][pos[i].second];
_edge r = g[e.to][e.rev];
return edge{pos[i].first, e.to, e.cap + r.cap, r.cap};
}
vector<edge> edges() {
int m = pos.size();
vector<edge> res(m);
for(int i : rep(m)) res[i] = get_edge(i);
return res;
}
void change_edge(int i, Cap cap, Cap flow) {
int m = pos.size();
assert(0 <= i and i < m);
assert(0 <= flow and flow <= cap);
_edge& e = g[pos[i].first][pos[i].second];
_edge& r = g[e.to][e.rev];
e.cap = cap - flow;
r.cap = flow;
}
Cap flow(int s, int t, Cap flow_limit) {
assert(0 <= s and s < n);
assert(0 <= t and t < n);
assert(s != t);
vector<int> level(n), iter(n);
auto bfs = [&]() {
fill(level.begin(), level.end(), -1);
level[s] = 0;
queue<int> q;
q.push(s);
while(not q.empty()) {
int v = q.front(); q.pop();
for(_edge e : g[v]) {
if(e.cap == 0 or level[e.to] >= 0) continue;
level[e.to] = level[v] + 1;
if(e.to == t) return;
q.push(e.to);
}
}
};
auto dfs = [&](auto self, int v, Cap up) {
if(v == s) return up;
Cap res = 0;
int level_v = level[v];
for(int& i = iter[v]; i < int(g[v].size()); i++) {
_edge& e = g[v][i];
if(level_v <= level[e.to] or g[e.to][e.rev].cap == 0) continue;
Cap d = self(self, e.to, min(up - res, g[e.to][e.rev].cap));
if(d <= 0) continue;
g[v][i].cap += d;
g[e.to][e.rev].cap -= d;
res += d;
if(res == up) return res;
}
level[v] = n;
return res;
};
Cap flow = 0;
while(flow < flow_limit) {
bfs();
if(level[t] == -1) break;
fill(iter.begin(), iter.end(), 0);
Cap f = dfs(dfs, t, flow_limit - flow);
if(f == 0) break;
flow += f;
}
return flow;
}
Cap flow(int s, int t) {
return flow(s, t, numeric_limits<Cap>::max());
}
vector<int> min_cut(int s) {
vector<int> visited(n, 0);
queue<int> q;
q.push(s);
while(not q.empty()) {
int p = q.front(); q.pop();
visited[p] = 1;
for(_edge e : g[p]) {
if(e.cap && not visited[e.to]) {
visited[e.to] = 1;
q.push(e.to);
}
}
}
return visited;
}
private:
int n;
struct _edge {
int to, rev; Cap cap;
};
vector<pair<int,int>> pos;
vector<vector<_edge>> g;
};
#line 4 "A.cpp"
int main() {
int H = in(), W = in();
vector<string> A = in(H);
mf_graph<i64> g(1 + H * W * 3 + 1);
const int S = H * W * 3;
const int T = H * W * 3 + 1;
const int INF = 1e9;
for(int i : rep(H)) for(int j : rep(W)) {
int x = i * W + j;
int y = x + H * W;
int z = y + H * W;
if(A[i][j] == '#') {
if(i == 0 or j == W - 1) g.add_edge(S, x, INF);
if(i == H - 1 or j == 0) g.add_edge(z, T, INF);
g.add_edge(x, y, 1);
g.add_edge(y, z, 1);
for(int di : {-1, 0, +1}) for(int dj : {-1, 0, +1}) {
if(di == 0 and dj == 0) continue;
int ni = i + di, nj = j + dj;
if(0 <= ni and ni < H and 0 <= nj and nj < W) {
int nx = ni * W + nj;
int ny = nx + H * W;
int nz = ny + H * W;
g.add_edge(z, ny, INF);
g.add_edge(ny, x, INF);
}
}
} else {
g.add_edge(x, y, 0);
g.add_edge(y, z, 0);
}
g.add_edge(y, x, INF);
g.add_edge(z, y, INF);
}
print(g.flow(S, T));
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
4 6 .##... .#.... ##.... ....#.
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 1ms
memory: 4192kb
input:
20 30 ...########################### #..########################### ...########################### ...########################### .############################# ...########################### ...########################### #..########################### ...########################### ..#...............
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 2ms
memory: 4584kb
input:
35 35 ....###########...#########........ ##..#######################..#####. ....#######################..#####. ...#.....##################..#####. .##......##################.....##. .##..##..#############.....#....##. .....##..#############......##..##. ....#....#############..##..##..##. ####.....
output:
16
result:
ok 1 number(s): "16"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
30 20 .#..........##...... ..#......#..##...... .......#..........#. ..#......#..##...... .....#......#....... .#.........#........ ......#...#......... ..#..##..#...#...... ......#.......#..... ..#....#............ ........#..#.#...... ....##..#........... .........#.#.......# ........##.......... ...
output:
5
result:
ok 1 number(s): "5"
Test #5:
score: 0
Accepted
time: 4ms
memory: 4840kb
input:
50 45 ...##................##...................#.. ...#......#.#..........#.#.....####....#....# ....#.....#..............#..#..##......##..#. .....#......######........#.............#.... ......##...#...##...##.......#....#..#...##.. ...#..##.....##...###.............#..##.....# ...#......########...
output:
24
result:
ok 1 number(s): "24"
Test #6:
score: 0
Accepted
time: 2ms
memory: 4660kb
input:
50 45 ...#...................#.####................ ...........................#......###.#..##.. ..#.#........##.##....#....#................. .....#.....#.##.#.#.........#................ ...........#.#.#.#.##....#.#.......##.#..#... ...#......#...#####......#...##.##........#.. ............####.....
output:
23
result:
ok 1 number(s): "23"
Test #7:
score: 0
Accepted
time: 2ms
memory: 5072kb
input:
50 50 ##................................................ #################################################. ####.............................................. ####.............................................. ####..############################################ ####......................................
output:
7
result:
ok 1 number(s): "7"
Test #8:
score: 0
Accepted
time: 11ms
memory: 5560kb
input:
50 50 #.##.##..###...#######.##..#####.#...######.###### .####.##.##.#############.#.#.###.##.###.#.#.###.# ...####.##########.###.####.#.####.#############.. #.#..########.#.#####.#..#.##....##########.#.#### ###.##.####.###.#######..##.#####...##.#######..#. #####.########..########..#######.##.#....
output:
72
result:
ok 1 number(s): "72"
Test #9:
score: 0
Accepted
time: 1ms
memory: 4360kb
input:
50 50 .................................................. .................................................. .................................................. .................................................. .................................................. ..........................................
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 3ms
memory: 5396kb
input:
43 50 ...........####################################### #########...###################################### #########...####....############################## ##########..#........############################# ##########...........############################# #####.....#....####...##########......#...
output:
5
result:
ok 1 number(s): "5"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
8 13 .##.......... .##..#######. .##......#.#. ...#.....#.#. ....###..#.#. ##..###..#.#. ##.......#.#. ##.......#.#.
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3984kb
input:
36 25 ##....................... ......................... #........................ ......................... ......................... ......................... ......................... ......................... ......................... ..................#.....# ..............#.#..#..#.. ...........
output:
7
result:
ok 1 number(s): "7"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
30 20 ...............#.... .#......#...#.....#. .#...##..####..#..#. ...............#..#. .....##.##.##....... ....#........#...... ..#.#.........#..... .#.##......#..#..##. #.#........#........ ##.#.##.....#....... .......#.....####### ##......#.#......##. ....##..#....#..##.# #...##..###..#...#.# ...
output:
6
result:
ok 1 number(s): "6"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1 50 ....#.#####.########.#.#...##..#..#..##.....##.#..
output:
25
result:
ok 1 number(s): "25"
Test #15:
score: 0
Accepted
time: 3ms
memory: 5972kb
input:
50 50 ....############################################## ##..############################################## ....############################################## ...#....########################################## ..#.....########################################## .....#..###############################...
output:
22
result:
ok 1 number(s): "22"
Test #16:
score: 0
Accepted
time: 2ms
memory: 5440kb
input:
40 50 ...###############################................ .....#############################...############. ##....############################..#############. ###...############################...############. ####...###########################...############. #####...###########################..##...
output:
9
result:
ok 1 number(s): "9"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
8 13 .##.......... .##..#######. .##......###. ...#.....###. ....###..###. ##..###..###. ##.......###. ##.......###.
output:
1
result:
ok 1 number(s): "1"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
10 15 ...#........... ............... .#............. ...#........... ......#.#.....# .....#.....#### ....#.....#.... ...#...#.#..... ...#........#.. ...##.......#..
output:
2
result:
ok 1 number(s): "2"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
50 3 .## .#. #.. ..# ..# #.. ### ... ### ... ### ##. ... ... ##. .#. #.. ... ##. ... #.. ..# ..# ..# ##. ..# ..# #.. .## ... ##. ..# ... ... ### ..# .#. #.# #.. .#. ### ### #.# #.# ### ..# ### ... #.. ..#
output:
21
result:
ok 1 number(s): "21"
Test #20:
score: 0
Accepted
time: 0ms
memory: 5736kb
input:
50 50 .##...#..########################......########### #######..########################......########### #######..########################..##..########### #######..########################..##.........#### ####.....########################....#.........### ####....#.....##############.....#....#...
output:
29
result:
ok 1 number(s): "29"
Test #21:
score: 0
Accepted
time: 1ms
memory: 4036kb
input:
20 30 .....####......####........... ###..####..##..####..########. ###..####..##.....#..####..##. .....####....#....#..####..##. ....#....#....##.....##....... .###......##..##.....##....... .###..##..##..#########..##### .###..##..##..######.....##### ......##..##..######....#..... .....#....##..#...
output:
6
result:
ok 1 number(s): "6"
Test #22:
score: 0
Accepted
time: 1ms
memory: 4188kb
input:
25 36 ....###########....................# ##..#############...##########....## ....#############....########....### ...#.....#########...########...#### .##......##########....######..##### .##..##..##########.....#####..##### .....##..###########......###....... ....#....#############.......#........
output:
11
result:
ok 1 number(s): "11"
Test #23:
score: 0
Accepted
time: 0ms
memory: 4888kb
input:
50 50 ##................................................ #################################################. ####.............................................. ####.............................................. ####..############################################ ####......................................
output:
3
result:
ok 1 number(s): "3"
Test #24:
score: 0
Accepted
time: 10ms
memory: 6312kb
input:
50 50 ################################################## ################################################## ################################################## ################################################## ################################################## #######################################...
output:
99
result:
ok 1 number(s): "99"
Test #25:
score: 0
Accepted
time: 1ms
memory: 4524kb
input:
50 50 ................#.....#....#..........#..#..#....# #...........#........#..................#......... ....#......#....#..........#...................... #...............#.##.....#..#...#.#.#.#...#...#... .........#..#..............#...........#....#..... .......##.....#.........##....##..........
output:
0
result:
ok 1 number(s): "0"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
4 2 #. #. ## ..
output:
2
result:
ok 1 number(s): "2"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
1 1 .
output:
0
result:
ok 1 number(s): "0"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
4 6 .##... .#.... ##.... ....#.
output:
1
result:
ok 1 number(s): "1"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
4 3 .## ### .#. #.#
output:
3
result:
ok 1 number(s): "3"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
2 2 .# #.
output:
1
result:
ok 1 number(s): "1"
Test #31:
score: 0
Accepted
time: 1ms
memory: 4568kb
input:
25 36 ....################################ ##..################################ ....################################ ...#.....########################### .##......########################### .##..##..########################### .....##..########################### ....#....##########################...
output:
10
result:
ok 1 number(s): "10"
Test #32:
score: 0
Accepted
time: 5ms
memory: 4908kb
input:
50 50 ..#.#####....##...#..##.##....###....##.##.####.#. ..#######...#..###..#....#..##..###.....##...#...# ..#.#..#........#..####..#######.##...##.###..#.#. ###.....#......#..#.##.#....##..#.#............... ....##.##...#.#....#.#####.......#..#.....##...##. ###..#..##..#..#.#...##..........#........
output:
29
result:
ok 1 number(s): "29"
Test #33:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
6 10 .##.....## .##..#.... .##...#... ...#...##. ....#..##. ##.....##.
output:
2
result:
ok 1 number(s): "2"
Test #34:
score: 0
Accepted
time: 1ms
memory: 3956kb
input:
18 13 #..#..#.#..#. ...#....##.## ###...#.#.... .###...#.#.#. ...###..#.#.. ..#.....####. ##...####.... ..####.#..... #####...#.... ..##.##....## .#....#..##.# #..#......### #.#.##...###. #..##.......# #.####..#...# #.#.#...#...# ...#.#.##.### ...#.#.###..#
output:
11
result:
ok 1 number(s): "11"
Test #35:
score: 0
Accepted
time: 2ms
memory: 5204kb
input:
45 50 ....#######...##################.......###........ ##..#######....#################..##...###..#####. ....########...#################..##..####..#####. ...#.....###############.....###..##........#####. .##......###############.....###....#......#....#. .##..##..###############..#.....#....##...
output:
24
result:
ok 1 number(s): "24"
Test #36:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
5 10 ..#.#.#.#. .#.####.#. ##...#...# ######.##. .###.###.#
output:
6
result:
ok 1 number(s): "6"
Test #37:
score: 0
Accepted
time: 0ms
memory: 5120kb
input:
45 50 ....#################...############......######## ##..#################...########............###### ....##################...###.........####....##### ...#.....############.....#......#########...##### .##......############..#......#############...#### .##..##..############...#..#..#########...
output:
24
result:
ok 1 number(s): "24"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3640kb
input:
1 1 #
output:
1
result:
ok 1 number(s): "1"
Test #39:
score: 0
Accepted
time: 1ms
memory: 4588kb
input:
25 36 .....#################.............. ###..#################...##########. .....#################...##########. ....#......###########....#########. .###.......############........####. .###..###..#############........###. .###..###..##################...###. ......###..###################..###...
output:
8
result:
ok 1 number(s): "8"
Test #40:
score: 0
Accepted
time: 8ms
memory: 5068kb
input:
50 50 .#..#..##..#......####...##....##.##...###....#..# .....#.#..###....##..#####..##..###.##.##.#.#.#.## #.#..##.#..#....##..#..##...#.##..#########.#.##.# ###...#.#....##..##.###....#.##..#...####.#.####.# .#.#.#.#...#..#####.#.##..##.#.##..##.#....#####.. #.##.#.#####....###.###.......##..###.....
output:
43
result:
ok 1 number(s): "43"
Test #41:
score: 0
Accepted
time: 0ms
memory: 3864kb
input:
6 10 .#.....#.. ....#..##. ...#...### ###...#... .##..#.... ..#.....#.
output:
2
result:
ok 1 number(s): "2"
Test #42:
score: 0
Accepted
time: 2ms
memory: 5464kb
input:
43 50 ##...#............################################ ######.....................####################### ###############..................################# #########################...........############## ###############################.......############ ######....................#######.........
output:
6
result:
ok 1 number(s): "6"
Test #43:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
15 10 ....##.... ##..##..#. ##..##..#. ....##..#. ...#....#. .##.....#. .##..####. .##..####. .....####. ....#..... ####...... ####..#### ......#### ......#### ..........
output:
2
result:
ok 1 number(s): "2"
Test #44:
score: 0
Accepted
time: 0ms
memory: 4164kb
input:
30 30 ##...#####.....#.##..#.##.#### #.#...#.#.####.##.###..#.#..#. ##..#..#.#....#####..#..#..... .##.#.##..#...####..#..#..##.. #.####..##...##.#....#.###...# #.###.####.#....###.#...#.#... .#..#.#.##..#...##.......##.#. ...#.#.##.#.#.#.#.#####.#.#### ##.#....###..#.#..###....###.# .##.##.#..###.#...
output:
27
result:
ok 1 number(s): "27"
Test #45:
score: 0
Accepted
time: 4ms
memory: 4552kb
input:
50 50 ....#.#..#.......#..#...##......#.#....#....#...#. ...#..##....#.#.....##.#........###.....#......... .......#.#......#.#.....##.....#.#..........#.#... .#.......#...##.#......#.....#.#...##.##.....#.#.# ....#..#..............#.#..#....#..#......#.....#. ...#...#...#......##.....##.#.....#..#....
output:
22
result:
ok 1 number(s): "22"
Test #46:
score: 0
Accepted
time: 2ms
memory: 4176kb
input:
35 35 ##................................. .#.........................#.#..... ........#.................#....#... ...#....#...........#.............. ...#.##...#............##......#... ###.#.##..#........#..#........#... #.......##..##.#.#...##.#..##...... #.#.#.#.#..##......#.#..#....#..... ###.##...
output:
16
result:
ok 1 number(s): "16"
Test #47:
score: 0
Accepted
time: 1ms
memory: 4200kb
input:
36 25 .......................#. #.#....#.#.##.#........#. ..#.##.#.##.#..##..#.##.. ####............#..#..... #...##.......##.#..#..... ##.##.#..#...#.#......... .#.####..##......#.....#. ...#.##....#..........#.. ##.....#....#..#..##.#... .#......##...#.....#...#. .#...#...#...###.......#. .#..##.....
output:
11
result:
ok 1 number(s): "11"
Test #48:
score: 0
Accepted
time: 5ms
memory: 4844kb
input:
50 50 ####.#.#.###.#.##.....#.##.#.##.............#..#.. #....#.#..#..##.......#...........##.#......#..... ##.......##.##........#...#.###..##...##....#...## ........##.#.##.......#.#..##.#................... ..#.#......#.#.#...#..#........#......#..#........ ##.......##..###......##.#......#....##...
output:
27
result:
ok 1 number(s): "27"
Test #49:
score: 0
Accepted
time: 0ms
memory: 4172kb
input:
20 49 #..#.###.#...##..######..#..#.#.##.##....#..#.#.# #...##..####.##.####.#.#.#.##.#.#..#.######....#. .##.###.#.#..#####.####.#.##..###.##.####.##.#.## ...#.###....#######.#.#..#.....##.##..##.#...#.## .##..##.###.#.....###.....#.#..##.######...###### ##.#.##.#..##......###..#..#..##.##...##.###...
output:
32
result:
ok 1 number(s): "32"
Test #50:
score: 0
Accepted
time: 0ms
memory: 5296kb
input:
50 50 ###.....#.....#................................... .##..#..#..#..#..################################. .....#.....#.....################################. .....#.....#.....###.............................. ####################.............................. ####################..#################...
output:
3
result:
ok 1 number(s): "3"
Test #51:
score: 0
Accepted
time: 1ms
memory: 4408kb
input:
25 36 .......############################# #####..############################# #####..############################# .......############################# ......#.......###################### .#####........###################### .#####..####..###################### .#####..####..#####################...
output:
7
result:
ok 1 number(s): "7"
Test #52:
score: 0
Accepted
time: 6ms
memory: 5448kb
input:
40 50 #################..##################...########## #################..###############......########## #################..############.........########## ############################........############## ########################.........################# #####################.........#########...
output:
48
result:
ok 1 number(s): "48"
Test #53:
score: 0
Accepted
time: 2ms
memory: 5176kb
input:
50 50 .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
output:
49
result:
ok 1 number(s): "49"
Test #54:
score: 0
Accepted
time: 6ms
memory: 5640kb
input:
50 50 ######........................#............#...### #############################################..### #############################################..### ##############..#############################..### ##############....########....###############..### ##############......######......#######...
output:
32
result:
ok 1 number(s): "32"
Test #55:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
3 3 .#. ### .##
output:
3
result:
ok 1 number(s): "3"
Test #56:
score: 0
Accepted
time: 0ms
memory: 4432kb
input:
50 50 .#..#.......#.##...#..#....#..#.#.............#... #....#...#.#..........#..#.#.....#......#......... #.....##.#..#....###...............#...#.........# #........##..#...#..##..#..............#.#.#...... ##.#..................#.............#........#...# ..........#...###.#.#.....#.....#...#.....
output:
4
result:
ok 1 number(s): "4"
Test #57:
score: 0
Accepted
time: 1ms
memory: 4376kb
input:
20 30 ...#################.......... #..#################..#######. ...#################..##...... ...#################..##...... .###################..##..#### ...#################..##...... ...#################....#..... #..###########......#....####. ...###########.......##..####. ..#......#####....
output:
6
result:
ok 1 number(s): "6"
Test #58:
score: 0
Accepted
time: 0ms
memory: 5376kb
input:
40 50 #.....#####...........#############.........###### ####..#####.....####..############............#### ###...#####...######..###########....#####.....### ###...####...####.....##########....########....## ##...#####...####....#.............##########...## ##...#####...####..##.............#####...
output:
9
result:
ok 1 number(s): "9"
Test #59:
score: 0
Accepted
time: 0ms
memory: 5160kb
input:
50 43 .#####..################################### .####...################################### .#####..#############......################ .##################...........############# .################.......#.......########### .###############......####.#.....########## ..#############....###########...
output:
6
result:
ok 1 number(s): "6"
Test #60:
score: 0
Accepted
time: 4ms
memory: 4636kb
input:
50 50 #####...........####.##.###########....#..#.#....# #..##..##.##...#####.##.###..###.#..#...#.......#. .#......####.##.#####.#..#..#.###..#..#...#....... ...#############.......#.####.#.........#......... #.#.###.....#####....##..#..###.........#......... ##.#..#..#..#...#......###...#..#..#.##...
output:
32
result:
ok 1 number(s): "32"
Test #61:
score: 0
Accepted
time: 6ms
memory: 5364kb
input:
50 50 ####............############..####.##########..#.# ##..###.#.##.#.##.#.########.#..###.#########.#### #.##.###.#####.#.#.#####.##.#####...##.########.## ###..####.######.##..####.#..##.........#......... #.######.#..#...#######.#######.........#......... ..###...##..#.###.####.##.###...##...##...
output:
31
result:
ok 1 number(s): "31"
Test #62:
score: 0
Accepted
time: 4ms
memory: 4544kb
input:
50 43 ....#############...#.###.##.#............. ...###...#.###......#.#..#................. ...#####.###..#..###..#.#..#............... ##########.#........#....#................. ####....#..#..##.#...#...#.#............... ####......#..##.#..#.#....#................ ###.......##..#.....#..##...#....
output:
38
result:
ok 1 number(s): "38"
Test #63:
score: 0
Accepted
time: 4ms
memory: 5216kb
input:
50 50 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....
output:
50
result:
ok 1 number(s): "50"
Test #64:
score: 0
Accepted
time: 6ms
memory: 6104kb
input:
50 50 ######........................#............#...### #############################################..### #############################################..### #############################################..### #############################################..### #######################################...
output:
31
result:
ok 1 number(s): "31"
Test #65:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
4 6 .##... .#.... ##.... #...#.
output:
2
result:
ok 1 number(s): "2"
Test #66:
score: 0
Accepted
time: 3ms
memory: 4724kb
input:
50 50 ..##.#....#.........#...#..#.....#...##.#.....#... ........#..#.#............#....#.#......#...#..... .#....#.#.......#..#..#.....................##..#. #..........#.#.###.#.....#...#........#.#.....#.#. .....#####.##....#...##..#.......#...#...##....#.. ....##.#.#..##..#...#.#...............#...
output:
13
result:
ok 1 number(s): "13"
Test #67:
score: 0
Accepted
time: 6ms
memory: 5404kb
input:
43 50 .#################################................ ##################################................ ##################################..############.. ##################################..############.. #..###############################..#############. #..###############################........
output:
38
result:
ok 1 number(s): "38"
Test #68:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
15 10 .......... #########. .......... .......... .######### .......... .......... #########. ......###. ......###. .###..###. .###...... .###...... .######### ..........
output:
0
result:
ok 1 number(s): "0"
Test #69:
score: 0
Accepted
time: 1ms
memory: 3752kb
input:
11 18 ##....##..####...# ##.##..##..##.#.#. ...##.#.##..#.##.# #...########...### ..#.##.#.#.##.#.## #####....#..###.## .###...#.##.##.#.. #..##.#.#####..#.. ####..#..####..### #.#..###.#.##.#### .#.###.#.##.##....
output:
15
result:
ok 1 number(s): "15"
Test #70:
score: 0
Accepted
time: 1ms
memory: 4140kb
input:
36 25 .#....................... ....#####..#.#.#######... .....############..##.##. ####.#.#.###..##.##.###.. .#####.####...........#.. #.##.##...............##. #............#.###...###. .#......#.#########..###. ##...##.##..##.####..###. #...#########.....#...#.. ##..#.#..##..#.##........ .#..##.#...
output:
8
result:
ok 1 number(s): "8"
Test #71:
score: 0
Accepted
time: 2ms
memory: 5124kb
input:
50 40 .#.##.##..#.#........................... ###..##.####.......#####.#####.#.#..#... .#######.#.#....##...###.##.#.#######.#. ###.#######...###..####.########.#####.. ..####.##......####.########.####.##.##. .###..###....#####.####.#.#.##.######... ..#####.##..#.##.###.###........##..###. .#...##...
output:
9
result:
ok 1 number(s): "9"
Test #72:
score: 0
Accepted
time: 2ms
memory: 4864kb
input:
50 43 .#......#.#..#.####..#.#.#.....#.#.#.#..... ..#....##.###.##..###.#.#..#......#..#....# ..###...#.#....##...##.....#.#######...#.## ..#......##.##....##.####..##.#.###.#.#..#. ...###.#..###....#....#.#....#.#.####..#### .....#.#..##...##..#..#..........##.#....## ....#....#####..####...#.........
output:
5
result:
ok 1 number(s): "5"
Test #73:
score: 0
Accepted
time: 2ms
memory: 4776kb
input:
50 50 #.##.....#............###.##...........#.....#.... ..##..#..#..####.###..#.####..#.....#............. ..##..#..#..#.........###.##..#..#.....#..#..#..#. .#.#..#...............###.##..#..#..#.....#..#..#. .##......#........#..#.##..#..#..#..#..#.......... ..#......#..##..############........#.....
output:
7
result:
ok 1 number(s): "7"
Test #74:
score: 0
Accepted
time: 0ms
memory: 4044kb
input:
36 25 .......................#. ##....##.#.##.#....#.#... ....#.#..#...#....#.#.... #..#..........#......##.. .................#......# ##...........##.........# ....#.#..##...........#.. #.###.#....#.........#..# .......#....##...#.#...## ........##......#.#.....# .#..##...#....##...#.#.#. #....#.....
output:
10
result:
ok 1 number(s): "10"
Test #75:
score: 0
Accepted
time: 6ms
memory: 4812kb
input:
44 50 .##.#..#.##..##......#.##.##....##.#.#####.#..#### ...#.########..##..#.#.#...#.#####.#......#.#.#### .#..#...#....####..........####...####........#.## #.#.#....#...##.##.###.#....#..###.#.....##...###. #.######......#..#.##.##.#.....###.##..#####...##. .....#.###...##.#.##.####...####.######...
output:
42
result:
ok 1 number(s): "42"
Test #76:
score: 0
Accepted
time: 4ms
memory: 5384kb
input:
50 50 ....############.....######......########....##### ##..###########....######.....##########....###### ....##########....#####......##########....###...# ...#....####....#####......###...#####....###....# ..#.....##.....#####.....###.....###....####....## .....#..#.....#####....###......###.......
output:
19
result:
ok 1 number(s): "19"
Extra Test:
score: 0
Extra Test Passed