QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#785018#4955. Multidimensional HangmanYarema#AC ✓68ms4416kbC++201.4kb2024-11-26 16:38:232024-11-26 16:38:23

Judging History

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

  • [2024-11-26 16:38:23]
  • 评测
  • 测评结果:AC
  • 用时:68ms
  • 内存:4416kb
  • [2024-11-26 16:38:23]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef double db;

const int P = 27;
const int N = 12;
LL pw[P];

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	pw[0] = 1;
	FOR(i, 1, N)
		pw[i] = pw[i - 1] * P;
	map<LL, int> cnt;
	pair<int, string> ans = {1e9, ""};
	
	int n, c;
	cin >> n >> c;
	vector<string> v(n);
	FOR (i, 0, n)
		cin >> v[i];
	FOR (i, 0, n)
	{
		LL hs = 0;
		FOR (j, 0, c)
		{
			if (v[i][j] != '*')
				hs += (v[i][j] - 'a' + 1) * pw[j];
		}
		cnt[hs]++;
	}
	FOR (i, 0, n)
	{
		int pos = -1;
		LL hs = 0;
		FOR (j, 0, c)
		{
			if (v[i][j] == '*')
				pos = j;
			else
				hs += (v[i][j] - 'a' + 1) * pw[j];
		}
		FOR (ch, 'a', 'z' + 1)
		{
			hs += (ch - 'a' + 1) * pw[pos];
			v[i][pos] = ch;
			int cur = 0;
			FOR(j, 0, c)
			{
				hs -= (v[i][j] - 'a' + 1) * pw[j];
				if (cnt.count(hs))
					cur += cnt[hs];
				hs += (v[i][j] - 'a' + 1) * pw[j];
			}
			hs -= (ch - 'a' + 1) * pw[pos];
			ans = min(ans, MP(-cur, v[i]));
		}
	}
	cout << ans.S << ' ' << -ans.F << '\n';
	
	
	return 0;
}

详细

Test #1:

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

input:

5 4
rat*
ru*d
rot*
r*ta
r*ta

output:

rata 3

result:

ok single line: 'rata 3'

Test #2:

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

input:

5 4
bon*
fon*
n*no
*eto
*ano

output:

nano 2

result:

ok single line: 'nano 2'

Test #3:

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

input:

100 7
o*zzegh
rkpu*gd
bza*fkh
oy*zegh
*yzzegh
yi*jvak
*yzzegh
oyzze*h
oyzzeg*
oyz*egh
oyzze*h
oyzzeg*
o*zzegh
wpryta*
oyzzeg*
oyz*egh
o*zzegh
nl*xbbs
oyz*egh
oy*zegh
vfh*rjp
o*zzegh
tsnle*r
oyzz*gh
oyzz*gh
*yzzegh
o*zzegh
oy*zegh
oyzzeg*
*ydjplh
oy*zegh
o*zzegh
o*zzegh
oyzze*h
oyzz*gh
oyzze*h
ta*cud...

output:

oyzzegh 58

result:

ok single line: 'oyzzegh 58'

Test #4:

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

input:

100 3
*fc
*fc
qu*
ow*
*ly
l*f
e*c
lu*
y*g
ef*
lu*
ef*
ef*
*td
lu*
*uf
g*l
lu*
r*i
e*c
mg*
*wc
h*h
kj*
*dm
*ly
*ou
lu*
e*c
*uf
e*c
lu*
*fc
ef*
ef*
gi*
*ju
*fc
lu*
ef*
ef*
l*f
*uf
l*f
*fc
*uf
c*p
*uf
ef*
lu*
e*c
l*f
*uf
z*f
tr*
e*c
lu*
e*c
*fc
e*c
lu*
*uf
t*j
lu*
*ur
lu*
lu*
e*c
l*f
*uf
*uf
lu*
*gs
*k...

output:

luf 35

result:

ok single line: 'luf 35'

Test #5:

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

input:

100 1
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*

output:

a 100

result:

ok single line: 'a 100'

Test #6:

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

input:

100 6
uqfd*c
mvqt*e
h*grls
kqsx*r
o*pqwj
fhdc*w
*qsxrr
kp*blm
*qsxrr
coc*sn
qxf*ge
mvqt*e
yms*yl
*vqtie
mvqt*e
uo*upe
*fmcou
otme*r
t*xgkv
otmew*
mv*tfa
tk*gkv
kqsxr*
*kfqzb
gt*ncx
ssfqz*
mvqti*
mvqti*
kqs*rr
tkx*kv
oe*hai
tkxgk*
m*qtie
eww*zd
otmew*
mvqti*
tkx*kv
r*pcra
t*xgkv
otmew*
m*qtie
*kfqzb
...

