QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#24347#2563. Curly RacetrackWu_RenAC ✓7ms3984kbC++172.1kb2022-03-29 22:20:332022-04-30 05:29:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 05:29:51]
  • 评测
  • 测评结果:AC
  • 用时:7ms
  • 内存:3984kb
  • [2022-03-29 22:20:33]
  • 提交

answer

#include <bits/stdc++.h>
#define No() puts("-1"),exit(0)
using namespace std;
int n,m,t=0,head[10010],o=1,S,T,cnt,cur[10010],dep[10010];
char s[110][110];
struct seg{
	int ty,x,l,r;
}st[10010];
struct edge{
	int to,link,w;
}e[30010];
void add_edge(int u,int v,int w){
	e[++o]={v,head[u],w},head[u]=o;
	e[++o]={u,head[v],0},head[v]=o;
}
queue<int>q;
bool bfs(){
	for(int i=1;i<=cnt;i++) cur[i]=head[i],dep[i]=0;
	dep[S]=1,q.push(S);
	while(q.size()){
		int u=q.front();q.pop();
		for(int i=head[u],v;i;i=e[i].link) if(!dep[v=e[i].to]&&e[i].w){
			dep[v]=dep[u]+1,q.push(v);
		}
	}
	return dep[T];
}
int dfs(int u,int in){
	if(u==T) return in;
	int out=0;
	for(int &i=cur[u],v;i;i=e[i].link) if(dep[v=e[i].to]==dep[u]+1&&e[i].w){
		int res=dfs(v,min(in,e[i].w));
		in-=res,out+=res;
		e[i].w-=res,e[i^1].w+=res;
		if(!in) break;
	}
	return out;
}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%s",s[i]+1);
	int ans=n*m;
	for(int i=1;i<=n;i++){
		int k=-1,w=0;
		s[i][0]='1',s[i][m+1]='4';
		for(int j=0;j<=m+1;j++){
			if(s[i][j]=='x') k=-1,ans--;
			if(s[i][j]>='1'&&s[i][j]<='4'){
				int p=(s[i][j]-'1')>>1;
				if(k>=0&&((j&1)^(k&1)^w^p)) st[++t]={0,i,k+1,j-1};
				k=j,w=p;
			}
		}
	}
	for(int j=1;j<=m;j++){
		int k=-1,w=0;
		s[0][j]='1',s[n+1][j]='4';
		for(int i=0;i<=n+1;i++){
			if(s[i][j]=='x') k=-1;
			if(s[i][j]>='1'&&s[i][j]<='4'){
				int p=(s[i][j]-'1')&1;
				if(k>=0&&((i&1)^(k&1)^w^p)) st[++t]={1,j,k+1,i-1};
				k=i,w=p; 
			}
		}
	}
	for(int k=1;k<=t;k++){
		if(st[k].l>st[k].r) No();
		if(st[k].ty==0){
			int fl=1;
			for(int j=st[k].l;j<=st[k].r;j++) fl&=s[st[k].x][j]=='o';
			if(fl) No();
		}
		if(st[k].ty==1){
			int fl=1;
			for(int i=st[k].l;i<=st[k].r;i++) fl&=s[i][st[k].x]=='o';
			if(fl) No();
		}
	}
	ans-=t,cnt=t,S=++cnt,T=++cnt;
	for(int i=1;i<=t;i++) for(int j=1;j<=t;j++) if(st[i].ty<st[j].ty){
		if(st[j].l<=st[i].x&&st[i].x<=st[j].r&&st[i].l<=st[j].x&&st[j].x<=st[i].r&&s[st[i].x][st[j].x]=='.'){
			add_edge(i,j,1);
		}
	}
	for(int i=1;i<=t;i++) st[i].ty==0?add_edge(S,i,1):add_edge(i,T,1);
	while(bfs()) ans+=dfs(S,2e9);
	printf("%d\n",ans); 
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3740kb

input:

4 5
4...x
.2..2
.o1x.
3..3o

output:

12

result:

ok 1 number(s): "12"

Test #2:

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

input:

2 3
4o2
3x1

output:

-1

result:

ok 1 number(s): "-1"

Test #3:

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

input:

100 47
.....4.42..4.2....4242........o242424....o4....
3...3........31...1......2..3...o1313.......13.
.o..........2...14...........2..4........2..2..
..................2....232.......4..13..x.41...
42...1.4....3..3...1.2.32...1...4...424..2...4.
.1.3.2...242...4...4..............23...........
..x.....

output:

4166

result:

ok 1 number(s): "4166"

Test #4:

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

input:

100 100
.4o.4.....2.....24....2..........o............................4..2.o..4.o....2.4...24.o.24....2.....
4...3....3..o...1.....14..o.1......3..41.2.13..14.4.1...o..2.41.........3.3..................1.4....
..2.......1.....24.4.42...1.....1.........2.23o.13..2........3....3.41.4............2o..41...

output:

8860

result:

ok 1 number(s): "8860"

Test #5:

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

input:

47 100
..424....4........24.4.......4242..2.24.....24....2....4...4.4..2......2o24..2..4.2.2.2.24...242..42
.2.............3.3...............3....31.o1.1........3.3..2.......1.1....13.o....23.......13...14.3.
..1....32..3.1..2414.1........242..3..2..1o14......3..1.14....2.2.4..o.14.x..o1.....2.2.......

output:

4118

result:

ok 1 number(s): "4118"

Test #6:

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

input:

100 47
..42.............4...2....24...2..2............
.....1.....x.1.2..2......4.....31.....4.o1.2...
.41.14.....42423...2.....3...2x2.....2.3.......
...4232...3.......o..o4.....2.1....x......3..3.
..1........4....2.1..........o.1....24.1....2..
..4....1.3......1...3....1......1..31.2.31.....
..1.....

output:

4123

result:

ok 1 number(s): "4123"

Test #7:

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

input:

100 100
...2.2..4.o2...42...242o.42o.......24......4......o.o.o2o...o2......2..2.2..24.2.2.o4..o...4.o4...4.
.2o..1.......1....23.....31323..o...13241....1.o...23.31......3.2..2.31.1..o..o.31..31..423.1...1.1.
..o.....o..o2..41.....2......4.3..4.241....1o.2..oo..2oo.....o...o...4.4...3........4........

output:

8799

result:

ok 1 number(s): "8799"

Test #8:

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

input:

