QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362127#8507. Clever Cell Choicesucup-team3099#AC ✓4269ms4624kbC++147.7kb2024-03-23 14:14:562024-03-23 14:14:56

Judging History

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

  • [2024-03-23 14:14:56]
  • 评测
  • 测评结果:AC
  • 用时:4269ms
  • 内存:4624kb
  • [2024-03-23 14:14:56]
  • 提交

answer

#include <iostream>
#include <vector>
#include <chrono>
#include <random>
#include <cassert>
#include <queue>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

template <class T = int>
class Dinic {
public:
    struct Edge {
        Edge(int a, T b){to = a;cap = b;}
        int to;
        T cap;
    };

    Dinic(int _n) : n(_n) {
        edges.resize(n);
    }

    T maxFlow(int src, int sink) {
        T ans = 0;
        while(bfs(src, sink)) {
            // maybe random shuffle edges against bad cases?
            T flow;
            pt = std::vector<int>(n, 0);
            while((flow = dfs(src, sink))) {
                ans += flow;
            }
        }
        return ans;
    }

    void addEdge(int from, int to, T cap, T other = 0) {
        edges[from].push_back((int) list.size());
        list.push_back(Edge(to, cap));
        edges[to].push_back((int) list.size());
        list.push_back(Edge(from, other));
    }

    bool inCut(int u) const { return h[u] < n; }
    int size() const { return n; }
//private:
    int n;
    std::vector<std::vector<int> > edges;
    std::vector<Edge> list;
    std::vector<int> h, pt;

    T dfs(int on, int sink, T flow = 1e9) {
        if(flow == 0) {
            return 0;
        } if(on == sink) {
            return flow;
        }
        for(; pt[on] < (int) edges[on].size(); pt[on]++) {
            int cur = edges[on][pt[on]];
            if(h[on] + 1 != h[list[cur].to]) {
                continue;
            }
            T got = dfs(list[cur].to, sink, std::min(flow, list[cur].cap));
            if(got) {
                list[cur].cap -= got;
                list[cur ^ 1].cap += got;
                return got;
            }
        }
        return 0;
    }

    bool bfs(int src, int sink) {
        h = std::vector<int>(n, n);
        h[src] = 0;
        std::queue<int> q;
        q.push(src);
        while(!q.empty()) {
            int on = q.front();
            q.pop();
            for(auto a : edges[on]) {
                if(list[a].cap == 0) {
                    continue;
                }
                int to = list[a].to;
                if(h[to] > h[on] + 1) {
                    h[to] = h[on] + 1;
                    q.push(to);
                }
            }
        }
        return h[sink] < n;
    }
};