output:

mvqtie 17

result:

ok single line: 'mvqtie 17'

Test #7:

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

input:

100 2
u*
*u
*t
*j
u*
s*
v*
v*
*b
h*
*o
u*
o*
*k
*t
g*
s*
*k
j*
r*
u*
*x
*e
s*
s*
o*
*o
*k
*b
u*
u*
h*
h*
u*
r*
h*
*t
*z
*k
*o
r*
h*
o*
*y
s*
s*
s*
h*
*t
p*
*t
i*
v*
*x
r*
*b
o*
w*
*b
j*
*o
*p
l*
*x
*x
*k
o*
*b
o*
r*
o*
d*
o*
s*
*v
*b
h*
*d
u*
s*
r*
r*
o*
s*
*x
*t
*o
*o
*z
*k
h*
*x
r*
*b
*r
r*
*m
s*
...

output:

sb 18

result:

ok single line: 'sb 18'

Test #8:

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

input:

100 11
shiizoyovt*
kbu*jrwyepj
nnxxtxxjqr*
m*uqrzqmscn
zaofs*mslye
s*iizoyovtp
kanuujq*aam
vwzlpvjl*ku
kyhpvgtv*gp
ysmhz*pkixl
gfqnnxor*tc
kburjrwyep*
*burjrwyepj
vv*oaielolg
vvboa*elolg
htygoz*vvbu
rv*hdkiugtz
tytjacjo*ue
qy*wewohmyd
gfqnnxor*tc
zaofsqmsl*e
sbkxhc*owtu
peafgdr*rqo
dly*axfklit
twtyh...

output:

kanuujqlaam 6

result:

ok single line: 'kanuujqlaam 6'

Test #9:

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

input:

100 10
o*zjbeexuj
xbpwiuqn*d
foojnjs*uo
sns*lgfwml
wvt*igiaxi
usyrovmxb*
fooj*jsjuo
f*eurhumoc
qwocte*ywl
txfhusu*so
wvtnig*axi
wm*ygoyfzz
foojnjsj*o
n*fladutfc
qqtfizds*o
hsy*hcyyfr
oynqefrwi*
rgutxv*klp
wvtnigi*xi
dhyuho*jas
xcbdnmwkf*
sn*wlgfwml
ahtydo*ycn
*ufladutfc
rgut*veklp
oy*qefrwiu
rb*ebry...

output:

oynqefrwiu 8

result:

ok single line: 'oynqefrwiu 8'

Test #10:

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

input:

100 6
tf*yra
*wdjwn
jt*qdj
lrat*i
jaw*dz
*brhrg
xgep*x
x*qfxy
xr*pmz
hny*jn
*mwqlr
hnyyj*
*eseum
bwdjw*
qd*rjt
*eseum
tf*yra
rhsh*s
xlkqg*
grlmr*
i*rhrg
bsle*x
xfbt*y
rhs*vs
edzb*a
ulm*nt
ibr*rg
yaul*c
c*brep
ibrhr*
tftyr*
f*uggj
tftyr*
yen*um
g*vyhl
rhs*vs
x*epmz
bwd*wn
rhsh*s
hny*jn
j*rcnv
*hshvs
...

output:

jarcnv 8

result:

ok single line: 'jarcnv 8'

Test #11:

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

input:

100 5
wy*dp
kj*ql
usfz*
tte*l
gr*bl
vibp*
*obyl
oqvn*
qk*wv
*lecb
ugq*u
vz*dd
*lecb
wkck*
uh*kk
jm*qa
*atro
ybcf*
*zpdd
n*pnf
w*llf
ux*wo
d*brz
kjyq*
kk*zf
p*ybk
naa*i
dy*ws
ele*b
cny*z
olbh*
vz*dd
wccp*
mbe*f
*bymh
bp*eg
foa*f
jr*gd
hmmy*
tnuv*
hmmy*
jrs*d
ex*oe
*bdal
xn*im
el*cb
t*ztt
v*wkj
j*sgd
...

output:

elecb 4

result:

ok single line: 'elecb 4'

Test #12:

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