47 100
o......2...o4...........2...o4oo...2o...o424..42....4..4......24.......4.o.4.42424....4..2.2........
3.3.2o.1.1..13.3...o....o.23.3.....13.o2.o....3..o2..oo.24......o1.41o...1.1..13..2...o.4..3oo...3..
..o1.....24.....o..3...4241.2..o..32.o4o4...31.o.....o.o..3.4.4..24o4.32.oo........231........

output:

4143

result:

ok 1 number(s): "4143"

Test #9:

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

input:

100 47
4...4.......242..o4o..oo..o...242...o4..o.4.2.o
..x4.1..o...o......3.o..4.....13oo2ox.o.......1
4..3......oo......2.4..23.42.o....3.1o1.o3..3..
3.1..2..3.....o..o3...2.2..3.4..o..2.142.....3.
....o1.24...2...4.4.2...1...o.o.3...o4o32o.....
....4...3.4...23o...3o3..1......4...1.2.141....
ooo.o...

output:

4138

result:

ok 1 number(s): "4138"

Test #10:

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

input:

100 100
.o4.2.4..4..42.424.2....2........4.4.o.2.......o4..4o...4o4.42..2o2.o.4.2...o242.2...2..4..4..oo.2..
o.o....3....o3o.13...o1.......o..1...1....o.23o3o...13..1....1..131.3..o.1..1.....o.....o...32.o3.32
...o....4.1..232......2...o..3.o42.3.41.3.o.3...4........o....3o....x1..2.....42..4.oo.4.....

output:

8788

result:

ok 1 number(s): "8788"

Test #11:

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

input:

47 100
...o.4......4.o.42.4.oo...o...2o.o.4......o...42.oo2.2..o.2......4.2.2o..o.o.o.2..oo.o2o2..2.....o.o
.......1.o1.3oo.3.4.41....31..o1o1o.o2....3.1...oo3.oo.o.3....o4o.o...13.1.o3.3o...x...o1o.....4....
...o1.......42..o13.324.o..41..o2...3....323...3...2....2.3...31.2414.2..o.o..o..o.o..o.2.4...

output:

4128

result:

ok 1 number(s): "4128"

Test #12:

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

input:

100 47
..24.4.o..2.2.2.2.4oo...........42....2...4...2
....o..o3.3oo..o..3o.oo....3.o1....3....241....
4....o.o.1.ox31....4.o4.413...2......1.1..24...
..ooo...4.2o....o4.o4..o..4.2.o........2....x4o
oo....x.1o.o..4.3...1.o1.3...32x....o..314..3.2
..o2o1.......2o.2.41.1...2..o232.o......o3o32.1
.o2.o...

output:

4148

result:

ok 1 number(s): "4148"

Test #13:

score: 0
Accepted
time: 7ms
memory: 3960kb

input:

100 100
.o4.o.4.......2..4oo....o........2.o.4..oo.o4o.2.4.24o...2.42.....2.o......2..2...o.....2.o4o4...oo.
.3.3...3.1..oo.3..314o4...14....xo1o.....1o1..4..3x...oo....3.o..13.o.o3.4..o.14.o3..1..o.o.o.....o1
4..oo3.2...o..1o.4.4o......o.o3.....o2o.4242o.314...3.24o..32.ooo...4o.2o.3...41o2.2..3.4o...

output:

8770

result:

ok 1 number(s): "8770"

Test #14:

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

input:

47 100
.4oo..o.2o....2o...2.oo.o4..o.24.o.2.4..2...o4o...o...o2.o4.o..42o...2o.....o..........24.oo.4....o2
4......3...3oo..oo3o....o.x.3..1o1.14.4o313..o.o3..o.o1.....o14.3.o...oo.....o....o3....o...31..3...
3...42....oo..oo.o2o2.2.4.4....o.4.o...o..o.4.1.23o4...4ooo32oo...1o.4.4..13..4.o.o..o..2.....

output:

4144

result:

ok 1 number(s): "4144"

Test #15:

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

input:

100 47
..2o24..o.o....2...o.o2.oo.2..o.4..o.42.2oo....
3.1.31.o.3o..1.1..1.o.1..o..32x...4..o.o13.....
o.2o2o..oo.o.42o....o4.o2......o23o314..2.o...o
oo...141....1.31.o.32o.4..2..4....424..3.....4o
.1424o32...24.4o.o3....3.....32..1..o.ooxoo4..o
..1o.oo3.1.o3oo..o4...3.......313...2..3..3o4o.
o.ooo...

output:

4167

result:

ok 1 number(s): "4167"

Test #16:

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

input:

100 100
........o24.o.o.o.o.2o...4.42o.o..o4.24.2.......24o.oo2o..2o.2..o.2.oo2o........2.o...4o.....o....oo
o..2.3..3...o.o.o2...31...13..oo...1..1.1.1o23o....4o3oo.o.13......2.o.oo...o4.o....3..1o.x..3oo...1
3o4ooo.o.4o.o3oo....oo...oo..o3.31.o..o..4..3o....oooo...232.4o.o.o.4.o...oo.3....232.4oo....

output:

8740

result:

ok 1 number(s): "8740"

Test #17:

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

input:

47 100
x....24..42.o42oo42...4o4.....4..24o..o.o.o42o24..4...24.o..2.2....2...2o.x4..2.2..o.o....4o....4o..
...1.o....oo..31..o..4.1..o1oo324.o1......o.....o.o.24..4o.231..o1o13o....4.4.1.xo.oooo2o.o...o.o32.
........24...o....2..1o.2o.....31.o.2314.o.1.....4...oo...1.2...3.o42.o.4oo....oo.....4..o....

output:

4122

result:

ok 1 number(s): "4122"

Test #18:

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

input:

100 47
...4...o...ooo.o.4.......2o....2o..2.4..oo.4...
...o...oo1.1.3.......2.o.1.....o.o.14.2o..4o3.o
o.4.4o.23.2...oo..31..o..o....o2.2o2...o..3....
.414...o.......o.oo...o32x.o..1.o3...1...o...oo
3..o.....o4o......32.14o31..o..4....o2.o.1ooo..
42....x.o..1o...o2.oo2...oo...o14.3..o24..o..2.
..oo3...

output:

4125

result:

ok 1 number(s): "4125"

Test #19:

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

input:

100 100
.4.2..24...4...4......4.....2.....2....4...4.24......4..4...............4..4..24...2..4..4.o......42
.....o....3...3...2..o.2..o.3o.........1..........3...3...........2....4....3o..1.oo...14...........
...............4.......o........o.2...2.1............42......4............4.4..o........1....

output:

9221

result:

ok 1 number(s): "9221"

Test #20:

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

