QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#553809#8935. Puzzle: Easy as Scrabbleucup-team191#WA 23ms4880kbC++235.6kb2024-09-08 20:36:152024-09-08 20:36:16

Judging History

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

  • [2024-09-08 20:36:16]
  • 评测
  • 测评结果:WA
  • 用时:23ms
  • 内存:4880kb
  • [2024-09-08 20:36:15]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=3010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int n,m;
string h[N];
char cl[N],cr[N],cu[N],cd[N];
bool el[N],er[N],eu[N],ed[N];

bool hand(int i,int j,char clot,char clh,bool&ok)
{
	//cout<<i<<' '<<j<<' '<<clot<<' '<<clh<<en;
	if (h[i][j]==clh)
	{
		ok=1;
		return 1;
	}
	if (h[i][j]=='x') return 0;
	if (h[i][j]=='.')
	{
		if (clot=='.' || clot==clh)
		{
			h[i][j]=clh;
			ok=1;
			return 1;
		}
		h[i][j]='x';
		return 0;
	}
	else return 1;
}

void no()
{
	cout<<"NO\n";
	exit(0);
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin>>n>>m;
	for (int i=0;i<=n+1;++i) cin>>h[i];
	for (int i=1;i<=n;++i)
	{
		cl[i]=h[i][0];
		cr[i]=h[i][m+1];
	}
	for (int i=1;i<=m;++i)
	{
		cu[i]=h[0][i];
		cd[i]=h[n+1][i];
	}
	int n1=n,m1=m,off=0;
	bool ruined=0;
	while (n1>0 && m1>0)
	{
		//first up
		bool ok;
		int i;
		if (cu[off+1]!='.')
		{
			ok=0;
			for (i=1;i<=n1;++i) if (hand(off+i,off+1,cl[i+off],cu[off+1],ok)) break;
			if (!ok && !(i==n1+1 && eu[off+1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"first up"<<en;
		if (m1>1 && cu[off+m1]!='.')
		{
			//last up
			ok=0;
			for (i=1;i<=n1;++i) if (hand(off+i,off+m1,cr[i+off],cu[off+m1],ok)) break;
			if (!ok && !(i==n1+1 && eu[off+m1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"last up"<<en;
		//first down
		if (cd[off+1]!='.')
		{
			ok=0;
			for (i=n1;i>=1;--i) if (hand(off+i,off+1,cl[i+off],cd[off+1],ok)) break;
			if (!ok && !(i==0 && ed[off+1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"first down"<<en;
		//last down
		if (m1>1 && cd[off+m1]!='.')
		{
			ok=0;
			for (i=n1;i>=1;--i) if (hand(off+i,off+m1,cr[i+off],cd[off+m1],ok)) break;
			if (!ok && !(i==0 && ed[off+m1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"last down"<<en;
		//first left
		if (cl[off+1]!='.')
		{
			ok=0;
			for (i=1;i<=m1;++i) if (hand(off+1,off+i,cu[i+off],cl[off+1],ok)) break;
			if (!ok && !(i==m1+1 && el[off+1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"first left"<<en;
		//last left
		if (n1>1 && cl[off+n1]!='.')
		{
			ok=0;
			for (i=1;i<=m1;++i) if (hand(off+n1,off+i,cd[i+off],cl[off+n1],ok)) break;
			if (!ok && !(i==m1+1 && el[off+n1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"last left"<<en;
		//first right
		if (cr[off+1]!='.')
		{
			ok=0;
			for (i=m1;i>=1;--i) if (hand(off+1,off+i,cu[i+off],cr[off+1],ok)) break;
			if (!ok && !(i==0 && er[off+1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"first right"<<en;
		//last right
		if (n1>1 && cr[off+n1]!='.')
		{
			ok=0;
			for (i=m1;i>=1;--i) if (hand(off+n1,off+i,cd[i+off],cr[off+n1],ok)) break;
			if (!ok && !(i==0 && er[off+n1]))
			{
				ruined=1;
				break;
			}
		}
		//cout<<"last right"<<en;
		//others up
		for (i=2;i<m1;++i) if ((h[off+1][off+i]=='.' || h[off+1][off+i]==cu[i+off]) && cu[i+off]!='.')
		{
			h[off+1][off+i]=cu[i+off];
			cu[i+off]='.';
		}
		//others down
		for (i=2;i<m1;++i) if ((h[off+n1][off+i]=='.' || h[off+n1][off+i]==cd[i+off]) && cd[i+off]!='.')
		{
			h[off+n1][off+i]=cd[i+off];
			cd[i+off]='.';
		}
		//others left
		for (i=2;i<n1;++i) if ((h[off+i][off+1]=='.' || h[off+i][off+1]==cl[i+off]) && cl[i+off]!='.')
		{
			h[off+i][off+1]=cl[i+off];
			cl[i+off]='.';
		}
		//others right
		for (i=2;i<n1;++i) if ((h[off+i][off+m1]=='.' || h[off+i][off+m1]==cr[i+off]) && cr[i+off]!='.')
		{
			h[off+i][off+m1]=cr[i+off];
			cr[i+off]='.';
		}
		//part 2
		//others up
		for (i=2;i<m1;++i) if ((h[off+n1][off+i]=='.' || h[off+n1][off+i]==cu[i+off]) && cu[i+off]!='.')
		{
			h[off+n1][off+i]=cu[i+off];
			eu[i+off]=1;
		}
		//others down
		for (i=2;i<m1;++i) if ((h[off+1][off+i]=='.' || h[off+1][off+i]==cd[i+off]) && cd[i+off]!='.')
		{
			h[off+1][off+i]=cd[i+off];
			ed[i+off]=1;
		}
		//others left
		for (i=2;i<n1;++i) if ((h[off+i][off+m1]=='.' || h[off+i][off+m1]==cl[i+off]) && cl[i+off]!='.')
		{
			h[off+i][off+m1]=cl[i+off];
			el[i+off]=1;
		}
		//others right
		for (i=2;i<n1;++i) if ((h[off+i][off+1]=='.' || h[off+i][off+1]==cr[i+off]) && cr[i+off]!='.')
		{
			h[off+i][off+1]=cr[i+off];
			er[i+off]=1;
		}
		++off;
		n1-=2;
		m1-=2;
	}
	//cout<<n1<<' '<<m1<<' '<<off<<en;
	//for (int i=1;i<=n;++i,cout<<en) for (int j=1;j<=n;++j) cout<<h[i][j];
	if (ruined) no();
	for (int i=1;i<=n;++i) for (int j=1;j<=m;++j) if (h[i][j]=='x') h[i][j]='.';
	//try up
	for (int j=1;j<=m;++j)
	{
		char prv='.';
		for (int i=1;i<=n;++i) if (h[i][j]!='.')
		{
			prv=h[i][j];
			break;
		}
		if (prv!=cu[j] && cu[j]!='.')
		{
			//cout<<"U"<<prv<<' '<<cu[j]<<en;
			no();
		}
	}
	//try down
	for (int j=1;j<=m;++j)
	{
		char prv='.';
		for (int i=n;i>=1;--i) if (h[i][j]!='.')
		{
			prv=h[i][j];
			break;
		}
		if (prv!=cd[j] && cd[j]!='.')
		{
			//cout<<"D"<<prv<<' '<<cd[j]<<en;
			no();
		}
	}
	//try left
	for (int i=1;i<=n;++i)
	{
		char prv='.';
		for (int j=1;j<=m;++j) if (h[i][j]!='.')
		{
			prv=h[i][j];
			break;
		}
		if (prv!=cl[i] && cl[i]!='.') no();
	}
	//try right
	for (int i=1;i<=n;++i)
	{
		char prv='.';
		for (int j=m;j>=1;--j) if (h[i][j]!='.')
		{
			prv=h[i][j];
			break;
		}
		if (prv!=cr[i] && cr[i]!='.') no();
	}
	cout<<"YES\n";
	for (int i=1;i<=n;++i,cout<<en) for (int j=1;j<=m;++j) cout<<h[i][j];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5 5
.CBA...
....x..
..x...C
A.....B
B..x..A
C......
.......

output:

YES
CBA..
....C
A...B
B...A
C....

result:

ok Correct.

Test #2:

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

input:

1 2
....
Nx..
..O.

output:

NO

result:

ok Correct.

Test #3:

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

input:

5 5
.U.N.X.
U....xX
Ox....X
M...xxN
Vx....S
Ix.x..X
..IBHX.

output:

YES
U.NX.
.O..X
MNN..
.VB.S
.I.HX

result:

ok Correct.

Test #4:

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

input:

10 10
.BAZEMIEKUJ.
A..........K
B..x.x.x..x.
K.........xT
A.x..x.....J
Hx....x....B
Q..x....x.xW
S...x......W
S...x.xxx..Z
...x......xZ
I..x..x.x.xR
.QKO.ID..RW.

output:

YES
.AZEMIEK..
B.......U.
K.......T.
A........J
.H.......B
Q.......W.
S........W
S.O.....Z.
QK...D..Z.
...II...R.

result:

ok Correct.

Test #5:

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

input:

5 10
.PTWIVVISPY.
T...x.x....Y
Xx.x.xx..x.K
P.x.xx.....K
S..........A
E.........xS
.SPEASDCYSA.

output:

YES
.TW.V.ISPY
.X.I.....K
P....V...K
SP...V...A
..EASDCYS.

result:

ok Correct.

Test #6:

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

input:

10 5
.HVYN..
Y.x...C
V..x..B
H...x.Z
....xxN
....x.P
B.x...G
Fx.x..D
Txx..xK
E..x.xR
Sx....B
.EPSBD.

output:

YES
..YNC
.V..B
H...Z
NNN..
....P
B...G
.F..D
..TK.
EP.R.
..SB.

result:

ok Correct.

Test #7:

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

input:

50 50
.YDOGQIDENEUMONVSGZNMNHLEZCXIRMK.OOCKJOKXXZDUFEMPXS.
Y.x...x.x.x..x..........x.......x......x.....x....xX
N.........x.....x.....x....x.x.xxxxx.x...x.........E
U.....x.....x....x......x.....x........x..........xS
...x......x........x..x.....x.x.x........x.x.x.....S
Q.....x.x..x..........x....x....

output:

YES
Y.OGQ.D.N.UM.NVSGZNMNHL.ZCXIRMK.OOCKJO.XXZDU.EMPX.
ND...I.E....O.......G..E..............KJ....F.O.E.
U........E......................................S.
.................................................S
Q................................................L
F...........................................

result:

ok Correct.

Test #8:

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

input:

100 100
.NUXAMX.LNWZKRRKZIRNZVDJF.XRB.VEFQXHTGLGIKZYSRPPF.YGVTOSQCADEG.KYKH.NWWO.XDXJW.G.RBHABFLWHFVUNOLBHMKN.
U..x...x...x....xx........x.....x.....xxx..x..........x..x...x..xx..x..x..x............x.....x.....x.N
C...x.......x.............x....x.x.x..x........x..x.xx..x..xx.................x..........

output:

YES
.U.AMX.LNW.KRRK..RNZVDJF..RB.VE.QXHTG...KZ.SRPPFKYGVT.SQ.ADE..K..HZ.WW..X.XJW.GBRBHABF.WHFVU.OLBHM.N
.CX.......Z....ZI..............F......GI..Y..........O..C...G..YK..N..O..D....D..U..........N.....KO
.O...................................L...........................................................

result:

ok Correct.

Test #9:

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

input:

500 500
..FHFDLGFGHREQBGILNRAGJ.ERZSAFGLQ.ESEBI.ELKM.RENLNFQSPT.TXUEIKHHOQWABSELMOPGTFGTXGYMTSU.N.O.AX.OGNSWTFSLUIMTUX.RUCECKZCXOJNPTFVAJUJTF.LHXURYIQIJCVWDBVZ.ZXFRAT.XIPXTDCSLHJHSZCW.RMNUGPIHYUQYUYAY.NHCBU.JPMLG.DDXAJWKNZJVKNAWAJZAHW.FCBEVATZ.YZ.HQ..QPLFARSHNP..EDPIKLYLF.FIFXEXR.XSUORAP.CZPMJXPUS.W...

output:

YES
...FDL...HREQ..ILNRA...ERZSA.GL...SE.I..LK...ENLNFQS.T.TX.E.K.HOQWA.SE.M.PGTFG.XGY..SU...O.AX.OGNS.TFSLUIM.UX...CEC..CXOJNPT.VA..JTF.LHXURYIQI.CVWDB.Z..XFR.T..IPXTD..LHJHSZCW.RMNUGPIHYUQY.YA..N.CB..JPM.G.DD.AJW.NZJ...AWAJZAHW.FCB...T..YZ.HQL.Q.LFA.S.NP.WEDPI.LYLF..IFXEX...SUO.AP.CZP.JXPUS.W.D.WU...

result:

ok Correct.

Test #10:

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

input:

1000 1000
.SKFDQ.AV.GPTHMF.PL.YOQRQOXDOF.XVZ.H.MYOJIYT.QZNJQI.ZZMAJ.OAWBJBRXFW.CLEPPKGGAWGTVBKOBL.GPCO.ML.DBL.A.RJ..GF.EHK.CDXLLTCBCL.CGYJBMUSPIN.QELGYW.JE..CFVQF.LVYLFHYJ.MY.FZ.RU.ODLAYTWIZQOQZXBW.BVD.RFPLHLEHAU.G.PLFWFUKA.RSG..AVU.SA.PWRGJYO.OXD..S.Z.LIIADT.YXH..NHWXY.R.YFLS.URIJGPPURZPPVHJFLMKTDT...

output:

YES
S.FDQEAV.GPTHMF.P..YOQRQOXD.F.XV.....YO.IYT.QZ.JQI.ZZMAJ.OAWBJBRX...C.EPP.GGAWGT.B..BL.GPCO.MLVD.L.A.R...GFPE.K.CDXLLT.BCL.CGYJB.USPIN..EL..W.J...CFVQ..LV.LFHYJ.MY.FZ.R..ODLAYTWIZQO.ZX.W...D.R..LHLE.A..G.PLFWFUKA.R.GB.A...SA..WRGJ...OXD....Z.L.I.DT.Y.H..N.WXY.R.Y.LSL.RI.G.PU.ZP.V..FLMKT.TWI.ZKHZ...

result:

ok Correct.

Test #11:

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

input:

1 1000
.K.CCS...LC.....Y..J...E.W.B..Q..KQ...Q...L..U.XSWX..NB..K.OLF...Y.A....HG....RRQO..Y...J.LOS...IN..C......H......X.....B.B.PQRT....VB.........P...E....MF.E...RH.XADCQN.D.KT.W..XNI..PH.Q.L.H..G...ZJR.V.I.......O......J.X..N..QS......UN....HLS..Z..N....X.YH.W..E.Z..JHSAV......YXT.P..TX.WT.SHE....

output:

YES
K.CCS...LC.Y.W.Y..J...E.W.B..Q..KQ..EQD..LT.U.XSWX..NB..K.OLF...Y.A....HG.BH.RRQO..Y..PJ.LOSU..IN..C......H......X.....B.B.PQRT...QVB...V..K..P...E....MF.E...RH.XADCQN.D.KT.W..XNI..PH.Q.L.H..G..ZZJR.V.I.......O.....DJ.X..NC.QS......UN....HLS.TZ..N....X.YH.W..EBZZ.JHSAV......YXT.P..TX.WT.SHE...YG...

result:

ok Correct.

Test #12:

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

input:

2 1000
.D..JPYBD.H..F.I.NTFC.VJKS..Q.PBW..XLW.ZS..ATCTMPPKRK.V.NN.MPE.SPN.QODI.H...OR.V..INXOZMGF.KIS.GANJ.WV.YLALHHXO..M.TMTJ..XYP.N.BUENZCUA.I.XJO.Q.NVG.B.TXNI.TVLY.N.CWE.ZEO.ANYRZ.W.PQI.LORBYIYJIK.JZ.PENB.HPJPTIIGVOMF.RPZ..WFM.IS..H..U.ZEX.DXZU.YHM.UOMPOHV.HW..SZ.RHWXW.SZH.....R.X.R.L.JRYLL.CE.IE...

output:

YES
..JJPYBD.H..F.I.N.FC.VJKS..Q.PBW..XLW.ZS..ATCTMPPKRK.V.NN.MP..SPN..ODI.H....R.V..INXOZMGF.KIS.GANJ.WV.YLALHHXO.....MTJ...Y..N.BUENZCUA.I.XJO.Q.N.G.B....I.TVLY.N.CWE.ZEO.ANYRZ.WBPQI.LORBYIY..K.JZ.PENB.HPJPTI.GVOMF.RPZ..W.M.IS....QU.Z.X.D.ZU.Y.M.UO.POHV.HW..SZ..HWXW.SZ......R...R.L.J.YLL.CE.IEZDX....

result:

ok Correct.

Test #13:

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

input:

1000 1
.N.
N.N
G.G
...
...
.x.
U.U
...
.x.
P.P
K.K
..O
.x.
.x.
Y.Y
...
.x.
..D
.x.
...
J.J
Q.Q
E.E
.x.
A..
W..
.x.
H.H
D.D
...
...
E.E
..H
..A
.x.
...
C.C
..E
O.O
...
..Z
J.J
...
..Y
P.P
W.W
X.X
G.G
...
...
...
...
L.L
F.F
B.B
.x.
K.K
R.R
U.U
F.F
.x.
...
...
...
B.B
...
L.L
.x.
E.E
N.N
Z.Z
...
Z.Z
W...

output:

YES
N
G
.
.
.
U
.
.
P
K
O
.
.
Y
.
.
D
.
.
J
Q
E
.
A
W
.
H
D
.
.
E
H
A
.
.
C
E
O
.
Z
J
.
Y
P
W
X
G
.
.
.
.
L
F
B
.
K
R
U
F
.
.
.
.
B
.
L
.
E
N
Z
.
Z
W
.
.
.
I
V
P
.
.
J
K
D
X
Y
.
.
.
S
.
X
.
.
J
F
O
S
N
.
D
.
.
E
U
.
.
T
C
D
M
.
.
.
T
.
.
.
.
.
F
.
.
Y
E
K
.
.
.
.
T
.
.
.
.
G
T
.
A
.
H
R
X
.
.
.
.
U
...

result:

ok Correct.

Test #14:

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

input:

1000 2
.HE.
.xx.
....
H..E
..x.
Z..N
U.xU
..x.
Rx.R
A..A
D..L
J..T
..x.
A.xA
Ax.A
...V
.x..
F..F
.x..
U..Q
Bx.B
F..X
E..E
...G
B..V
..x.
.x..
..x.
E.xE
...I
..x.
...W
Tx.T
.x..
Tx.T
H..H
K..K
M..I
..xK
V..I
.x.Y
...V
....
A..M
B.xB
Hx.H
A.xA
...K
...X
O...
J..X
S..U
X..M
F.xF
..x.
M..I
D.xD
Y.xY
Hx....

output:

YES
..
HE
HE
..
ZN
U.
..
.R
AA
DL
JT
..
A.
.A
.V
..
FF
..
UQ
.B
FX
EE
.G
BV
..
..
..
E.
.I
..
.W
.T
..
.T
HH
KK
MI
K.
VI
.Y
.V
..
AM
B.
.H
A.
.K
.X
O.
JX
SU
XM
F.
..
MI
D.
Y.
.H
XF
SX
AK
.R
B.
..
..
KE
NN
Z.
..
BI
PV
ZD
.D
.G
..
RR
V.
.O
EE
..
C.
.J
SP
..
GG
JI
..
.P
DH
..
QQ
..
V.
ZL
W.
QC
P.
KK
.O...

result:

ok Correct.

Test #15:

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

input:

1 1
.M.
M.M
.M.

output:

YES
M

result:

ok Correct.

Test #16:

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

input:

2 2
.FG.
F..G
D..D
.DG.

output:

YES
FG
D.

result:

ok Correct.

Test #17:

score: 0
Accepted
time: 18ms
memory: 4804kb

input:

1000 1000
.SALZWWWEFVNIEX.ZDPPWJHROFIITXR.CSOKTMFFUGSA.UW.X.QYXWNAC.YCVHOGAHGZQAJWINRU.Z..CCFQKASZXMPWSQGILOT.N.PKGZ.JWPZ.ALPWSOFCMWABPW.ZAFSQQUASJHPIAMITPJEAJLKMGVGDOHFFNYKKXFHUIPFYDPQ.RWKD.PWLTQPZGPMYPQHOAGOHIDQMFGJU.MLXPCUK.ES.KZHPRLBGCTGYHPVYMX.DFAZODQ.QXANEJTISMUGV.LIGKZDSNOC.NDWM.N.JYHJIWCBQ.L...

output:

YES
..LZW..EFV.IEX.ZDPPW.HROF.ITXR..SOKT.FFU.S.WUW.X.QY.WNAC.YCVHOGAHGZQ.JW.NRU.Z...CF..A..XMPW.Q...OT.NPPKGZ..WPZ.ALP.SOFCMWABPW.ZAFSQQ.ASJHPI.M.TPJ.A.LKMGVG.OHFFNYK.XFHU.PF.DPQ...KD..WLT.PZGP...Q.OA.O.ID.MFGJU..LX...K.ES.KZHPR..GCTGYHPV..X..FA.O.Q.QXANE...S.UG....GKZDS..C.NDW..N..YHJIW.B..LIU.N.NI...

result:

ok Correct.

Test #18:

score: 0
Accepted
time: 23ms
memory: 4880kb

input:

1000 1000
..EYLAGAENPDPZMGY.K.MSRTZBHDENS..YJRW.IWCLBIQQICT.ODBUMXFPO.UDPELUBMQSLZ.EHIVABC.ME.NQQI..QEHTIIFGJQWZSLDNDKGWA.UGMR.CJ.RPAQYJUAIIFQAMRAWECAAFHV.GUGIXROGEYDUX.FUUP.JKSYZITIHMSCKEQQKU.SFAXDPIPSHHYGGYLLEHUHZYRKYBKNAAOAWZHPRKHIQRZJXO.LMJUHDR.AWTBOEEJIHRH.XBUDQHGHKSL.SKW.SZZNIZAF..PK.NVOIMECDI...

output:

YES
.......................ZB.DE.S..Y.RW.IW.L.IQ..CT.O.BUMX....UD.ELUB.QSL..E..VABC.ME.N..I.I.EHT..F...W.S.D..KGW..UG.R.C.A.PAQYJUAIIFQA.R....AAFHVUGUG..ROG..DUX...U..J.S....IHMSCKE...U...AXDP...HH.G..L.E.UHZY.KY.K.AAOA..HPR.HI.RZJ...LMJUH....WT..E.JI.RH..BU..HGHK.L.S...SZZ.I..FX.......IME..IKXFG.J....

result:

ok Correct.

Test #19:

score: 0
Accepted
time: 23ms
memory: 4784kb

input:

1000 1000
.YOTYESJGMDJYFO.GICQVC.PBBNUUXFEIX.OJ.DBWOESWK.TEI.DITEQKIKC.QOTZBX..UB..SW.ODDBU.ZDILJKQYEM.CXOWRNAX.RYRPM.VMVYI.PBYXXUDDAFQUMAI..UFRHYOQA.PUWEP.AHEMMHMRCEZRFJQRWKLVXA.HXPHIMHV.SEHGFEJB.WRT.EYCWPI.CTERLDCPFUXKOWGIVNJKKOPUZRZI..NCHBODRTVKZRNHGTOQTYAKSEBA.TEX..EFIVBSBFOAJ.M.PXGTMHN.PRAPFIDD...

output:

YES
..............X.IC......BN......X..J...W.ESWK.......TEQ.I...QOT..X..UB.JS.T.D..U..D.L..QYEM..XOWRNA.CRY..MOV..Y..P...X......U.A...UFRH...A.PU.E..AHE.M....EZR.J.RWK.VX..HX.H.M....E.GF.JB..RT.E.C.PI.C.E.L.CP..X..W.I.N..KO..ZRZI..N....DR.V.Z.N.GTOQ.Y..SE.A.T.X..E..VB.BFO.J.M.PX..MH..PRAPF..DH.O.G.T...

result:

ok Correct.

Test #20:

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

input:

1000 1000
.HXXXGGPVDEYBGKDYLMRYKPIY.B..BQBPSH.DHV.RNWZKUYVSVELVLW.IAZZSBAGJSPHY..LFURSTQY.BTDPZ.GQCCNHBHJNUBDRQRGESN.TIGYPZVZ..MAWLKSUBOR.OJ.FEYPDJBAI.WV.EYBPRKNB.V.NY.QESGNGLNTUF.EY.EOIUPSETRWU.AWLP.DCBRZ.IDJIZW.UEJYDHPYOJPH.QJJAR.EOYFQKOSXUK.LNXOHJNINT.NVJFEGZOMSJQT.XHISZWU.Z.GYGELPGGDVTFAGA.TSYDN...

output:

YES
.....................P....T.BQ..S..........KUY......L.U.....B..............T......P.....C..B.J...........U............WL..........F.......I........R.NB.........G.G........T....P.........L..D......DJ.Z........P...P..Q......O.........P.........T.........M....DX......AZC..G.L.GGD....G..........M......

result:

ok Correct.

Test #21:

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

input:

1000 1000
.CCFMBZB.AUU.H.ZXYVAIMTA.D.JJIPERQWJVCTTAKSARUVYRPOPQMNFTNMPUBAZLCD.NXITOLEGFETDCOOBBGTL.U.IDCGBOOWFZ.VAWT.BXDK.YXRPTAVKNVAEMTDFY.UEUJCXSVZTYVJIN.ZOXGSTHSGUJWPTSLSUKFZDICKCPNTF.TTVUZUWAWFIPJ.HSXCJWRLDXZPXSHYLE..VZDEXCIGCFVBJBRNLAZDYXYGBDSRJUKRLVGREJGHMBFFK.SQSFXVDXBOULXPVHXPXKDZADDQA.JJCLE...

output:

YES
.................................................................................................W.........................................Y.................................................F........D.............................................................X......................................

result:

ok Correct.

Test #22:

score: -100
Wrong Answer
time: 4ms
memory: 4744kb

input:

1000 1000
.YYJG..U..V.ZKZL.MR.Y.BFP.RK.Y...Y.P...LZ.HB.FECA.O...DDWYTFMKZZ.RZ..AJD....ND.P.B...MPYOAU.DYJX..Y.UEUN..IVDN.C..WXXF...FRP...A..NP.B.O.Z.D..LFC.F..TR.G..M..ULQ..VPC..X.DHPY..UGO.F.P.BM.R..HXJ..STSJMS.Q.AZMF.EF..OXMSV.BAG..ADIR.FD.QDJN.DM...NKI...IYMNE.CP...J...G.KSX..B.J.HLYJC.PMBBJG.F.....

output:

NO

result:

wrong answer Jury has answer but participant has not.