input:

100 3
go*
j*w
dd*
*sv
i*j
*gc
a*b
*tx
b*q
bh*
t*k
qk*
w*a
w*x
vj*
q*x
*bu
ti*
*fo
ub*
at*
s*e
jz*
n*f
ay*
*ah
xr*
n*l
*ux
at*
t*o
*su
*wv
ln*
qs*
l*i
x*n
ki*
*uf
bc*
r*f
*ls
ln*
pt*
*nf
*vp
u*u
l*r
tl*
x*s
ya*
n*f
ou*
hp*
p*p
*zh
jl*
*vt
w*k
ub*
*jj
ln*
t*z
*jl
wf*
az*
a*b
*rw
t*p
*vu
ti*
d*v
yz*
h*...

output:

atb 4

result:

ok single line: 'atb 4'

Test #13:

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

input:

100 10
l*xphwywjm
w*cacwjvgj
gb*mmnwfwm
zgdvo*iobe
*nfganorkc
wsmxje*xww
*xxwlnvtyb
lnlqvmdq*j
sqiruog*wn
tpn*dtaugl
nbg*lcauor
lfm*prolru
vtizkduu*l
bbp*kkovtk
ptkmkige*g
ce*vbdpmvd
vpvhxp*krb
jtyi*cvatj
edkgtkc*vl
vdiv*mflxh
r*ddnhqisc
lzxyp*sqih
wui*kyzbrb
vvhz*zskkn
j*cdcdpgnc
fbrgvyus*u
nn*xcfh...

output:

pubwpcnptd 3

result:

ok single line: 'pubwpcnptd 3'

Test #14:

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

input:

1000 10
ngqrtmfl*f
ngqrtmfl*f
ng*rtmflef
nkltoczxx*
ng*rtmflef
bnxb*icfbw
jwpenfmza*
*gqrtmflef
ngqrtmfl*f
sxjlvzwv*x
ngqrtm*lef
ng*rtmflef
ngqr*mflef
vhbmidwyp*
ngqrtmf*ef
q*corvrqzy
ngqr*mflef
tvyyjxl*dy
ngqrtm*lef
ngqrtmf*ef
ngqrtmf*ef
n*qrtmflef
ngqrtmfle*
tvc*lkkfvu
aiiaucey*w
ngq*tmflef
ngq*tm...

output:

ngqrtmflef 666

result:

ok single line: 'ngqrtmflef 666'

Test #15:

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

input:

1000 12
iuqm*xfeeokl
*rgrvekxmobu
yrgrvekxmob*
mi*mllaqcrqi
acygafp*chlm
iu*mtxfeeokl
t*xqoloctmvs
yrgrvekxmob*
yrgrvekxmo*u
yrgrvek*mobu
iuqmtx*eeokl
yrgrvekxmo*u
yrg*vekxmobu
yr*rvekxmobu
acaa*iynmckr
yrg*vekxmobu
*uqmtxfeeokl
iu*mtxfeeokl
y*grvekxmobu
*uqmtxfeeokl
iu*mtxfeeokl
i*qmtxfeeokl
ctyae*...

output:

iuqmtxfeeokl 336

result:

ok single line: 'iuqmtxfeeokl 336'

Test #16:

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

input:

1000 11
*lrssjqxsah
btlievik*pf
btlievikj*f
r*fnspysljr
bkxhht*zfpq
vije*wsaynn
btliev*kjpf
t*rssjqxsah
btlievi*jpf
bkxhht*zfpq
iqfuqaxs*fm
rgfnsp*sljr
pmrghfwsg*y
cthrt*tanql
yatcj*cznoc
btl*evikjpf
tl*ssjqxsah
yatc*acznoc
rgfnsp*sljr
yatcj*cznoc
yfwrhhbm*ev
moywsouiie*
u*jomszjmty
bt*ievikjpf
yatc...

output:

bkxhhtgzfpq 149

result:

ok single line: 'bkxhhtgzfpq 149'

Test #17:

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

input:

1000 3
i*h
*tw
t*t
*ee
*kt
*ex
*kt
xv*
*zk
ue*
*ya
u*x
ue*
*bw
x*j
*ya
p*a
ue*
*ya
u*e
nq*
u*x
*yd
*kt
xv*
jk*
*vj
p*a
fu*
*xb
*ee
*kt
*ky
ue*
*ex
*wz
u*x
u*x
tk*
o*z
*sy
t*t
*ya
xv*
t*e
*ty
dd*
v*m
hf*
*kt
ue*
*kt
*ex
*ac
ue*
*zz
u*x
u*x
*tz
t*e
yt*
*kt
c*o
*kt
p*a
*vj
*we
py*
qi*
ue*
p*a
ue*
ue*
q...