input:

47 100
.......42...........4..................2...4.o......4.24.......4............2....2....o...4..2...o..
.........1....2o.......2................o..1...........1....o........14xo..........3......3......1.1
.........4.....2.....3o.......1..3.......4.4.......2..3.................3...2.o........4..4...

output:

4303

result:

ok 1 number(s): "4303"

Test #21:

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

input:

100 47
.....24.........o......x..4.4..o....4....2.....
.....3..........3............o3...3....3.o.....
....14...o...3................4.........4....4.
o..1.....1...4x4......o4...3..1..........3.2...
...2...x.4....2.41..23....4...2....4.......3...
..31...4....2..........42.o.....3.....42...2o..
...4....

output:

4320

result:

ok 1 number(s): "4320"

Test #22:

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

input:

100 100
..o..4...........2........2.........2................2...2..o.....4...242.2......24...242...4......2
...3.....1....42...4.......o........1....23.....o.............2o.3..o.ox1.1...1.....1o....3.....3...
.2.2..2........3o....4..24.......o..o......2..oo.........o2.........2o.3..2.......2...4..4...

output:

9187

result:

ok 1 number(s): "9187"

Test #23:

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

input:

47 100
.o....4.....24.....2.....o4o4.242......o.....2.......42..........4.....4........2....2.......o2o.x..
3............3.............o....1..o.13..1.24....4..............................3..................1
..24.o......o24........3.o....2....3.2x....3o...4..o3...4.32........4.....o32...2.....2..o1...

output:

4296

result:

ok 1 number(s): "4296"

Test #24:

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

input:

100 47
.....o......2...2.4.........42....4.4..........
...o.1....1............2..o.1.o.31....o...o3.4o
...3...1............o..1....4..o.......2....o..
........2....1o.....3...............24.32o.x4..
...3...131................3..........1.........
....3....2..3.......231.........1.4..2.3....4..
3.xo....

output:

4297

result:

ok 1 number(s): "4297"

Test #25:

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

input:

100 100
oo.......o4....2.o.....24.oo.4o4.o..o..o.o......242ooo2.o......2.2.2.o.2.o.424.o......o.o.oo..o..oo2
......o.o.1o......2..4..1...oo.3o....o.ooo2.o.o..ooo...41o....3o3......1..3o....1o.o........3.....o.
.4o.....13.o...o..............2....o....4.1....o2..4.....o.o.....o.....4o.2.oo.......o.......

output:

9173

result:

ok 1 number(s): "9173"

Test #26:

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

input:

47 100
4..o2.........2.....oooxoo2.......2.4242ooo...o.4..2......o.4242.o.....o.....oo....o..24........2..o
3..o..o.1.o.....o..4oo.ooo............ooo3o4o..3....o......3....o3.o.1.o...2.1..o..o......o.o..o1o1.
.o..o............3oo.24...o2....o..o...4o42..2...oo.3o....o.o...o2.32......3.o1...............

output:

4313

result:

ok 1 number(s): "4313"

Test #27:

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

input:

100 47
4.......o....o..2o...o.o....2.....2....o..o..o.
.o.32..o......o.o....o..32o.1.o1o...3.o.3o3...1
...2.o.......2.o4.....o4.14..o......2oo........
o..oo...oo.o......o....1o..31o.o1..o.....oo1.2.
..oo23..4o.o.o.o.o..4...o...o2..o...4.o4oo.o.oo
.2.....4.3..3..o.3..o....o1...o.1.oo...o..oo...
.o......

output:

4310

result:

ok 1 number(s): "4310"

Test #28:

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

input:

100 100
...o4.o4.4....2o.......4....o..o....24.4........4.o.o.2o2.o4...o..o..2...o...oo.o.o4.o........oo..o.
......o.o....1o1..o.o....o.oo..1.4.oo...o.....o.1.........3....3..o.o3.......o.....oo.....3.........
..o....3o.o..o..o..24.....1..42.........o..o.o...1oo....4...2.1.o....2.3...o......2....o1....

output:

9205

result:

ok 1 number(s): "9205"

Test #29:

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

input:

47 100
...........o.2o.....xo2.4....oo...2....2o..o....oo.....o.......4.......o..xooo.2oo.2o.o......4o...o.
......1.o....oo...o.o.o...........3.o..........................1o.o.o...o..3..1.o.o.....23......3.oo
oo3o4o4..2...2o....oo......3........232..3....o.......o....o....3oo.3o...o1.o.....4.....o.....

output:

4285

result:

ok 1 number(s): "4285"

Test #30:

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

input:

100 47
.24.4o42.242......2424oo.o.....2..o..42o...o4..
.oo..3.1...1..o.3....31.o1..1o1...oo..3...1.1..
....oo.....4......3....1oo4..o.......o2.32.oo..
.4.......1......3..o.o.o.1o...4......o.2..o.o41
.o.o...o..o.4.........4..o..4..2o1...4..1.ooo.o
.....14.....oo..14.o.oo...o.o.o..4..o.o........
oo......

output:

4303

result:

ok 1 number(s): "4303"

Test #31:

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

input:

100 100
.oo..oooo.....o.o.2.42...oo.o2.o.2..o..2o...o.o.2o..o.24.oo4o.oo..ooo...o4.24...4......o.....24.424o
....ooo.oooo...o..3x1o.o1o1....o.oo..2...o..o.1oo.o.oo3o....ooo..3o..o.ooo..31.o..ooo.1..4.oo..o.o..
.o..1.o1...o....3...4..o.o...ooo..23o.o......o.........o..oo.o.ooo..4..1.2.o2ooo24...2.......

output:

9119

result:

ok 1 number(s): "9119"

Test #32:

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

input:

47 100
.....o42o2o....o4oo...2......o...4o.24....2.oo...4o....o.ooo.4.oo..o.4..o4...4..o2o.......4.o2...o..
4.o..o.o3o.......o...1..o2.o2..23o..o1.1..1o.o1..oo2o1o.13..4.ooo...o....1..3.o...1.o.....1..14..o.o
.oooo....2....ooo23..o..1.oo....4.o..o32...oo..oo.xo...o..o.3..4o..o.o...2..oo1ooo.3o...o2....

output:

4297

result:

ok 1 number(s): "4297"

Test #33:

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

input:

100 47
..o...o...2...24...4o..o..2ooo2o.o4.o...oo..2..
.4...o3.oo.o..13oo..1.o..oo..o...3..1..o..ox1..
..1.1.o4.oo3o...ooo.o1.ooo.xoo..o.3ooo...2o.o.1
.o....o.1..o..o..31..ooo.oo..1....o..o....3....
..1o.32..o3.oo4....4.o....o.3.2....ooo.o.3..oo.
o14o.o...4.4.o.......oo.o242o.3...o.ooo.2..o.o.
........

output:

4290

result:

ok 1 number(s): "4290"

Test #34:

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

input:

100 100
.o.oo.oo.o.2.o..o.2o.2..2o.4.........o42o.ooo.oooo.o.oo.x..2oo...24o4.o.4o.o.....4ooo4o.oo....2.....
3.23..o3.o...3..1o.13....o...1oo.....3......1..oo3oo...........o................o.131.o.3.oo.oo..o1.
.o..o.2o.oo.oo.o.o.o.o..x.o..o.o..1..4.o..1o2...oooo.2..oo..4..o....oo.2423...4o...4...o.....

output:

9181

result:

ok 1 number(s): "9181"

Test #35:

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

input:

47 100
.....oo2...2...o..o4oo..o.4ooo.o.....ooo...o...42.o......4.o.o.oooo..o2..4....o..o...ooooo......o...
ooo.o...o..oo.o.1....32ooo1...ooo.o.231.o..1..3..o...o.1o1..oo.o3o...1o...2....o.o..1...1.....o.3o.1
4o.o.2..4.3.o3oo......oo2..o.......oo...1o1........x.1o.o4.4.o....ooo..o....23o.o.3242o..2....

output:

4301

result:

ok 1 number(s): "4301"

Test #36:

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

input:

100 47
oo....o....o.4o4oo......o.oo42.o.o2..o.o4....oo
o1..o..o......ooo.3.oo.o....1..13.3.o.1.ooo3o.1
o.1o...o.o1o1o.oo.oo..o..4..o.....42.o.2o24oo.o
oo..oo3.13.o.o..o.....o.1..1.....o31o.1.o31.4..
..3o.x2......14o.4....2..oo..o.o....4.o..2o....
.......ooo1.....ooo41...3....o..o...oo..4..o2..
4...o...

output:

4334

result:

ok 1 number(s): "4334"

Test #37:

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

input:

100 100
.....o..................4.............4.x.........2...2....o..o..4..................o...............
................2.........1.o.............o.........o..............31...........o.......o......x....
..............1.......2.................1.......o....................o......2................

output:

9650

result:

ok 1 number(s): "9650"

Test #38:

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

input:

47 100
x..................o.o...2.o...o.............................o.4.....24......x....2.................
......1.........o.o.....................o.........3...........o......o.....3.....o......o...........
..........3........o........2........1.....1............4......................oo.............

output:

4529

result:

ok 1 number(s): "4529"

Test #39:

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

input:

100 47
................o...............4..2...........
.o................o.o.o......o.................
.o.....2...32......2....2...........2..........
....o............oo..........o2....o...........
................o...............3...oo.xx......
..o....................2...o..2...........2....
........

output:

4519

result:

ok 1 number(s): "4519"

Test #40:

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

input:

100 100
....................................4............2o..........o.............o..........o.............
.oo.........o.....................o.......o........3...........3..............oo.....o..............
o...................1..o....4o.........x.........o4.......o....................2....4........

output:

9659

result:

ok 1 number(s): "9659"

Test #41:

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

input:

47 100
.........2.........................................o.....o..........2..................2..........o.
..........o........4.....3.....x.3o..........oo.....................1...........o.....o....x.1......
...............o........3...o...............1......................o..1...................o...

output:

4526

result:

ok 1 number(s): "4526"

Test #42:

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

input:

100 47
..............xo.........2.....................
...3..........o.....3....1.....1....1..........
.2............2.....4..............o...........
.x..........2..............3....3.3o...........
...3...........x.....o..........x...o..........
41.......o.................3.o.o...............
...1....

output:

4524

result:

ok 1 number(s): "4524"

Test #43:

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

input:

100 100
ooo....o.4..o.o.oo.............o2o2o...........o....2..oo..o.o4....o...oo.oo....o..oo.oo.42....2....
...o1..o.oo........o....o...o...o..o..o..ooo.o.....o.oo.o.o.....o..3.......o.o.1.....ooo....o.......
.....o..o..oo..oo.....o......o...o.o.........4o..o.1........o....ooo..o..o.oo..o..o....ooo...

output:

9666

result:

ok 1 number(s): "9666"

Test #44:

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

input:

47 100
............o.........o......o..o..o...o.o.o.........4o4..o.o.............o...o......oo.o...o...o2o.
o...o..1....3..o.o.....o...........o............o.o......o.........3....o..4..o.oo.....o..........o.
o..oo.oo.......xo........4o.............oo.o...o........o......o....o.o..o...........oo.......

output:

4522

result:

ok 1 number(s): "4522"

Test #45:

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

input:

100 47
o.4.....o4........42..o......4.o...o......oo...
3.....o...oo.o.......o.........o.oo.oo...oo.2.1
..o.....ooo..o3...oo..x...o..o...o....o.......o
....o...o.x.o..............o.oo.......o....oo..
...o........o.o.o..x..o.1........o..1.o.o.....o
4.oo.o..........o.ooo......o...o...o.......1o..
oo.o....

output:

4527

result:

ok 1 number(s): "4527"

Test #46:

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

input:

100 100
.o...o.....oo..4...o24.......o.....o....o4....o...4.o...ooo4.......oo.ooo...oo.o..o....2.o..o.......
.......oo.o.oo......x.o13.....o.oo..o...3...o..o.o...o.....o...ooo..o.o.o..3.o....o...4..1...3.o....
o.oo....o.....o..o.o...4...o.3...oo....o..4..o....o..o.....o....o.o....1.o.o...41...o...o....

output:

9648

result:

ok 1 number(s): "9648"

Test #47:

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

input:

47 100
.o..o.....o..o........o.o...o..oo.o.........oo...o....o......o..o..............o.....o.o.....o..o..o
.ox..o.....oo.4....3....oo.oo....ooo..2.....o.4.ooo.o.....4..3.3.xo.o4o.....oo.o.4........o.........
..o...2....4.4.........o........o..o1.....o.o.o..o..o1o...o.oo...o..oo......o........o.3..o...

output:

4520

result:

ok 1 number(s): "4520"

Test #48:

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

input:

100 47
.o.......oo..o2........o.2....o......o........o
..2...o.o....o.........o................oo.oo..
...o....o.4ox2oo.......o.....3.ooo....o.o...oo.
...o.ooo...2oo.o...1.ooo..3..o........3oo...o..
.ooo...o...1....o..o...o.....3.....o...........
.......o...o..o.o42o...o...o..o..o..o......4...
.oo.....

output:

4521

result:

ok 1 number(s): "4521"

Test #49:

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

input:

100 100
..o.o.o.oo..oo.....oo.oo.o.o.oo.4.4o............24.oo.....o....oooo.o4oo..o.o.o.oo..o....o...oo.o.o.
....oooo..ooo..oo.o.o.ooo.3....o.o.3o.o..3xo1....1....o.oo.o2o2o..o.o.......3.o....o.1.o.o.oo...o.oo
..o.oo.o.oo4..oo..o.o.......ooo...oooo.o.ooo.o.4....o4.2...oo.....24..o.....o...ooooo.ooo....

output:

9653

result:

ok 1 number(s): "9653"

Test #50:

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

input:

47 100
...o.o.ooo24o..o.oo..o.o2.ooo..oo.o4...oo..o...ooo...o..o.4...o..o.o..o...oooo......o..o.o..ooo...4o
...1oo....o.o.x.o3......oo..oooooo..oo.o...3ooooo..o.......oo.ooooo.o....4..oo.o.oooo.oo...o.oo...o.
o2..oo.....oo..o....o.4.o.32.....o...oo..oo.o.o......oo....o..oo........o.4oo...4.3o..........

output:

4522

result:

ok 1 number(s): "4522"

Test #51:

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

input:

100 47
.ooo4.o....4.o.o2.o.oo.4......oo.4.2..oo.o.oo.o
.oooo....o.o....o.o..o.o3oo..oo..ooo.oo1o..3o.o
...o.oxo..o......3.oo.o.4o.o.o4..2o2o.2...oo...
.o...o.2.o..o...o..o1.o.1o..ooo.....o...o.x.o..
o...3...o....o.o.oo3o..o....o..o.o.......o.o...
oo.....ooo..o.o....o.o..o1o..ooo..3..o....o..oo
o.oo....

output:

4515

result:

ok 1 number(s): "4515"

Test #52:

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

input:

100 100
o.....o..o..o.oo.oo....ooo...o....o.o.o.x.ooo....o.....o......oo...oo...xo...........oo.2.oo..o.42.o
oo....o.ooo..o...1.o..o....o.o.o..oo.......o.o.....oo...ooo.oo.o.o......o....o....o..oooo..o.o.oo..1
o...oo.......oo1.x2.o..o.4.oooo.o....3o4o.....oo4.oo..o.o.oooo.o..oooo.oo..xooo........o.o...

output:

9671

result:

ok 1 number(s): "9671"

Test #53:

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

input:

47 100
....2.o.....o.o....ooo........oo..oooo.oo.....o.o.2.oo.oo....oooo.o..2..o.....o.o.o..oo.2o..o.o...oo
oo.o..o.oo.o..o2...1....oo32oo.1ooo.....oo.3...o..ooo..o..o..o...o.o...o.o......o..o..oo..o2..o2..o.
.......oooo....o1.....oo.o...o..o........o..oo.o.o.o..o.1oo..........o...o..o.oo..o....o..o...

output:

4520

result:

ok 1 number(s): "4520"

Test #54:

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

input:

100 47
o..oo.o.o.o......o...o.o...2.......o.....o..ooo
o.....o..o..o.o.oo..o.o.ooo...ooo.....o..o.1.o.
..o.oo.....3....o....o.o...o.....ooo.2..o.o..oo
oo..4o......oo..o.ooo......oo.....o2.....o..o..
..o...ooo.o...o...o.o....o..oo.....3.oo...o1o.o
..3o.....oo..23o..oo..oo..oooo.o...2o.4...o4...
..oo....

output:

4523

result:

ok 1 number(s): "4523"

Test #55:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.313242423231324241414231424142423131414132414142423231423141413232323241414132414142424132313142.x
x4..o..o.o...o..o.o..oo.o...oo.o..o.oo......oo...o.....o....o..o..o.o.o..oo...oo.o.oo.o.......

output:

9412

result:

ok 1 number(s): "9412"

Test #56:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.41314142323231413141414142313131324142324231414241314131424231324132423141413132423142314131424.x
x4.o......oooo..oooo....o....ooo.o.......oo......ooo.o...o.....o..oo.o....o.ooo.o..o.o....o.o...

output:

9410

result:

ok 1 number(s): "9410"

Test #57:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.323132414241424232424241424142423142423242423242423242323131423142424232413242314141324241314232.x
x4...oo..ooooo....o..oo.o.oo.o.o.............o...o...o......o..o..o..oo.o.....o.ooo...ooo.o...

output:

9411

result:

ok 1 number(s): "9411"

Test #58:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.31424141414132424131314242323131423131414241414131414231424241414241424132424232423242323242313.x
x2ooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9408

result:

ok 1 number(s): "9408"

Test #59:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.313231324241314232313141424232424141314231414131414232323141414242423232313231314142413231324142.x
x3o.o..ooooo.oooo..ooo.oooo.oooo.o.oo.oo.o.ooo.o..ooo.oooo.o...ooooo..o..o.oo.oo...ooooooo....

output:

9407

result:

ok 1 number(s): "9407"

Test #60:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.23141324231413142424131314231313232424241424241423142413242313132424132424231414141313131424231.x
x1ooooo...oooooo.ooo..oo.o.o....oooo.oo...o...o.o..oooooooo.oo.ooo.o.o..o.ooooo.oo.o.oo...oo....

output:

9405

result:

ok 1 number(s): "9405"

Test #61:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.141324131313232423131324242423242313241423142424142414241323142413232423132313132323141324131324.x
x1ooooooooooooo.ooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooo...

output:

9404

result:

ok 1 number(s): "9404"

Test #62:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.13232323242314131424241324231313242314231413142313141413241324141323131413131414131413242413241.x
x1ooooo.ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9406

result:

ok 1 number(s): "9406"

Test #63:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.414141314232414241323242313131313131314131314232413141323231324142423141424141324131313241414132.x
x4.oo.ooooooooooo.oooo.oooooooo.oooooo.oooooooooooo..oooooooo..oooooo.oooo..oooooo.oooo.oo....

output:

9407

result:

ok 1 number(s): "9407"

Test #64:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.32413131423131413131323232324242324242323132424242314232313141414242313132324232313131323132413.x
x4ooooo.ooo.ooooo.ooo.oo.oo.o.oooooo.oooooooooooooooo..ooooooooooo.oooooooooooooooooo.ooooooo...