int main() {
    std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
    int n, m;
    std::cin >> n >> m;
    std::vector<std::string> mat(n);
    for(int i = 0; i < n; i++) {
        std::cin >> mat[i];
    }
    Dinic<int> graph(n * m + 2);
    int src = n*m;
    int sink = src+1;
    for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) if(mat[i][j] == '.') {
        if((i + j) % 2 == 0) {
            graph.addEdge(src, i*m + j, 1);
            int dx = 0, dy = 1;
            for(int dir = 0; dir < 4; dir++) {
                std::swap(dx, dy);
                dx = -dx;
                int x = i + dx, y = j + dy;
                if(0 <= x && x < n && 0 <= y && y < m && mat[x][y] == '.') {
                    graph.addEdge(i*m+j, x*m+y, 1);
                }
            }
        } else {
            graph.addEdge(i*m + j, sink, 1);
        }
    }
    auto ori = graph;
    int flow = graph.maxFlow(src, sink);
    std::vector<bool> got(n*m, false);
    for(auto id : graph.edges[src]) {
        int to = graph.list[id].to;
        if(graph.list[id].cap == 0) {
            got[to] = true;
        }
    }
    for(auto id : graph.edges[sink]) {
        int to = graph.list[id].to;
        if(graph.list[id].cap == 1) {
            got[to] = true;
        }
    }
    auto otherGot = got;
    int ans = 0;
    for(int i = 0; i < n*m; i++) {
        if(mat[i/m][i%m] != '.') continue;
        //if(got[i]) {
            auto tmp = ori;
            for(int j = 0; j < (int) tmp.list.size(); j++) if(tmp.list[j].to == i) {
                tmp.list[j].cap = tmp.list[j^1].cap = 0;
            }
            int curFlow = tmp.maxFlow(src, sink);
            if(curFlow != flow) {
                otherGot[i] = false;
            } else {
                ans++;
            }
        //}
    }
    std::cout << ans << '\n';
    return 0;
    ans = 0;
    for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) {
        if(mat[i][j] == '.') {
            std::vector<std::pair<int, int>> comp;
            comp.emplace_back(i, j);
            mat[i][j] = '#';
            int totFreq[2] = {0, 0};
            int gotFreq[2] = {0, 0};
            int otherFreq[2] = {0, 0};
            for(int k = 0; k < (int) comp.size(); k++) {
                auto [x, y] = comp[k];
                //std::cout << "visit (" << x << ", " << y << ") starting at (" << i << ", " << j << ")\n";
                totFreq[(x+y)%2]++;
                if(got[x*m+y]) {
                    gotFreq[(x+y)%2]++;
                }
                if(otherGot[x*m+y]) {
                    otherFreq[(x+y)%2]++;
                }
                int dx = 0, dy = 1;
                for(int dir = 0; dir < 4; dir++) {
                    std::swap(dx, dy);
                    dx = -dx;
                    int toX = x + dx, toY = y + dy;
                    if(0 <= toX && toX < n && 0 <= toY && toY < m && mat[toX][toY] == '.') {
                        mat[toX][toY] = '#';
                        comp.emplace_back(toX, toY);
                    }
                }
            }
            if(gotFreq[0] != totFreq[0]) {
                ans += otherFreq[0];
            }
            if(gotFreq[1] != totFreq[1]) {
                ans += otherFreq[1];
            }
        }
    }
    std::cout << ans << '\n';
}