output:

uex 183

result:

ok single line: 'uex 183'

Test #18:

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

input:

1000 8
*vivdqnd
hemboxy*
kkfi*obf
tm*ctppe
kkficob*
qdcxk*jg
kkfic*bf
*kficobf
hbcalkd*
qsmtu*gr
n*uhrlff
v*wkfhij
tmkc*ppe
qdcxk*jg
nqmyp*zc
r*ymlqgr
hbcalkd*
nlymhdp*
qdcxki*g
zp*pdapc
hbcal*dd
rxaq*gds
kkficob*
kkf*cobf
tmk*tppe
neuhr*ff
qn*xufbo
kkficob*
*giiegtz
dxkqns*a
f*ilgukj
hbc*lkdd
*kfic...

output:

kkficobf 175

result:

ok single line: 'kkficobf 175'

Test #19:

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

input:

1000 8
wubmmj*t
qad*utjr
gidotc*j
el*fntce
vue*nglk
g*dotcwj
fowhu*ov
v*winmmn
*bxcptyx
zozlhb*b
r*vdnuhj
tyowz*yn
wncfrkz*
ir*aqrfm
*jrrjoes
*idotcwj
wubm*jit
pjrrjo*s
gidot*wj
aizxoiw*
numttvd*
pjrrjo*s
*yowznyn
pjrrj*es
idwl*zqp
emqgnd*m
mnn*dpse
flncsz*z
*vxwmxph
gidotcw*
vue*nglk
htmhvhd*
fow*u...

output:

gidotcwj 42

result:

ok single line: 'gidotcwj 42'

Test #20:

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

input:

1000 4
gmq*
lie*
n*ki
v*sw
j*ti
*umu
n*er
up*b
z*po
vbo*
ysn*
*iep
m*mh
nu*r
tz*t
g*iu
up*b
*pjb
*ekw
kq*h
iko*
kek*
icc*
r*ka
upz*
*nzf
k*th
*onr
jkt*
ys*i
ik*t
*car
*kti
l*ep
u*ch
*wou
*cbo
*skb
iju*
iko*
*tzf
li*p
zs*b
*qiu
va*w
zsk*
v*hw
iko*
*qth
*xsi
h*zu
y*ni
omp*
*ahw
hl*f
n*ki
c*ve
*car
*ko...

output:

icar 44

result:

ok single line: 'icar 44'

Test #21:

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

input:

1000 11
rnadtv*iyxh
*ksufuwbgpa
qfhm*eaywfu
lbnaebl*eak
lqqreebw*pv
olkmvkeshi*
qyfqv*ttcjy
j*unvysudhh
mxq*pnfbxgn
ctakyb*movp
hpnmt*katsd
mhm*xfwzvuo
sajktyios*g
*bnaeblgeak
tumbxmgihr*
cnobb*hmcft
ch*nujrkmqg
sajktyi*sxg
chonujr*mqg
nzhco*rfped
hpnmtykats*
wk*ibxgtbtv
l*wvczdzqty
venidctq*gk
*gxf...

output:

jnunvysudhh 41

result:

ok single line: 'jnunvysudhh 41'

Test #22:

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

input:

1000 5
ly*pd
qtiq*
gjte*
q*uze
d*ccj
c*kgt
*hwnx
*asjn
j*aos
o*whf
ahoc*
jyao*
*jkmg
np*gw
c*pvs
l*mpd
wka*c
ie*ib
*jbck
v*hwp
xf*wa
ceav*
nk*jn
*jkmg
xo*ap
ly*pd
z*trj
buh*h
tq*ib
*txpp
vtf*m
rpe*b
wlv*u
ip*yp
kq*tm
srm*i
bb*nb
a*wnx
sr*gi
qti*v
sc*lw
*mshf
md*uu
*jbxp
qsf*p
cz*uz
*bcpr
*vqif
bmp*r...

output:

itxpp 15

result:

ok single line: 'itxpp 15'

Test #23:

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

input:

1000 7
aaz*dqh
tcj*izb
dhwjyn*
lw*txwe
*mbtsdg
rpyu*il
nykya*o
axdow*o
kwv*dxg
xlpa*ag
qyo*bnm
ji*pszi
gyic*wy
jarrf*n
tr*qmvp
qga*lpm
acuj*qi
hq*hvoe
ocb*zlc
uvuwlp*
w*dlyze
e*ognqj
eptyi*z
a*dowko
x*xvxuh
tcobim*
fjuro*t
v*ootej
ucyug*r
*pzgggl
irnnjf*
uulhdr*
zoz*fmi
*bdlyze
w*optho
zovax*g
hvqx*...

output:

dhwjync 14

result:

ok single line: 'dhwjync 14'

Test #24:

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

input:

1000 11
iqgfwfu*ekf
wgvan*qiojw
cltybva*usb
sxjdkj*pjfb
yqhhx*cgiwi
d*kemdmjjdy
fd*yqyvfjid
fh*wxehfpbc
masqxo*jmce
wgwhe*huqym
dqqgvc*zgkv
wgv*ntqiojw
rqwjrc*lbvg
j*ucwxksywa
gepwh*ytvlc
lzxb*uyqvzk
n*jqezymsjy
jxknbtpfeb*
fwggjuxe*or
jsdpz*krupa
nylnifv*gtk
iwrk*ybtphm
mwe*zkxudyl
*enayivtpad
n*qq...

output:

mpncdmdxqvu 17

result:

ok single line: 'mpncdmdxqvu 17'

Test #25:

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

input:

1000 1
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*...

output:

a 1000

result:

ok single line: 'a 1000'

Test #26:

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

input:

1000 10
wig*etmkew
g*bfbybwrr
umdkykcy*j
qwouh*pqnz
en*fjzudml
*fhlooejtx
ix*ndqrjxe
rh*kcgclxf
jbllxa*naw
yquprf*hyn
dklucrpce*
el*eqpjfew
ab*jaeqxao
hjioeb*dqx
jxi*spuvzk
vmjq*iqzjj
yl*bmlwmsb
ndoqpf*mha
rqlcdhenx*
ounnib*ign
fe*cqcezxh
n*xaedxikv
lzm*ugbkdp
skvj*vppcw
*gcvtjotmr
mccprhkxa*
wj*jkj...

output:

fxrehhmode 5

result:

ok single line: 'fxrehhmode 5'

Test #27:

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

input:

1000 5
uayi*
hcri*
na*bp
uzvz*
lx*xx
*zjrq
w*ljy
ehf*p
*mnuu
ts*zq
ll*gr
tppp*
pp*uj
*tgua
dkp*l
hwvi*
*asqm
vo*dk
*azbc
p*vgg
*zheu
vrup*
tv*al
lz*sc
e*kom
rc*vt
t*zbd
t*jan
xn*wk
*ggwm
y*bds
aaw*o
lf*wn
yod*d
tkw*i
mvs*p
cs*vu
w*ytg
upa*u
wnlw*
hxny*
vq*ou
zu*dp
rfb*g
*ylax
ub*yp
rho*y
pwzq*
*laqe...

output:

qrhnu 5

result:

ok single line: 'qrhnu 5'

Test #28:

score: 0
Accepted
time: 38ms
memory: 3736kb

input:

10000 6
qox*sj
q*xisj
q*xisj
qoxi*j
*oxisj
*oxisj
qoxis*
pbly*t
*oxisj
qfwyu*
q*xisj
lsfwz*
enz*tz
q*xisj
qoxis*
diaed*
htqf*m
*oxisj
qo*isj
q*xisj
qox*sj
cf*cfg
qo*isj
*oxisj
qox*sj
iujn*d
lpoke*
q*xisj
qox*sj
efzk*b
*oxisj
tedq*l
q*xisj
aby*yz
qoxi*j
*oxisj
qox*sj
qox*sj
qoxi*j
qoxi*j
apk*hh
qe*ml...

output:

qoxisj 6653

result:

ok single line: 'qoxisj 6653'

Test #29:

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

input:

10000 5
xr*gv
xrm*v
rd*qy
x*mgv
pige*
eore*
p*tsa
adb*w
firl*
*zwje
x*mgv
pqi*n
uzwj*
x*mgv
g*qvk
uzwj*
mxqu*
wupv*
*aemn
n*qir
rcvb*
uzwj*
uz*je
uzwj*
uzw*e
o*plz
gtb*l
uz*je
dwar*
*zwje
nyox*
xrmg*
*nmov
xrmg*
u*wje
xr*gv
uz*je
xrm*v
u*wje
zftb*
bbxk*
gmo*l
ffr*i
zw*lm
xrmg*
x*mgv
uzwj*
xo*tz
*rmg...