output:

9405

result:

ok 1 number(s): "9405"

Test #65:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.424232323141314231323132313131313141423241424131323241413241314141314132423241414142414132323241.x
x4ooooooooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooo...

output:

9403

result:

ok 1 number(s): "9403"

Test #66:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.42324132414132423232323132324242414131413141323132314242323131413141324141423132324231414241324.x
x2oooooooooooooooooooo.oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9403

result:

ok 1 number(s): "9403"

Test #67:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.314242424242423241414242313232324242413132323241424132423242324242424241413231413142423231414231.x
x2..ooo..o.o.oo..ooo.ooooo..o.ooo..oo..ooo.oo.o...oo...ooo.oo.oo.o.oo..ooo.o....o..o.....o....

output:

9410

result:

ok 1 number(s): "9410"

Test #68:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.41314142313231413141313242423232413131314141423232423132324142324231413131314131424241313132413.x
x2oo.o..ooooo..o..o.oo.oo.o.oooo.ooo.oo..o.o.o.o.o.oooooo...o.oooo..o.ooo.o.ooo.o.oooo...ooo....

output:

9410

result:

ok 1 number(s): "9410"

Test #69:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.323131413132424231323131313231324231324242313241313232314242314131424231414131413142323242323241.x
x2o.o.oo.ooo..oooooooooo.oooo.oo.ooo.o.o..oooooo.o...o....oooo.oo.oo...o..ooo.ooo...oo.oo.o...

output:

9412

result:

ok 1 number(s): "9412"

Test #70:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.13241313231313241413142414232413142413242314141324141324142314242424242314131313231323242423142.x
x2oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.oooooooooooooooooooooooooooo...

output:

9410

result:

ok 1 number(s): "9410"

Test #71:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.131424141314231424231413241423131424241313142413141324142324141413132414132324231324242414142323.x
x2.ooooooooo.o...o.ooo.o.oo.oo..ooo...oo.ooo.o.o..o.ooooo..o.ooooooo.oo.oo.o.o.o.oooooo..oo...

output:

9409

result:

ok 1 number(s): "9409"

Test #72:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.23142323241323242424242423142424141314132313231313231314242424131323142414142313142323232423242.x
x2ooooooo.ooooo..o.oo.ooooo.oooooooooooooo.o.oooooo.ooo..o.oo.oooooo.oo.oooo.ooooo.oo.oooo.oo...

output:

9405

result:

ok 1 number(s): "9405"

Test #73:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.141313132323132424232413241413132324241423131313231323232324141423132423231414131324142323132414.x
x3ooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9404

result:

ok 1 number(s): "9404"

Test #74:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.23231314241413232324142424142424131323242323141423241424142423131324131413232413131424241414132.x
x3..o.oo.o.o.ooo.oooo.ooooooo.ooo.ooooo.o.ooo.oooo.ooooo.oo.ooo.oooo.oo.o.oooo..ooooooo.o.ooo...

output:

9409

result:

ok 1 number(s): "9409"

Test #75:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.314142313242413142323131424232424232413131424231324242324232413131323141424242323132414241423242.x
x2.oooooooooooo.oooooooooooooooo.ooooo.oooo.ooo.oooooooooooooooooooooo.o..oooooooooooooo.oo...

output:

9400

result:

ok 1 number(s): "9400"

Test #76:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.32414131414141414232423141413131413141313231313132413132314232424141313131413231413132424141424.x
x1ooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9408

result:

ok 1 number(s): "9408"

Test #77:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.324231324132314131423242423142413232324241313132314142414142423131314141423142413141314132324232.x
x2ooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9406

result:

ok 1 number(s): "9406"

Test #78:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.42323142423231423132413141413131323232423231314232413242414241423241314142324131424232413232323.x
x2ooooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9403

result:

ok 1 number(s): "9403"

Test #79:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.141313142313242323242314132323232324232313141413232414241424141324242314141313231313141324131324.x
x1oooooooooooooooooo.o.ooooo.o..oooooooooo.ooooooooooooooooooo.o..ooooooooo.oooo.ooo.oooooo...

output:

9411

result:

ok 1 number(s): "9411"

Test #80:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.14231423242413131423141413142313132324131324231323141413242423232413131414231313132423242413232.x
x1oooo.o.o..oo.ooooooooooo.oooooo.oo.oooooooo.oooooooo..ooooooooooo.ooooooooooo.ooooooooo..o....

output:

9410

result:

ok 1 number(s): "9410"

Test #81:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.232423131324242314242414131313231313231423132413142424131324131314232323242424231314241323131424.x
x1oooo.oooooooooo.ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo.o...

output:

9411

result:

ok 1 number(s): "9411"

Test #82:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.14141424231314132313231313142323242413231314131414131323242413242323131423231313141323142423141.x
x1oooo.oooo.oooo.o...oooo.o.oooooooooo..ooooooooooo.oo.ooooo..ooo.ooooooooooooooooooooo.oo......

output:

9413

result:

ok 1 number(s): "9413"

Test #83:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.424141423142414132313232314241424142314132324242313232313242424232313242423231423231414241324132.x
x2ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9405

result:

ok 1 number(s): "9405"

Test #84:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.42423241414141324242323231414132423242313131424142323141314241314141424131424131314231324242423.x
x2ooooooooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooooooo...

output:

9406

result:

ok 1 number(s): "9406"

Test #85:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.414231414232314141313142314142324242423242413241423231313242424141314232323131313232314242424141.x
x4oooooooooo.o.ooooooooooooooooo.oooooo.oooooooooooooooo..ooooooo.oo.ooooooooooooooooooo.o....

output:

9408

result:

ok 1 number(s): "9408"

Test #86:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.32313242323132313242314231413232413131413142323232323241324142413141424142313231323132323132413.x
x4ooooooooooooooo.o..o.oooooooooo.oooooooooooo.ooooooo.oooooooooooo.ooooo.ooooooooooo.ooooo.o...

output:

9409

result:

ok 1 number(s): "9409"

Test #87:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.131414231323232323241423242314131314131314241423132324131314232314131414141324141424232423132324.x
x1ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9404

result:

ok 1 number(s): "9404"

Test #88:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.23132414232323131313232424141423131323131423141323231323232313242323242424242423141414141414241.x
x1oooooooooooooooooooooooooooooooooooooooooooo.oooooooooooooooooooooooooooooooooooooooooooooo...

output:

-1

result:

ok 1 number(s): "-1"

Test #89:

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

