QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#721678 | #9224. Express Eviction | BreakPlus | AC ✓ | 19ms | 7600kb | C++14 | 2.8kb | 2024-11-07 16:35:33 | 2024-11-07 16:35:35 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
const int mininf = 1e9 + 7;
#define int long long
#define pb emplace_back
inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+(ch^48);ch=getchar();}return x*f;}
inline void write(int x){if(x<0){x=~(x-1);putchar('-');}if(x>9)write(x/10);putchar(x%10+'0');}
#define put() putchar(' ')
#define endl puts("")
const int MAX = 6e3 + 10;
int psz = 2;
struct flow{
struct node{
int v, w, cp;
}; vector <node> g[MAX];
int dis[MAX];
bool bfs(int s, int t){
for(int i = 1; i <= psz; i++) dis[i] = mininf;
dis[s] = 0;
queue <int> q;
q.push(s);
while(!q.empty()){
int u = q.front();
q.pop();
for(auto V : g[u]){
if(V.w > 0 and dis[V.v] > dis[u] + 1){
dis[V.v] = dis[u] + 1;
q.push(V.v);
}
}
}
if(dis[t] == mininf) return 0;
return 1;
}
int cur[MAX];
int aug(int u, int now, int t){
if(u == t) return now;
int ans = 0;
for(int &i = cur[u]; i < g[u].size(); i++){
int v = g[u][i].v, w = g[u][i].w, cp = g[u][i].cp;
if(dis[v] != dis[u] + 1) continue;
int ret = aug(v, min(w, now), t);
g[u][i].w -= ret, g[v][cp].w += ret;
now -= ret, ans += ret;
if(now <= 0) break;
}
return ans;
}
void add_edge(int u, int v, int w){
g[u].pb(node{v, w, g[v].size()});
g[v].pb(node{u, 0, g[u].size() - 1});
}
}; flow G;
int id[55][55][2];
int a[55][55];
void solve(){
int n = read(), m = read();
int s = 1, t = 2;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
char ch = getchar();
while(ch != '.' and ch != '#'){
ch = getchar();
}
if(ch == '#'){
a[i][j] = 1;
id[i][j][0] = ++psz, id[i][j][1] = ++psz;
}
}
}
for(int i = 1; i <= m; i++) if(a[1][i]) G.add_edge(id[1][i][1], t, inf);
for(int i = 1; i <= n; i++) if(a[i][1]) G.add_edge(s, id[i][1][0], inf);
for(int i = 1; i <= m; i++) if(a[n][i]) G.add_edge(s, id[n][i][0], inf);
for(int i = 1; i <= n; i++) if(a[i][m]) G.add_edge(id[i][m][1], t, inf);
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(!a[i][j]) continue;
G.add_edge(id[i][j][0], id[i][j][1], 1);
for(int k = max(1ll, i - 2); k <= min(n, i + 2); k++){
for(int k2 = max(1ll, j - 2); k2 <= min(m, j + 2); k2++){
if(k == i and k2 == j) continue;
if(a[k][k2]){
G.add_edge(id[i][j][1], id[k][k2][0], inf);
}
}
}
}
}
int ans = 0;
while(G.bfs(s, t)){
for(int i = 1; i <= psz; i++) G.cur[i] = 0;
ans += G.aug(s, inf, t);
}
write(ans), endl;
}
signed main(){
int t = 1;
while(t--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
4 6 .##... .#.... ##.... ....#.
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 2ms
memory: 4360kb
input:
20 30 ...########################### #..########################### ...########################### ...########################### .############################# ...########################### ...########################### #..########################### ...########################### ..#...............
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 3ms
memory: 4664kb
input:
35 35 ....###########...#########........ ##..#######################..#####. ....#######################..#####. ...#.....##################..#####. .##......##################.....##. .##..##..#############.....#....##. .....##..#############......##..##. ....#....#############..##..##..##. ####.....
output:
16
result:
ok 1 number(s): "16"
Test #4:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
30 20 .#..........##...... ..#......#..##...... .......#..........#. ..#......#..##...... .....#......#....... .#.........#........ ......#...#......... ..#..##..#...#...... ......#.......#..... ..#....#............ ........#..#.#...... ....##..#........... .........#.#.......# ........##.......... ...
output:
5
result:
ok 1 number(s): "5"
Test #5:
score: 0
Accepted
time: 3ms
memory: 4260kb
input:
50 45 ...##................##...................#.. ...#......#.#..........#.#.....####....#....# ....#.....#..............#..#..##......##..#. .....#......######........#.............#.... ......##...#...##...##.......#....#..#...##.. ...#..##.....##...###.............#..##.....# ...#......########...
output:
24
result:
ok 1 number(s): "24"
Test #6:
score: 0
Accepted
time: 4ms
memory: 4508kb
input:
50 45 ...#...................#.####................ ...........................#......###.#..##.. ..#.#........##.##....#....#................. .....#.....#.##.#.#.........#................ ...........#.#.#.#.##....#.#.......##.#..#... ...#......#...#####......#...##.##........#.. ............####.....
output:
23
result:
ok 1 number(s): "23"
Test #7:
score: 0
Accepted
time: 0ms
memory: 4764kb
input:
50 50 ##................................................ #################################################. ####.............................................. ####.............................................. ####..############################################ ####......................................
output:
7
result:
ok 1 number(s): "7"
Test #8:
score: 0
Accepted
time: 19ms
memory: 6388kb
input:
50 50 #.##.##..###...#######.##..#####.#...######.###### .####.##.##.#############.#.#.###.##.###.#.#.###.# ...####.##########.###.####.#.####.#############.. #.#..########.#.#####.#..#.##....##########.#.#### ###.##.####.###.#######..##.#####...##.#######..#. #####.########..########..#######.##.#....
output:
72
result:
ok 1 number(s): "72"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3980kb
input:
50 50 .................................................. .................................................. .................................................. .................................................. .................................................. ..........................................
output:
0
result:
ok 1 number(s): "0"
Test #10:
score: 0
Accepted
time: 0ms
memory: 5876kb
input:
43 50 ...........####################################### #########...###################################### #########...####....############################## ##########..#........############################# ##########...........############################# #####.....#....####...##########......#...
output:
5
result:
ok 1 number(s): "5"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
8 13 .##.......... .##..#######. .##......#.#. ...#.....#.#. ....###..#.#. ##..###..#.#. ##.......#.#. ##.......#.#.
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
36 25 ##....................... ......................... #........................ ......................... ......................... ......................... ......................... ......................... ......................... ..................#.....# ..............#.#..#..#.. ...........
output:
7
result:
ok 1 number(s): "7"
Test #13:
score: 0
Accepted
time: 1ms
memory: 3912kb
input:
30 20 ...............#.... .#......#...#.....#. .#...##..####..#..#. ...............#..#. .....##.##.##....... ....#........#...... ..#.#.........#..... .#.##......#..#..##. #.#........#........ ##.#.##.....#....... .......#.....####### ##......#.#......##. ....##..#....#..##.# #...##..###..#...#.# ...
output:
6
result:
ok 1 number(s): "6"
Test #14:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
1 50 ....#.#####.########.#.#...##..#..#..##.....##.#..
output:
25
result:
ok 1 number(s): "25"
Test #15:
score: 0
Accepted
time: 10ms
memory: 6984kb
input:
50 50 ....############################################## ##..############################################## ....############################################## ...#....########################################## ..#.....########################################## .....#..###############################...
output:
22
result:
ok 1 number(s): "22"
Test #16:
score: 0
Accepted
time: 5ms
memory: 5636kb
input:
40 50 ...###############################................ .....#############################...############. ##....############################..#############. ###...############################...############. ####...###########################...############. #####...###########################..##...
output:
9
result:
ok 1 number(s): "9"
Test #17:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
8 13 .##.......... .##..#######. .##......###. ...#.....###. ....###..###. ##..###..###. ##.......###. ##.......###.
output:
1
result:
ok 1 number(s): "1"
Test #18:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
10 15 ...#........... ............... .#............. ...#........... ......#.#.....# .....#.....#### ....#.....#.... ...#...#.#..... ...#........#.. ...##.......#..
output:
2
result:
ok 1 number(s): "2"
Test #19:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
50 3 .## .#. #.. ..# ..# #.. ### ... ### ... ### ##. ... ... ##. .#. #.. ... ##. ... #.. ..# ..# ..# ##. ..# ..# #.. .## ... ##. ..# ... ... ### ..# .#. #.# #.. .#. ### ### #.# #.# ### ..# ### ... #.. ..#
output:
21
result:
ok 1 number(s): "21"
Test #20:
score: 0
Accepted
time: 11ms
memory: 6100kb
input:
50 50 .##...#..########################......########### #######..########################......########### #######..########################..##..########### #######..########################..##.........#### ####.....########################....#.........### ####....#.....##############.....#....#...
output:
29
result:
ok 1 number(s): "29"
Test #21:
score: 0
Accepted
time: 1ms
memory: 4024kb
input:
20 30 .....####......####........... ###..####..##..####..########. ###..####..##.....#..####..##. .....####....#....#..####..##. ....#....#....##.....##....... .###......##..##.....##....... .###..##..##..#########..##### .###..##..##..######.....##### ......##..##..######....#..... .....#....##..#...
output:
6
result:
ok 1 number(s): "6"
Test #22:
score: 0
Accepted
time: 2ms
memory: 4616kb
input:
25 36 ....###########....................# ##..#############...##########....## ....#############....########....### ...#.....#########...########...#### .##......##########....######..##### .##..##..##########.....#####..##### .....##..###########......###....... ....#....#############.......#........
output:
11
result:
ok 1 number(s): "11"
Test #23:
score: 0
Accepted
time: 1ms
memory: 4464kb
input:
50 50 ##................................................ #################################################. ####.............................................. ####.............................................. ####..############################################ ####......................................
output:
3
result:
ok 1 number(s): "3"
Test #24:
score: 0
Accepted
time: 19ms
memory: 7600kb
input:
50 50 ################################################## ################################################## ################################################## ################################################## ################################################## #######################################...
output:
99
result:
ok 1 number(s): "99"
Test #25:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
50 50 ................#.....#....#..........#..#..#....# #...........#........#..................#......... ....#......#....#..........#...................... #...............#.##.....#..#...#.#.#.#...#...#... .........#..#..............#...........#....#..... .......##.....#.........##....##..........
output:
0
result:
ok 1 number(s): "0"
Test #26:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
4 2 #. #. ## ..
output:
2
result:
ok 1 number(s): "2"
Test #27:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
1 1 .
output:
0
result:
ok 1 number(s): "0"
Test #28:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
4 6 .##... .#.... ##.... ....#.
output:
1
result:
ok 1 number(s): "1"
Test #29:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
4 3 .## ### .#. #.#
output:
3
result:
ok 1 number(s): "3"
Test #30:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 2 .# #.
output:
1
result:
ok 1 number(s): "1"
Test #31:
score: 0
Accepted
time: 2ms
memory: 4640kb
input:
25 36 ....################################ ##..################################ ....################################ ...#.....########################### .##......########################### .##..##..########################### .....##..########################### ....#....##########################...
output:
10
result:
ok 1 number(s): "10"
Test #32:
score: 0
Accepted
time: 3ms
memory: 4544kb
input:
50 50 ..#.#####....##...#..##.##....###....##.##.####.#. ..#######...#..###..#....#..##..###.....##...#...# ..#.#..#........#..####..#######.##...##.###..#.#. ###.....#......#..#.##.#....##..#.#............... ....##.##...#.#....#.#####.......#..#.....##...##. ###..#..##..#..#.#...##..........#........
output:
29
result:
ok 1 number(s): "29"
Test #33:
score: 0
Accepted
time: 0ms
memory: 3812kb
input:
6 10 .##.....## .##..#.... .##...#... ...#...##. ....#..##. ##.....##.
output:
2
result:
ok 1 number(s): "2"
Test #34:
score: 0
Accepted
time: 1ms
memory: 4076kb
input:
18 13 #..#..#.#..#. ...#....##.## ###...#.#.... .###...#.#.#. ...###..#.#.. ..#.....####. ##...####.... ..####.#..... #####...#.... ..##.##....## .#....#..##.# #..#......### #.#.##...###. #..##.......# #.####..#...# #.#.#...#...# ...#.#.##.### ...#.#.###..#
output:
11
result:
ok 1 number(s): "11"
Test #35:
score: 0
Accepted
time: 7ms
memory: 5416kb
input:
45 50 ....#######...##################.......###........ ##..#######....#################..##...###..#####. ....########...#################..##..####..#####. ...#.....###############.....###..##........#####. .##......###############.....###....#......#....#. .##..##..###############..#.....#....##...
output:
24
result:
ok 1 number(s): "24"
Test #36:
score: 0
Accepted
time: 0ms
memory: 3788kb
input:
5 10 ..#.#.#.#. .#.####.#. ##...#...# ######.##. .###.###.#
output:
6
result:
ok 1 number(s): "6"
Test #37:
score: 0
Accepted
time: 5ms
memory: 5532kb
input:
45 50 ....#################...############......######## ##..#################...########............###### ....##################...###.........####....##### ...#.....############.....#......#########...##### .##......############..#......#############...#### .##..##..############...#..#..#########...
output:
24
result:
ok 1 number(s): "24"
Test #38:
score: 0
Accepted
time: 0ms
memory: 3984kb
input:
1 1 #
output:
1
result:
ok 1 number(s): "1"
Test #39:
score: 0
Accepted
time: 2ms
memory: 4504kb
input:
25 36 .....#################.............. ###..#################...##########. .....#################...##########. ....#......###########....#########. .###.......############........####. .###..###..#############........###. .###..###..##################...###. ......###..###################..###...
output:
8
result:
ok 1 number(s): "8"
Test #40:
score: 0
Accepted
time: 12ms
memory: 4820kb
input:
50 50 .#..#..##..#......####...##....##.##...###....#..# .....#.#..###....##..#####..##..###.##.##.#.#.#.## #.#..##.#..#....##..#..##...#.##..#########.#.##.# ###...#.#....##..##.###....#.##..#...####.#.####.# .#.#.#.#...#..#####.#.##..##.#.##..##.#....#####.. #.##.#.#####....###.###.......##..###.....
output:
43
result:
ok 1 number(s): "43"
Test #41:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
6 10 .#.....#.. ....#..##. ...#...### ###...#... .##..#.... ..#.....#.
output:
2
result:
ok 1 number(s): "2"
Test #42:
score: 0
Accepted
time: 0ms
memory: 5680kb
input:
43 50 ##...#............################################ ######.....................####################### ###############..................################# #########################...........############## ###############################.......############ ######....................#######.........
output:
6
result:
ok 1 number(s): "6"
Test #43:
score: 0
Accepted
time: 0ms
memory: 4056kb
input:
15 10 ....##.... ##..##..#. ##..##..#. ....##..#. ...#....#. .##.....#. .##..####. .##..####. .....####. ....#..... ####...... ####..#### ......#### ......#### ..........
output:
2
result:
ok 1 number(s): "2"
Test #44:
score: 0
Accepted
time: 2ms
memory: 4044kb
input:
30 30 ##...#####.....#.##..#.##.#### #.#...#.#.####.##.###..#.#..#. ##..#..#.#....#####..#..#..... .##.#.##..#...####..#..#..##.. #.####..##...##.#....#.###...# #.###.####.#....###.#...#.#... .#..#.#.##..#...##.......##.#. ...#.#.##.#.#.#.#.#####.#.#### ##.#....###..#.#..###....###.# .##.##.#..###.#...
output:
27
result:
ok 1 number(s): "27"
Test #45:
score: 0
Accepted
time: 3ms
memory: 4116kb
input:
50 50 ....#.#..#.......#..#...##......#.#....#....#...#. ...#..##....#.#.....##.#........###.....#......... .......#.#......#.#.....##.....#.#..........#.#... .#.......#...##.#......#.....#.#...##.##.....#.#.# ....#..#..............#.#..#....#..#......#.....#. ...#...#...#......##.....##.#.....#..#....
output:
22
result:
ok 1 number(s): "22"
Test #46:
score: 0
Accepted
time: 1ms
memory: 4040kb
input:
35 35 ##................................. .#.........................#.#..... ........#.................#....#... ...#....#...........#.............. ...#.##...#............##......#... ###.#.##..#........#..#........#... #.......##..##.#.#...##.#..##...... #.#.#.#.#..##......#.#..#....#..... ###.##...
output:
16
result:
ok 1 number(s): "16"
Test #47:
score: 0
Accepted
time: 1ms
memory: 3984kb
input:
36 25 .......................#. #.#....#.#.##.#........#. ..#.##.#.##.#..##..#.##.. ####............#..#..... #...##.......##.#..#..... ##.##.#..#...#.#......... .#.####..##......#.....#. ...#.##....#..........#.. ##.....#....#..#..##.#... .#......##...#.....#...#. .#...#...#...###.......#. .#..##.....
output:
11
result:
ok 1 number(s): "11"
Test #48:
score: 0
Accepted
time: 5ms
memory: 4480kb
input:
50 50 ####.#.#.###.#.##.....#.##.#.##.............#..#.. #....#.#..#..##.......#...........##.#......#..... ##.......##.##........#...#.###..##...##....#...## ........##.#.##.......#.#..##.#................... ..#.#......#.#.#...#..#........#......#..#........ ##.......##..###......##.#......#....##...
output:
27
result:
ok 1 number(s): "27"
Test #49:
score: 0
Accepted
time: 2ms
memory: 4052kb
input:
20 49 #..#.###.#...##..######..#..#.#.##.##....#..#.#.# #...##..####.##.####.#.#.#.##.#.#..#.######....#. .##.###.#.#..#####.####.#.##..###.##.####.##.#.## ...#.###....#######.#.#..#.....##.##..##.#...#.## .##..##.###.#.....###.....#.#..##.######...###### ##.#.##.#..##......###..#..#..##.##...##.###...
output:
32
result:
ok 1 number(s): "32"
Test #50:
score: 0
Accepted
time: 2ms
memory: 5092kb
input:
50 50 ###.....#.....#................................... .##..#..#..#..#..################################. .....#.....#.....################################. .....#.....#.....###.............................. ####################.............................. ####################..#################...
output:
3
result:
ok 1 number(s): "3"
Test #51:
score: 0
Accepted
time: 2ms
memory: 4652kb
input:
25 36 .......############################# #####..############################# #####..############################# .......############################# ......#.......###################### .#####........###################### .#####..####..###################### .#####..####..#####################...
output:
7
result:
ok 1 number(s): "7"
Test #52:
score: 0
Accepted
time: 10ms
memory: 6220kb
input:
40 50 #################..##################...########## #################..###############......########## #################..############.........########## ############################........############## ########################.........################# #####################.........#########...
output:
48
result:
ok 1 number(s): "48"
Test #53:
score: 0
Accepted
time: 5ms
memory: 4836kb
input:
50 50 .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...
output:
49
result:
ok 1 number(s): "49"
Test #54:
score: 0
Accepted
time: 12ms
memory: 6556kb
input:
50 50 ######........................#............#...### #############################################..### #############################################..### ##############..#############################..### ##############....########....###############..### ##############......######......#######...
output:
32
result:
ok 1 number(s): "32"
Test #55:
score: 0
Accepted
time: 0ms
memory: 3700kb
input:
3 3 .#. ### .##
output:
3
result:
ok 1 number(s): "3"
Test #56:
score: 0
Accepted
time: 1ms
memory: 3928kb
input:
50 50 .#..#.......#.##...#..#....#..#.#.............#... #....#...#.#..........#..#.#.....#......#......... #.....##.#..#....###...............#...#.........# #........##..#...#..##..#..............#.#.#...... ##.#..................#.............#........#...# ..........#...###.#.#.....#.....#...#.....
output:
4
result:
ok 1 number(s): "4"
Test #57:
score: 0
Accepted
time: 1ms
memory: 4228kb
input:
20 30 ...#################.......... #..#################..#######. ...#################..##...... ...#################..##...... .###################..##..#### ...#################..##...... ...#################....#..... #..###########......#....####. ...###########.......##..####. ..#......#####....
output:
6
result:
ok 1 number(s): "6"
Test #58:
score: 0
Accepted
time: 2ms
memory: 5528kb
input:
40 50 #.....#####...........#############.........###### ####..#####.....####..############............#### ###...#####...######..###########....#####.....### ###...####...####.....##########....########....## ##...#####...####....#.............##########...## ##...#####...####..##.............#####...
output:
9
result:
ok 1 number(s): "9"
Test #59:
score: 0
Accepted
time: 0ms
memory: 5612kb
input:
50 43 .#####..################################### .####...################################### .#####..#############......################ .##################...........############# .################.......#.......########### .###############......####.#.....########## ..#############....###########...
output:
6
result:
ok 1 number(s): "6"
Test #60:
score: 0
Accepted
time: 4ms
memory: 4132kb
input:
50 50 #####...........####.##.###########....#..#.#....# #..##..##.##...#####.##.###..###.#..#...#.......#. .#......####.##.#####.#..#..#.###..#..#...#....... ...#############.......#.####.#.........#......... #.#.###.....#####....##..#..###.........#......... ##.#..#..#..#...#......###...#..#..#.##...
output:
32
result:
ok 1 number(s): "32"
Test #61:
score: 0
Accepted
time: 9ms
memory: 5504kb
input:
50 50 ####............############..####.##########..#.# ##..###.#.##.#.##.#.########.#..###.#########.#### #.##.###.#####.#.#.#####.##.#####...##.########.## ###..####.######.##..####.#..##.........#......... #.######.#..#...#######.#######.........#......... ..###...##..#.###.####.##.###...##...##...
output:
31
result:
ok 1 number(s): "31"
Test #62:
score: 0
Accepted
time: 4ms
memory: 4292kb
input:
50 43 ....#############...#.###.##.#............. ...###...#.###......#.#..#................. ...#####.###..#..###..#.#..#............... ##########.#........#....#................. ####....#..#..##.#...#...#.#............... ####......#..##.#..#.#....#................ ###.......##..#.....#..##...#....
output:
38
result:
ok 1 number(s): "38"
Test #63:
score: 0
Accepted
time: 5ms
memory: 4804kb
input:
50 50 #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.# #.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#. .#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....
output:
50
result:
ok 1 number(s): "50"
Test #64:
score: 0
Accepted
time: 13ms
memory: 6784kb
input:
50 50 ######........................#............#...### #############################################..### #############################################..### #############################################..### #############################################..### #######################################...
output:
31
result:
ok 1 number(s): "31"
Test #65:
score: 0
Accepted
time: 0ms
memory: 3644kb
input:
4 6 .##... .#.... ##.... #...#.
output:
2
result:
ok 1 number(s): "2"
Test #66:
score: 0
Accepted
time: 3ms
memory: 4468kb
input:
50 50 ..##.#....#.........#...#..#.....#...##.#.....#... ........#..#.#............#....#.#......#...#..... .#....#.#.......#..#..#.....................##..#. #..........#.#.###.#.....#...#........#.#.....#.#. .....#####.##....#...##..#.......#...#...##....#.. ....##.#.#..##..#...#.#...............#...
output:
13
result:
ok 1 number(s): "13"
Test #67:
score: 0
Accepted
time: 8ms
memory: 6032kb
input:
43 50 .#################################................ ##################################................ ##################################..############.. ##################################..############.. #..###############################..#############. #..###############################........
output:
38
result:
ok 1 number(s): "38"
Test #68:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
15 10 .......... #########. .......... .......... .######### .......... .......... #########. ......###. ......###. .###..###. .###...... .###...... .######### ..........
output:
0
result:
ok 1 number(s): "0"
Test #69:
score: 0
Accepted
time: 1ms
memory: 3808kb
input:
11 18 ##....##..####...# ##.##..##..##.#.#. ...##.#.##..#.##.# #...########...### ..#.##.#.#.##.#.## #####....#..###.## .###...#.##.##.#.. #..##.#.#####..#.. ####..#..####..### #.#..###.#.##.#### .#.###.#.##.##....
output:
15
result:
ok 1 number(s): "15"
Test #70:
score: 0
Accepted
time: 1ms
memory: 4384kb
input:
36 25 .#....................... ....#####..#.#.#######... .....############..##.##. ####.#.#.###..##.##.###.. .#####.####...........#.. #.##.##...............##. #............#.###...###. .#......#.#########..###. ##...##.##..##.####..###. #...#########.....#...#.. ##..#.#..##..#.##........ .#..##.#...
output:
8
result:
ok 1 number(s): "8"
Test #71:
score: 0
Accepted
time: 4ms
memory: 5064kb
input:
50 40 .#.##.##..#.#........................... ###..##.####.......#####.#####.#.#..#... .#######.#.#....##...###.##.#.#######.#. ###.#######...###..####.########.#####.. ..####.##......####.########.####.##.##. .###..###....#####.####.#.#.##.######... ..#####.##..#.##.###.###........##..###. .#...##...
output:
9
result:
ok 1 number(s): "9"
Test #72:
score: 0
Accepted
time: 1ms
memory: 4280kb
input:
50 43 .#......#.#..#.####..#.#.#.....#.#.#.#..... ..#....##.###.##..###.#.#..#......#..#....# ..###...#.#....##...##.....#.#######...#.## ..#......##.##....##.####..##.#.###.#.#..#. ...###.#..###....#....#.#....#.#.####..#### .....#.#..##...##..#..#..........##.#....## ....#....#####..####...#.........
output:
5
result:
ok 1 number(s): "5"
Test #73:
score: 0
Accepted
time: 2ms
memory: 4340kb
input:
50 50 #.##.....#............###.##...........#.....#.... ..##..#..#..####.###..#.####..#.....#............. ..##..#..#..#.........###.##..#..#.....#..#..#..#. .#.#..#...............###.##..#..#..#.....#..#..#. .##......#........#..#.##..#..#..#..#..#.......... ..#......#..##..############........#.....
output:
7
result:
ok 1 number(s): "7"
Test #74:
score: 0
Accepted
time: 1ms
memory: 3840kb
input:
36 25 .......................#. ##....##.#.##.#....#.#... ....#.#..#...#....#.#.... #..#..........#......##.. .................#......# ##...........##.........# ....#.#..##...........#.. #.###.#....#.........#..# .......#....##...#.#...## ........##......#.#.....# .#..##...#....##...#.#.#. #....#.....
output:
10
result:
ok 1 number(s): "10"
Test #75:
score: 0
Accepted
time: 9ms
memory: 4592kb
input:
44 50 .##.#..#.##..##......#.##.##....##.#.#####.#..#### ...#.########..##..#.#.#...#.#####.#......#.#.#### .#..#...#....####..........####...####........#.## #.#.#....#...##.##.###.#....#..###.#.....##...###. #.######......#..#.##.##.#.....###.##..#####...##. .....#.###...##.#.##.####...####.######...
output:
42
result:
ok 1 number(s): "42"
Test #76:
score: 0
Accepted
time: 10ms
memory: 5604kb
input:
50 50 ....############.....######......########....##### ##..###########....######.....##########....###### ....##########....#####......##########....###...# ...#....####....#####......###...#####....###....# ..#.....##.....#####.....###.....###....####....## .....#..#.....#####....###......###.......
output:
19
result:
ok 1 number(s): "19"
Extra Test:
score: 0
Extra Test Passed