output:

xrmgv 3366

result:

ok single line: 'xrmgv 3366'

Test #30:

score: 0
Accepted
time: 54ms
memory: 4028kb

input:

10000 10
pbpeehgbp*
qywdfd*dcd
zpqcc*rgev
niopwdlj*v
zpqccorge*
zp*ccorgev
blfst*bkpf
grykun*gfm
fddodpu*ca
n*opwdljqv
c*kyitpbtj
niopwdl*qv
*rykunggfm
ott*bwfdhp
qywd*dhdcd
gry*unggfm
nio*wdljqv
wwyp*jfjzc
cvkyitpbt*
*ywdfdhdcd
*nwblxaumn
pewdz*ufvr
tcnn*ohcoe
zpqcc*rgev
nio*wdljqv
gryku*ggfm
qywdf...

output:

niopwdljqv 1404

result:

ok single line: 'niopwdljqv 1404'

Test #31:

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

input:

10000 1
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
...

output:

a 10000

result:

ok single line: 'a 10000'

Test #32:

score: 0
Accepted
time: 12ms
memory: 3552kb

input:

10000 2
t*
*i
*z
*n
p*
f*
*u
*z
*b
b*
m*
q*
b*
*x
*j
n*
*n
*n
p*
*p
n*
f*
*j
*j
*p
*b
t*
p*
o*
*b
*n
*j
*c
*r
i*
t*
t*
b*
t*
*e
c*
f*
p*
*x
*b
u*
*e
b*
f*
*o
m*
t*
t*
p*
m*
f*
h*
*z
*u
*x
f*
b*
t*
t*
m*
p*
*b
*n
b*
f*
*z
f*
*v
*m
b*
p*
*j
b*
*o
*x
f*
t*
*o
b*
*z
i*
p*
s*
t*
*z
*n
*j
*j
u*
m*
m*
p*
*...

output:

po 1513

result:

ok single line: 'po 1513'

Test #33:

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

input:

10000 3
r*n
*ay
oe*
*gn
*ur
ap*
lj*
f*j
bn*
pe*
d*l
i*m
g*v
f*y
*bw
*um
*er
*ii
c*e
i*m
mv*
k*g
m*t
d*l
l*u
*wl
*bm
ou*
xu*
m*j
gp*
*nl
ib*
*ay
m*t
i*p
v*w
ib*
*pu
dw*
ou*
o*r
ke*
d*d
u*h
is*
az*
tv*
*nd
t*i
i*m
dh*
y*h
*vt
k*t
*gn
*zh
b*r
l*u
*zh
p*j
dw*
ou*
a*u
*sh
*ps
*bm
*va
o*r
fs*
tg*
*kl
tg*
...

output:

our 473

result:

ok single line: 'our 473'

Test #34:

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

input:

10000 9
ovyig*ntd
jpdp*cegv
*zxrpvjmu
i*mvgrdmy
*vldpdcqm
h*kccsces
lzxrp*jmu
rpygk*xhq
jpdps*egv
wnnwlnkf*
*bojqaruh
lzx*pvjmu
hqcfdbpm*
sur*gxryf
txpmvxx*f
cqwfy*rxn
lv*ajahbf
rpygknxh*
dgrkbi*fw
jdtg*acbr
*jowmgvfm
jzipiwf*p
hcj*xqghu
l*xrpvjmu
xphqa*qze
bv*hthprh
*qcfdbpmk
kh*ebygpp
syqxliy*q
xp...

output:

svldpdcqm 358

result:

ok single line: 'svldpdcqm 358'

Test #35:

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

input:

10000 6
ltvpr*
u*xoxm
mhyc*y
xt*bvx
vtdpj*
hlwcv*
f*xyno
*odfzr
*jngyg
x*dbvx
jpu*py
kdvhn*
j*bncv
mcbfp*
lyo*ch
dr*oab
fcx*no
z*nlfc
*ixjms
sqft*t
fcxy*o
s*atci
nuaj*v
*tdbvx
r*mamt
wjym*b
zng*rb
nc*gbh
vhuwp*
*jvhwj
ysaex*
cxjz*u
mwn*qo
n*nvdp
lb*nve
i*gesz
lyor*h
mixj*s
hwi*bx
*tdbvx
mi*jms
l*vpr...