input:

99 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.141323242414132313131423242413141314232424131324242424131313242413232423132423231413132414142413.x
x1.ooooooooo.ooooooooooooooooooooo.oooooooooooooooooooooooooooooooooooo.ooo.oooooooooo.oooo...

output:

9401

result:

ok 1 number(s): "9401"

Test #90:

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

input:

100 99
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.13241423132414131424142424141423241324241314142423131413232324141423231413242313132314132424132.x
x1oooooooooooooooooooooooooooooooooooooooooooooooo.ooooooooooooooooooooooooooooooooooooooo.oo...

output:

9402

result:

ok 1 number(s): "9402"

Test #91:

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

input:

100 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.323141323231423242313132324141324242424131324241324232314142413142323142324232323142314232423131.x
x1oooooooo.ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

9498

result:

ok 1 number(s): "9498"

Test #92:

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

input:

100 100
.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.
x.424231414142413141424131314241323141414231414232414231414242414241413142414141423131313142313232.x
x4ooooooooooooooooooooooooooooooooooooooooo.oooooooooooooooooooooooooooooooooooooooooooooo...

output:

9500

result:

ok 1 number(s): "9500"

Test #93:

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

input:

100 100
.4..4.ox...o.oo4.4.2.2.o.24o........242o.x.o2.o...24o...oo.o...24o4.x.2o2.2...x.2x...o4...42.242.o..
.....xo.x.1...o.xo.x3.o.o3..4...o2.o.o.o........3o31x.o.13o3..ooo..1..o....x.oox.1.o.o.1.....3.xo...
3..3....x.2.o.2.....2o..o....x.x.3..........4..4...o...1..........x..2.ox..1.2.ooo4..x.......

output:

-1

result:

ok 1 number(s): "-1"

Test #94:

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

input:

100 100
..o4...x2.x...o2..o.......4.x.oo..x...4.....o.42..2....4.o.2x2.xx..........x.2...2.....4.4.o..ooo...
ox..x31.o.....o3.....32..o..x.ox..1.....2.1.o.13o.o..xooo.o....1x.o....1.o..o.x..x....o3...1.ooo3...
.o..o42.x...3.4...o.....o42..o....231..o1xo...oo14ox..1..x2........2o.ox..1oo.2.o......o42...

output:

-1

result:

ok 1 number(s): "-1"

Test #95:

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

input:

100 100
.2.o.o..ox.......o24o.2.o.......2...........24o..4.o.4....2...o.o....24..x.xoo.....o4....42..4oxo2o.
oo.oxx...o.1.o....3..x32.oo.....1..3.xo2...x..ooo...o.x...1o...o....2.1.o...x.3.....o...3.3.3...1ox.
x2..1.41......o..4.4o...2x...o...xx....o4x.o.o....2...3.41o..2.o..oo1...oo.x..4...2.2.x......

output:

-1

result:

ok 1 number(s): "-1"

Test #96:

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

input:

100 100
o.ox.....x...4...........4............2......oo..4x.o4.o..o.....o.xo..x....2.4o...x...4oo...x2.....2
x3.o...3.o..2x..4o..o.o....3xo2.o23..oo.2......o....o..x...4.x13..4..3o.x....1......o.....o.x...o.x.
..4o1.3.o..1..o.........1..2.3.xo......x.o....xx...o.4.o....3.4...o...x..o3.........3.o..4...

output:

-1

result:

ok 1 number(s): "-1"

Test #97:

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

input:

100 100
....o..o2..o.o.o....o...2oo4o4.x.o.....o.oo4.ox...o.o..24..o2...4..xo4..o..ox..24o.oo4..o..o.o.4.24.
41.o....oo...1.....o...o..1..oo..ox..1.3.3..o....xo.......o....1..x.3.o1.3..x.....31.x...32..3..o..o
32....1.o.2.....o.....o..2.x.....o4..ooo4o......o4..o......x....o23o4oxoo.3o.423...23.o......

output:

-1

result:

ok 1 number(s): "-1"

Test #98:

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

input:

100 100
...o......o4.....2.o..4...24ox2..x.....o..2x.2.2o2....o..2...o.o..x.2..o.o.oo.oo...ooo.....o...o..4.
3..o.....x.oo..1oo...o..3x.1.o....3.ooo1x4o.x..oo......oxo..xx2.oo.......o..1.3ooo.o....4.x.1.....3.
..x.o......o.4.o4o..2.4....o....4.x..........oox...o324..4o..o.4o.13...1o....x.oo...4.ooo....

output:

-1

result:

ok 1 number(s): "-1"

Test #99:

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

input:

100 100
oo.....4..2.....o.4.42...o..o...oo.2.oo....4o...o.x.o.o.2.o...2o.o4o4.o..2...4...24.....ooo2....o..2
..3.oo.o.x.1.o.x.......oo..oo.1.1...oox..1.xo..41.x.o.1o.o.....1o.x.o3.o1.......oo.o.1...x3x.o.x3..1
.x....1o.1o....o...ox.o4...4.x......ox4.o........x.2o.....1..2....oo..x..1x.....42.o.x...3...

output:

-1

result:

ok 1 number(s): "-1"

Test #100:

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

input:

100 100
......o....2.2.xoo......42.o...o4o4....2....4..o...o........4o.o..24o4....4.o2ox..x.24.o.....42o..4o
...oo....1...x3..o.1...131.o4...o.o.4.o3.42..3oo1...2.o...x...o1.2.o.....o.3..oo..4.....o1x......o..
3o.o.41.4...o1.4.o2x241..o.....24oo..o..o..1..o.........o.x..xo....2.1.1.2o2oo..1.o..........

output:

-1

result:

ok 1 number(s): "-1"

Test #101:

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

input:

100 100
4.o......o......24...2o..4..x2...4...o.x.oo4o.2o.o.o...4.42o..x.....4.....x....x...o..o.o.....4.o.x.
o....3o...oo.o..o..o..3..1..o...3..o......o.............3o.o4...xooo..1.x1....2.o..o......x2.......x
o....o.o4o.31.o32.13o4..323...o.....o1.o4o.3.o..o..........4.o4o....oo4...o...o....4....41...

output:

-1

result:

ok 1 number(s): "-1"

Test #102:

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

input:

100 100
4o.xo.2.o.4...o.o.4o.4o.o4.o....2....x.....xo..x........o..4.o.o2o.x4...xo.oo...o.....42......x.ooo.
.3....1o.o....oo..o..o32o131..3.o14....o.4...2o.4.....xx......4.....o13oo..o...o.o.2.o.oo.o....13.o2
.2o.xo....2...4ox.o....3.x...3o.oo.....o..2..32..oo...o.o4.....x..x..424.41.2..2...1....ox...