/*
NEVER FORGET TO:
    Look at the problem's constraints before coding.
How to cheese cf:
    Find a lower bound or upper bound for the problem. Have faith that it is the answer of the problem.
    If it isn't the answer, have more faith or change to another bound god by looking for a better bound.

    Trust guesses. Who has time to think? If people in div2 AC the problem it requires no proof since people don't prove things.

    You must draw cases. Thinking gets you nowhere, so draw cases and reach illogical conclusions from them.
    Sometimes drawing cases is bad because it takes too much time. Faster is to not think at all and just code a bruteforce solution.
    This is called "law of small numbers". If something works for small numbers, surely it works for big numbers.
    https://en.wikipedia.org/wiki/Faulty_generalization#Hasty_generalization don't mind the "faulty" part of it, in competitive programming mistakes are lightly punished
    Don't think about them being right or not, cf is a battle of intuition only.

    Be as stupid as possible in implementation. Trying to be smart is an easy way to get WA.

    Think about 2x2 cases for matrix problems and hope that everything works for the general case.

    Find a necessary condition and trust it to be sufficient. They're basically the same thing.

    Heuristics might speed up your code. Forget about complexity, it's only about ACing and not proving that your solution is good.

    For paths in a grid starting at (1, i) or something like that, assume that they never cross and do D&C

    Consider doing problems in reverse order of queries/updates

    For combinatorics problems, consider symmetry

General strategy (MUST DO):
    Try to solve the problem with more restricted constraints.

About testing:
    Test n=1, a[i]=1, a[i]=n, etc. Basically, test low values. No need to test if pretests are strong, but if you get WA it's good.

This isn't a joke. Do it if you get stuck. It's shit practice in my opinion, but do it if you want AC.
*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3
#.#
...
#.#

output:

4

result:

ok 1 number(s): "4"

Test #2:

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

input:

3 3
..#
...
...

output:

0

result:

ok 1 number(s): "0"

Test #3:

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

input:

1 4
...#

output:

2

result:

ok 1 number(s): "2"

Test #4:

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

input:

1 5
####.

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

1 6
#..###

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

2 5
....#
###.#

output:

3

result:

ok 1 number(s): "3"

Test #7:

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

input:

2 6
...##.
.#.###

output:

4

result:

ok 1 number(s): "4"

Test #8:

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

input:

5 5
##...
##.#.
##.##
##.#.
.##..

output:

7

result:

ok 1 number(s): "7"

Test #9:

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

input:

6 6
...##.
#..#..
......
..#...
#...##
.#....

output:

1

result:

ok 1 number(s): "1"

Test #10:

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

input:

10 10
####.#...#
.#.###....
#....#..#.
.....#.#..
##.#..#.#.
..#..##...
.##.#####.
#######.##
.#.#.##..#
.#.###.##.

output:

26

result:

ok 1 number(s): "26"

Test #11:

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

input:

10 10
..#..#.###
.#######.#
.#.####.#.
......####
#..#..#.#.
...#.###.#
#.#...#.#.
.#...#....
...#.#.#.#
...###....

output:

21

result:

ok 1 number(s): "21"

Test #12:

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

input:

15 15
#......#.#.###.
#.##...####..#.
##.....##.##.#.
#.###.#..#...##
....###.##.#.#.
.#..#.###.##.#.
######.#.####.#
.#....#..####..
.....#.###.##..
#..##.###.#####
#.##.#####..###
.#######..##.#.
##....#.##...#.
....#####.##.##
...#.#........#

output:

51

result:

ok 1 number(s): "51"

Test #13:

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

input:

15 15
###.#......#...
#.....#.#.###.#
#..#.#.###..#..
.#####.##.#..#.
...#.##.#..#.#.
#.#.###.....###
......#..##....
..##..#.#.#...#
..#..#..#......
....####...#..#
.####..#.#.##.#
###.#..#.#.#...
.#.##.##....##.
.#.#####.#..#.#
#.#.#.##.#.....

output:

61

result:

ok 1 number(s): "61"

Test #14:

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

input:

20 20
####....##.#####.##.
...####.##..#.####..
#.#.....#....##..###
###..###.#.#..#..###
##.##..#.##.####....
#...###.##.###.##...
.###...#####.##....#
#...###...##........
##.#.#.#.###.......#
#...##.##.#..##.##..
..##.##.######....##
#.#....#.##.##.##..#
##.....#..#.########
##....##.###...#....
...

output:

95

result:

ok 1 number(s): "95"

Test #15:

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

input:

20 20
.##.#.#.#..##..##.#.
..#.##.##.....##..##
.#....##...####..#..
##..###..#.#..##....
....#.##.##.###...##
.#.#.##.#..###....#.
######.#..#....#.#..
.##.###..##..##.###.
#.....#.#..#.##.#.#.
###.#####.##..#.##.#
...###.####.##...#.#
.#.....#.#.#.#..###.
#.#...#####..##.####
..####.##..##.#.#.##
...

output:

109

result:

ok 1 number(s): "109"

Test #16:

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

input:

30 30
###...###....#..#.#.#######...
.##..#.###.#.####.#...#..#.#..
.##..#######..##...#....##...#
..###..#..###...#.##.....#..##
#.#.#.#.#...###.######..#....#
###..##..###.#.###.#.####..#..
.....#...####..####..##.#.##.#
..#...######.##....#..###..###
..#####......#.#...##...#..##.
##..#.#.#.##......

output:

196

result:

ok 1 number(s): "196"

Test #17:

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

input:

30 30
######....###.#..#..###.#.##.#
.#..#...#.##..#.##...#...#####
##.#.##..##.#..###.#.#...####.
.####.###..##..#..#.#####..#.#
....##.##...#...##.####..####.
..###.##.##...##.##.###.####.#
#####......#.#...#..........#.
..#.....###..##.##..##.#.#####
..##...#.##.#.#.#..#.#.#.##...
...#.#.##..###....

output:

196

result:

ok 1 number(s): "196"

Test #18:

score: 0
Accepted
time: 90ms
memory: 4040kb

input:

40 40
......##...#.##..###.##.#.....#.#.#..#.#
#..###...####.####..###.#.#.#..#.##..##.
############.#.#...##..#...#........#.##
##.###.##########...###...####.##..#####
.###.#.##.##....##...#.##.#..#..##.#..#.
##...####.##.###.#.#.##...##..####.#####
#####..##.###.##.#.#.....####..##...##..
.#..###...

output:

290

result:

ok 1 number(s): "290"

Test #19:

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

input:

40 40
.####.####.....##.......#....########..#
.#.#....#####..#.##.###..#..#.#...##.#.#
.##.####..#.#...#.######..#.....##.#.##.
.##..##...#...#.#.#..#.###.....#..##.##.
..###.#.#....#######...#.##.##...##...#.
.##..#......##.##########.##.###..#..#.#
###.##.#.##...#.#####...###..##.#.#..###
#.###.....

output:

307

result:

ok 1 number(s): "307"

Test #20:

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

input:

50 50
#..#..###.###.####..#..#.##.#.##...#.#...########.
..#.##.##..##..##.##.##.##...#.#.####.#.##...##..#
....##.#.#..#.#.#.###...##.###.#...#.##..#..#..###
#.###.#.##.#......##...#..#..#..##..#####.##.#....
.##.####..##.#..#...##...#..#...##..##.##..#.##...
.###.#..#..####....##...#......##..#.##...

output:

488

result:

ok 1 number(s): "488"

Test #21:

score: 0
Accepted
time: 336ms
memory: 4040kb

input:

50 50
...##..#.#.##...#..##........##..###..##..#......#
.......#.#..#####.##.##.##.###.#.##.#.#..##......#
...##.##.########.##...#...#...#####...###.####.#.
#....###..###.###......##.#####..##.#...#.#...###.
#.##.##...#.#....##..##.##..##.#..####..#####.##..
.##.##.#.##...#.##.#.#....##..#..#.##.#...

output:

494

result:

ok 1 number(s): "494"

Test #22:

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

input:

1 10
.#........

output:

1

result:

ok 1 number(s): "1"

Test #23:

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

input:

1 11
#..........

output:

0

result:

ok 1 number(s): "0"

Test #24:

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

input:

1 21
#.......#............

output:

4

result:

ok 1 number(s): "4"

Test #25:

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

input:

2 12
..#.........
......#.....

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

2 22
....#.................
..........#......#..#.

output:

0

result:

ok 1 number(s): "0"

Test #27:

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

input:

33 3
#..
...
...
...
.#.
...
...
...
...
.#.
...
...
...
...
..#
...
...
...
...
...
...
..#
..#
...
...
...
...
...
...
...
.#.
...
.#.

output:

3

result:

ok 1 number(s): "3"

Test #28:

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

input:

42 1
.
.
.
.
.
.
#
.
.
.
.
.
.
.
.
#
.
.
.
.
.
#
.
.
.
.
#
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

output:

11

result:

ok 1 number(s): "11"

Test #29:

score: 0
Accepted
time: 45ms
memory: 4044kb

input:

13 37
##........#..........................
....................#................
..........#.............#............
..............#.....#.....#..........
....#....#.....................##....
....#........#.........#.............
........#.......#....................
....#............##............

output:

221

result:

ok 1 number(s): "221"

Test #30:

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

input:

31 13
.....#......#
........#....
....#.#......
....#........
.............
.#.........#.
......#......
............#
..#.#......#.
.............
.......#.....
.....#.......
..#..........
.##.#........
.#..#........
..........##.
.............
...........##
............#
.............
.......#.#...
...

output:

184

result:

ok 1 number(s): "184"

Test #31:

score: 0
Accepted
time: 1164ms
memory: 4280kb

input:

44 44
...................#...........#............
.#............#.#..#.#......................
...#....#.........##....#...##..............
.......#....................................
.....##...#...##..........#.................
..##.#...........#.........##........#......
.....#.....................

output:

833

result:

ok 1 number(s): "833"

Test #32:

score: 0
Accepted
time: 2037ms
memory: 4536kb

input:

49 46
......##.................#....................
...#.................#.....#..#..........#.#..
#.....#...............#......##....#.....#....
..........#............##...................##
...#......#.#..............###..#..........#..
..................................#...........
...........#...

output:

956

result:

ok 1 number(s): "956"

Test #33:

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

input:

50 50
..#..#................#.#.......#.................
#...........................#..#..................
...#..............#....#...............#..........
.........#..........#........................#....
...#....#..........#..#.#................##..#....
...#.........#.#.#..................#.....

output:

1020

result:

ok 1 number(s): "1020"

Test #34:

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

input:

1 7
.......

output:

4

result:

ok 1 number(s): "4"

Test #35:

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

input:

1 10
..........

output:

0

result:

ok 1 number(s): "0"

Test #36:

score: 0
Accepted
time: 250ms
memory: 4208kb

input:

31 35
...................................
...................................
...................................
...................................
...................................
...................................
...................................
...................................
.........

output:

543

result:

ok 1 number(s): "543"

Test #37:

score: 0
Accepted
time: 236ms
memory: 4044kb

input:

33 33
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.........................

output:

545

result:

ok 1 number(s): "545"

Test #38:

score: 0
Accepted
time: 727ms
memory: 4444kb

input:

42 42
..........................................
..........................................
..........................................
..........................................
..........................................
..........................................
.......................................

output:

0

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 1383ms
memory: 4600kb

input:

47 48
................................................
................................................
................................................
................................................
................................................
................................................
...

output:

0

result:

ok 1 number(s): "0"

Test #40:

score: 0
Accepted
time: 4269ms
memory: 4364kb

input:

50 50
...##.#......#....#............#...........#......
...#........#.............#.....##...#.....#.....#
.......#..#..#.#...........#...............#......
.......#........#......#.................#......#.
#....................................#...#........
........#.................#.........#.....

output:

909

result:

ok 1 number(s): "909"

Test #41:

score: 0
Accepted
time: 1677ms
memory: 4260kb

input:

50 50
.##...###......#......#.......###.....#.#..#.#....
.#...#.####........#.##......#...##..#..#.........
..###..#....#.......#..##.......#...#.....#...#..#
##.#....#...#...#...##.#..##.#.#..#.......#...##..
##.#..#........#.#..#.##.....#..##.....##..#...#..
.............#..#....##.....#..##.....#...

output:

688

result:

ok 1 number(s): "688"

Test #42:

score: 0
Accepted
time: 399ms
memory: 4100kb

input:

50 50
#....#.####.###........##.#...#......#..##.##.##..
#####.#.#.######..##.###.....#.#.#...#.###.#.#....
.#.#####.#..##.#...#....#.##...#.##..####.#.#...##
#.#...##..##....#....######.##.####...#.##.##.####
#..###.....#.##..###...###.##...#..####....##.##.#
#....#.#...#.##...###..###....#.###..#....

output:

536

result:

ok 1 number(s): "536"

Test #43:

score: 0
Accepted
time: 46ms
memory: 4072kb

input:

50 50
#####.#####.###..###..#######.##.#.####.#.#.###.##
###.#.####.##...##.#.##.##..####.######.#..###.#..
###...####.########..###.###.###..###.#####..#####
###########..##.###..#..#####..#....##..######.#.#
#######.####.#.#####.#...######..#.#####.#.#######
####.#.##.#######..######.##.###.##.###...

output:

371

result:

ok 1 number(s): "371"

Test #44:

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

input:

50 50
..##.####.#..#.##..#.#.#####..####.########.###.##
###.###..#.##.##..########...#########..##########
#########.#######.###..####################..#####
#######.##.###.###.###.#..####.#####...###..###.#.
##.#.##############.###########.####...##########.
.....#.#.#####.#...#.##################...

output:

299

result:

ok 1 number(s): "299"

Test #45:

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

input:

50 50
############.########################.###########.
####.##########.#############.#############.######
#####.#######.###############.#############.#.##.#
..#.##.#####..###.###########.########.####.######
###############.#.########.##############.######..
######.#################.#..##.########...

output:

189

result:

ok 1 number(s): "189"

Test #46:

score: 0
Accepted
time: 1965ms
memory: 4356kb

input:

43 44
.................#....#..#...............##.
....#..#.............................#......
.............#.....................#.#......
.#.....#......#...............#.............
#...............#...#...............#.......
.#.....#..#...........#.......#.............
..#........................

output:

776

result:

ok 1 number(s): "776"

Test #47:

score: 0
Accepted
time: 107ms
memory: 3844kb

input:

15 49
.##..#........#....#....##.....#..#.......##...#.
...#.....##....##...#.#...........#..#.........#.
#..#.........##.....#.#..#.....#.#.#..#......#...
.................#...........#.....#...........#.
..#..#.....##...#......#....#.....#........#..#..
#.#.......#..........#..#...#..................

output:

218

result:

ok 1 number(s): "218"

Test #48:

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

input:

5 10
#..#......
.#....##..
..###...##
..#...#..#
#....#....

output:

3

result:

ok 1 number(s): "3"

Test #49:

score: 0
Accepted
time: 611ms
memory: 4420kb

input:

49 49
#.#.##...#.....#..##..##..##....##..###....##.##.
####.#....#......##.........##...##......#.#...##
..#...#.##....#......###...##..#.##.#.......##.#.
.....###..#....#.##.#....####..##..#..##....#..#.
#####..#...#....#.######......#..#....###..#.###.
.#.#.....###..#...#..#..#####...#.##......#....

output:

530

result:

ok 1 number(s): "530"

Test #50:

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

input:

22 22
###.#.#######.###.##.#
..###.##...#.#.#..#..#
.####.####.###.#.....#
#####..#.##.###..#.#..
###.#.#.#.#...###.###.
...###....##..##.....#
.#..##.#......#.#..#.#
.###.##.#.....#...#.#.
##..#.#######.##...#..
##...###...##.#..#####
##.#..##.##....##.###.
..#.##...##.###.##.##.
#####.##.#.#.#.##....

output:

105

result:

ok 1 number(s): "105"

Test #51:

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

input:

13 31
.###..##.#..##.#..#.#..#.###..#
.#...######....##.####.#..#.###
##..##..######...#.#####..#####
###.######.#..#.#.##..##.###.#.
##############.###..###.##.#.#.
##..##...#..#..#####.##.##....#
.###.#.##..#.....#...#..##.##.#
####.##.....######.##.#.##.#..#
...####.#.###.###.##.#..#.#.#..
..#..#...

output:

56

result:

ok 1 number(s): "56"

Test #52:

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

input:

33 33
#.###.##..####.##.##..#.##..#####
#.#.####.##.####.#####.##.####.##
#####...#.##.###########.#.####.#
###.##....##.#######.####.#######
##################.##..#######..#
##.###.#.###.##########.###.##..#
.#..#####.#####.#####.####..#.###
.##.#.###.####.#####.####.###.##.
.###.#..############.#...

output:

160

result:

ok 1 number(s): "160"

Test #53:

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

input:

50 50
......#.....................................######
......#.....................................#.....
......#.....................................#.....
......#.....................................#.....
......#.....................................#.....
......#...................................

output:

267

result:

ok 1 number(s): "267"

Test #54:

score: 0
Accepted
time: 3140ms
memory: 4284kb

input:

50 50
......#..#....###.....#.#......#..................
..#....#......#...................................
.###..........#...#.....#......#.....#...#.##.....
#.........#...#.....#.............................
#.............#..#..#.....#.....#.........##......
..............#..#....#....#........#.....

output:

862

result:

ok 1 number(s): "862"

Test #55:

score: 0
Accepted
time: 1861ms
memory: 4260kb

input:

50 50
...#..............#.........#.......#........#....
.........#.#.#..#...............#.#..............#
.............#...#....##......#.#..............#..
.#.#...#.......##...........##...#....#...........
.#.#....#..#.......#.#....#.#...........#.........
..##.......#..........#...#.#....#.#......

output:

926

result:

ok 1 number(s): "926"

Test #56:

score: 0
Accepted
time: 2270ms
memory: 4624kb

input:

50 50
............................................#.....
............................................#.....
............................................#.....
............................................#.....
............................................#.....
..........................................

output:

406

result:

ok 1 number(s): "406"

Test #57:

score: 0
Accepted
time: 1609ms
memory: 4536kb

input:

50 50
.........#########################################
..................................................
..................................................
..................................................
###################################...............
..................................#.......

output:

664

result:

ok 1 number(s): "664"

Test #58:

score: 0
Accepted
time: 2034ms
memory: 4316kb

input:

50 50
.#........................................#.#.##..
.#........#...............................#...##..
##........................................#...##..
.#.......................#.............#..#...##..
###########################################...##..
..........................................

output:

650

result:

ok 1 number(s): "650"

Test #59:

score: 0
Accepted
time: 1829ms
memory: 4308kb

input:

50 50
..#...#.....#.........#...#.#....#..#...#.........
............#..#...#....##.........#....#..#......
............#.......#..................##....#####
...#........#................#..........#....#..#.
............#....#.##........#....#.....#....#....
...##...#...###########################...

output:

939

result:

ok 1 number(s): "939"

Test #60:

score: 0
Accepted
time: 134ms
memory: 4092kb

input:

50 50
.#######..####.....##..#....#.#.##.####...#..#...#
#.##..###.####.###.#.........####.##....#.....##..
##.#.##..####.####.##.##..#...#.#......###.#..##..
###..#.#..#####.#####....####...#.#########...#.#.
.#.###.##.###...##.##..#.##.#...#..#.###.######..#
###..##..###..#.#..#.####.#..###.#..#.....

output:

429

result:

ok 1 number(s): "429"

Test #61:

score: 0
Accepted
time: 1435ms
memory: 4560kb

input:

50 50
..##................................#..#.....#....
..##................................#..#.....#....
..##................................#..#.....#....
..#####.............................#..#.....#....
..##..#.............................#..#.....#....
..##..#.............................#.....

output:

0

result:

ok 1 number(s): "0"

Test #62:

score: 0
Accepted
time: 1669ms
memory: 4416kb

input:

50 50
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#.....

output:

264

result:

ok 1 number(s): "264"

Test #63:

score: 0
Accepted
time: 1855ms
memory: 4488kb

input:

50 50
.........#..#....................##..#......#.....
.........#..#....................##..#......#.....
.........#..#....................##..#......#.....
.........#..#....................##..#...#..#.....
.........#..#....................##..#......#.....
.........#..#....................##..#....

output:

763

result:

ok 1 number(s): "763"

Test #64:

score: 0
Accepted
time: 848ms
memory: 4416kb

input:

50 50
.....#....#.###.#.....#...........................
.....#....#.###.#.....#......................#####
.....#....#.###.#.....############################
.....#....#.###.#####...#.........................
.....#....#.###.#...#...#.........................
.....#....#.###.#...#...#.................

output:

365

result:

ok 1 number(s): "365"

Test #65:

score: 0
Accepted
time: 765ms
memory: 4468kb

input:

50 50
..........................................##.#.#..
..........................................##.#.#..
############################################.#.#..
..#.........#................#............##.#.#..
..#.........#................#............##.#.#..
#############................#............

output:

301

result:

ok 1 number(s): "301"

Extra Test:

score: 0
Extra Test Passed