output:

modfzr 371

result:

ok single line: 'modfzr 371'

Test #36:

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

input:

10000 1
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
...

output:

a 10000

result:

ok single line: 'a 10000'

Test #37:

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

input:

10000 6
ujwnd*
s*pmls
euzpk*
sk*ris
k*dgbp
c*pdfd
lb*qgj
dt*cdm
op*mct
kihzp*
pp*pyo
b*bfsm
ppw*yo
zu*poc
b*fosd
*xnuut
eb*ren
gn*dih
rou*ga
*xylzp
auley*
dqwo*p
qsqpv*
iyo*ab
sdrsm*
copdf*
*hiqnw
i*uilp
aevls*
bpt*yy
zdn*zr
spgt*u
skor*s
gzfk*u
y*iclg
stehm*
rouqg*
vvjy*j
vtkt*c
*tehmp
spgtt*
kih*p...

output:

ndhkui 98

result:

ok single line: 'ndhkui 98'

Test #38:

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

input:

10000 7
snnhnc*
*ibtwqq
hd*sgxb
*jyxcip
*oipleh
i*ivveh
dknybh*
snnh*cy
awe*ika
dknybh*
unop*zu
hg*xkyd
chxdly*
ynlkqy*
emcn*hw
*dzduur
jl*vwwx
l*dqccy
*kdmuyc
zdz*pyv
drvt*xn
tx*cxwc
pdqejo*
vszytm*
hlqgb*q
d*nybhf
chxd*yq
fonpp*z
moes*ab
s*nhncy
lfdf*rc
yz*nlxw
*hxdlyq
mkamfu*
j*fqprw
b*gedxi
y*bn...

output:

lrkozhj 87

result:

ok single line: 'lrkozhj 87'

Test #39:

score: 0
Accepted
time: 65ms
memory: 4228kb

input:

10000 7
ytqtq*j
v*rcbaq
wts*veh
vqltgm*
qgxf*ny
boypm*n
*dqhbwu
jfj*qxs
rc*zujs
h*xevxb
*azdvjs
*xieixc
svodjc*
kzjrb*b
fivfg*u
d*vixzt
hahc*ah
b*nyzmc
rs*ydts
b*osohz
cz*rxmn
hlxwg*w
owet*cm
rdxmj*b
eaw*gog
fyx*tet
eo*njih
ohcr*oe
*kkbbdz
heu*apn
naeciy*
v*xwekc
fzzkqt*
gfz*dtn
stox*uw
hlo*khp
t*qh...

output:

qtbqtnt 15

result:

ok single line: 'qtbqtnt 15'

Test #40:

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

input:

10000 1
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
...

output:

a 10000

result:

ok single line: 'a 10000'

Test #41:

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

input:

10000 7
fwf*oam
*xjcmem
zngjuh*
*eigbnj
lc*pcwb
ev*aspe
dklfxx*
h*xxeku
vymxl*t
d*fpacd
numd*xy
c*ydoap
*kkpari
almbf*f
edk*upu
v*sfrzb
*xyefpl
c*smuwd
lf*xaij
t*erzxo
t*rlpue
re*ppzt
mtdevo*
*koxbdb
yy*cryq
w*sqlbn
kjdg*vi
enmgh*n
*dfmbxm
myk*run
zko*qft
*dyxwoq
ttrazk*
vwlv*xb
kgpzq*q
clambh*
lz*n...

output:

jphnrpv 18

result:

ok single line: 'jphnrpv 18'

Test #42:

score: 0
Accepted
time: 16ms
memory: 3604kb

input:

10000 2
a*
a*
*g
*u
d*
d*
i*
n*
*z
m*
q*
*i
u*
*k
*l
*k
t*
*l
*j
*j
z*
*n
*a
*f
*l
*h
s*
*h
*n
z*
*e
*d
n*
r*
*v
*w
z*
z*
j*
y*
*t
*s
*y
h*
*g
g*
l*
q*
*f
*l
*r
c*
b*
*b
*e
*x
l*
u*
*u
g*
*q
*c
*b
a*
*a
k*
*u
*f
f*
*k
g*
*i
g*
v*
*r
i*
*x
x*
b*
j*
b*
z*
*z
*u
k*
*i
*j
y*
*b
s*
v*
*b
*j
h*
*t
*f
*x
z...