output:

-1

result:

ok 1 number(s): "-1"

Test #103:

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

input:

100 100
..o..4o..o..........4ooo..o.x.o4o.x.4.xxo.....o..o.o.xxo..o4.oo....2....2o2o.2..x.o..o..ox24...x..x.
......o.1....oo..oooo..x.o..2o...o...oo..o.........oo.....o..o...23.xx...oo13..3.1.1o....4....oxox3o
...4oo...4....oo.4o......oo...oo..o.o24.........3..o......o.o.........4oo..o42o..o.2.........

output:

-1

result:

ok 1 number(s): "-1"

Test #104:

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

input:

100 100
.2..x...o..........o...424o.o..o.o.4.o42....4..4ox..2o..2o.x.o..x.x42...o...o4..ooo2...o.4.2.o...2..
..1o.........x......o..o....3oo.o14ox3......o..oo.o....o...2.o2o.o..32o..3oo1o....x.o..o...32.o.13..
..o.....2..1..o4ox.o....1o.o..1....o3...o...o.4......14.2..1.4x1.oo.o1o....x..o..o..o..2o....

output:

-1

result:

ok 1 number(s): "-1"

Test #105:

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

input:

100 100
..o.x..o42...2.......o2...x.o..o.x.42.24.oo.o..242.24.o...2oo....oo.....xo..o..4....2.2......2.o....
...........1413.o.4.x........oo.3.x..o....3............4..o..4....3x.3.o.1.....o..3...oo41...31..4..
...o.o14..x..oo...x3..o.o...ox232.1..42o.2...3..24241.x.o..o....1...x2o132.o..2..2..o4o.o....

output:

-1

result:

ok 1 number(s): "-1"

Test #106:

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

input:

100 100
4o.2.o42......4x.4....2.2o..o.x..4...2x.2o..2..xo.4.24o....o......2.....o4...oxox2.x..o.o.4o4xo.oox.
....3.....3.4.......o.xo.x...x..o.o.......2.o....2....3.x.2.o.2.2...o...o..4..o13..........x....3...
.o....3...o.........3x1.....o.3..o..2.....3o4x...oo3.ooo.....o3.o.oo3....o....o4o.o....4.....

output:

-1

result:

ok 1 number(s): "-1"

Test #107:

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

input:

100 100
..4o....4..o....4...2....4....2.....x.oxo.xo..4ox.2......42..o424.24.o..4.4ooo4o4....o.....o2...4.o.
...x....3.4o.....4o....o.o...x..o.x.o..oo.1...oxo...o..1.oo.x1...o.x..x..o3.3...o..o..2........x3.31
.2...x.x.o...4..o.4........x31..4o...o3..o...3..o...o.o....o..xo4xo4...3.....4.......2.......

output:

-1

result:

ok 1 number(s): "-1"

Test #108:

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

input:

100 100
.o........x..o.ooo............4oo..x4...4....4...o2.3.o.o.............oo4o.....2..42o....o2o2...4o..
31.o....4......o..o.2...2....2.1..o.3.....1xo.o.o......o.3....2....3..o..o1o..4..2.1.o.xo13.....o..o
4......o.x2.....o4oo14.oo.o.ooo4...........4.24o.x4...oo...3o...ox..xo.o..o...1.x.o..14xoo...

output:

-1

result:

ok 1 number(s): "-1"

Test #109:

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

input:

1 1
1

output:

-1

result:

ok 1 number(s): "-1"

Test #110:

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

input:

1 1
2

output:

-1

result:

ok 1 number(s): "-1"

Test #111:

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

input:

1 1
3

output:

-1

result:

ok 1 number(s): "-1"

Test #112:

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

input:

1 1
4

output:

-1

result:

ok 1 number(s): "-1"

Test #113:

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

input:

1 1
o

output:

-1

result:

ok 1 number(s): "-1"

Test #114:

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

input:

1 1
x

output:

0

result:

ok 1 number(s): "0"

Test #115:

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

input:

1 1
.

output:

0

result:

ok 1 number(s): "0"

Test #116:

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

input:

2 2
42
31

output:

4

result:

ok 1 number(s): "4"

Test #117:

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

input:

2 2
oo
oo

output:

4

result:

ok 1 number(s): "4"

Test #118:

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

input:

2 2
xx
xx

output:

0

result:

ok 1 number(s): "0"

Test #119:

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

input:

2 2
..
..

output:

4

result:

ok 1 number(s): "4"

Test #120:

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

input:

2 3
ooo
ooo

output:

-1

result:

ok 1 number(s): "-1"

Test #121:

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

input:

3 2
oo
oo
oo

output:

-1

result:

ok 1 number(s): "-1"

Test #122:

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

input:

2 3
...
...

output:

4

result:

ok 1 number(s): "4"

Test #123:

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

input:

3 2
..
..
..

output:

4

result:

ok 1 number(s): "4"

Test #124:

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

input:

100 100
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

10000

result:

ok 1 number(s): "10000"

Test #125:

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

input:

100 100
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx...

output:

0

result:

ok 1 number(s): "0"

Test #126:

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

input:

100 100
....................................................................................................
....................................................................................................
.............................................................................................

output:

10000

result:

ok 1 number(s): "10000"

Test #127:

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

input:

99 99
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo...

output:

-1

result:

ok 1 number(s): "-1"

Test #128:

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

input:

99 99
...................................................................................................
...................................................................................................
.................................................................................................

output:

9702

result:

ok 1 number(s): "9702"

Test #129:

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

input:

100 100
..............x.......2.2......4....4.42.......2.2.2.2..o..o.....2...42..2.2424...2.......2...2..2..
.2..31...2.1.1........1o1.1...1............4x..........31oo3......31......3....1...4..31............
3.32........2..1......2..o.....3..14....4...........2..2...4..........4.14..2.....2.24.41....

output:

8848

result:

ok 1 number(s): "8848"

Test #130:

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

input:

47 100
4.x2..2..4.4..4..4.....4.2.4..4.o....2....o......4.4.4.....o2.........424....4..............4..4...2
3..1.31..3..2.o..3.3....2..1..1...2.....4.....1...3..3....131.14.1.1...13....o1........241..........
.........o......2.....14141...4.....3...3...232...4..23.....2.2.........................1o....

output:

4125

result:

ok 1 number(s): "4125"