output:

cl 457

result:

ok single line: 'cl 457'

Test #43:

score: 0
Accepted
time: 68ms
memory: 3608kb

input:

10000 3
st*
*ey
e*p
*ez
o*k
y*g
*bf
d*e
*yh
*ue
hi*
*mz
*mv
u*m
*gd
s*p
mp*
q*u
i*o
ng*
*dh
mq*
gh*
r*t
f*c
d*c
jl*
l*c
z*v
gi*
s*c
iv*
ob*
w*r
*tu
*ch
*uw
c*l
z*e
yt*
i*x
u*a
p*n
qh*
y*t
bw*
mr*
*ts
*jn
nt*
sk*
we*
y*b
*qz
jt*
y*d
py*
*dw
ce*
co*
*qx
v*s
z*d
*tb
z*o
mr*
*ti
f*i
c*x
yg*
*ky
zu*
c*n
...

output:

wez 37

result:

ok single line: 'wez 37'

Test #44:

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

input:

10000 2
*e
e*
*l
o*
*v
z*
*v
b*
j*
m*
y*
o*
*y
r*
*c
*g
*b
*o
z*
*q
*g
*c
z*
*v
t*
*g
x*
q*
p*
g*
u*
*z
l*
o*
*i
*f
*s
n*
*f
i*
w*
*j
c*
*v
v*
*n
j*
*c
h*
*s
s*
i*
*z
e*
d*
y*
e*
*o
k*
z*
v*
n*
*b
*q
u*
i*
*x
*d
*e
e*
g*
u*
*j
*r
j*
u*
f*
*e
*u
*b
s*
d*
*h
b*
*z
u*
v*
v*
*h
f*
e*
*e
e*
b*
*j
*k
*h
*...

output:

bz 444

result:

ok single line: 'bz 444'

Test #45:

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

input:

10000 9
sao*jcrpz
j*hykjltn
piyzhpwb*
d*octvgoo
j*jjrwpjc
*qkmtgftr
uvnaddn*t
*sghgzark
fak*rmjdx
n*msmrusx
yglrjk*py
dmehv*xam
gin*nfepz
nuxxxv*aa
ulm*shgxc
tihfqbaw*
rvyis*ifs
ytd*vnabx
xdidlgvb*
mgtnrt*pj
cxyvzt*oy
*yfoekgfh
lvdvr*fzf
peax*ostv
*lanrpvwr
*nlwajxau
ivmqhk*yf
t*qnaesag
hisi*ovlf
mn...

output:

sspifsfdl 6

result:

ok single line: 'sspifsfdl 6'

Test #46:

score: 0
Accepted
time: 68ms
memory: 4396kb

input:

10000 11
tnh*sawdcai
nrgg*qjnyvw
mofz*ahbzqe
feocm*gpptq
gzpdve*rsqz
*xalfhbfxyh
veyzmaxbo*z
*lmprwyfrbk
dfkl*bhngyv
nhanhsqyms*
dxeltpk*gmu
bvtbfzcfbu*
da*hulffxnq
uu*jngouxwp
ppzmwnlkhh*
pyochz*wxfm
tc*ghlnkvat
*xlykwsqxlz
ptdzplqhjw*
zi*ybvxzdkg
eowjnkig*oi
zr*dwfcrdrl
wnkeryv*vlj
*kdytpyzykg
kxr...

output:

biyxjylwvwc 5

result:

ok single line: 'biyxjylwvwc 5'

Test #47:

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

input:

10000 6
eps*jd
*rbzmf
oz*yxt
bkkn*q
d*zyfq
sgpsg*
spv*fg
aj*bwa
bocq*i
dj*jxo
gti*dh
cps*qx
uh*ufg
kge*dv
*alrig
hiv*so
tfn*hk
bcjp*j
jqnoh*
bfpfz*
qhnd*q
h*kgsz
pqbi*m
z*xrdy
x*ibsf
rwse*i
j*fbub
xwa*ry
vklz*e
*jyxqh
amc*qt
*chprj
lkzpv*
*hnfyq
y*wrxm
jrq*uc
*atxqc
h*gyhh
xdmgw*
*uletz
rrcax*
l*meu...

output:

efiyij 5

result:

ok single line: 'efiyij 5'