QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#524029#8917. 2026DaiRuiChen007100 ✓140ms19480kbC++171.6kb2024-08-19 08:45:252024-08-19 08:45:25

Judging History

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

  • [2024-08-19 08:45:25]
  • 评测
  • 测评结果:100
  • 用时:140ms
  • 内存:19480kb
  • [2024-08-19 08:45:25]
  • 提交

answer

#include<bits/stdc++.h>
#define sz(v) ((int)v.size())
using namespace std;
typedef vector<int> vi;
typedef vector<vi> Mat;
int n,m;
bool f(char c) { return c=='L'||c=='R'; }
void mov(Mat &a,char c) {
	if(f(c)) {
		for(int i=0;i<n;++i) {
			vi z;
			for(int j=0;j<m;++j) if(~a[i][j]) z.push_back(a[i][j]),a[i][j]=-1;
			for(int j=0;j<sz(z);++j) a[i][c=='L'?j:j+m-sz(z)]=z[j];
		}
	} else {
		for(int j=0;j<m;++j) {
			vi z;
			for(int i=0;i<n;++i) if(~a[i][j]) z.push_back(a[i][j]),a[i][j]=-1;
			for(int i=0;i<sz(z);++i) a[c=='U'?i:i+n-sz(z)][j]=z[i];
		}
	}
}
void mul(vi &p,const vi &q,int k) {
	vi z(k);
	for(int i=0;i<k;++i) z[i]=q[p[i]];
	p.swap(z);
}
void solve() {
	cin>>n>>m;
	Mat a(n,vi(m,-1));
	int k=0; string col,O,q;
	for(int i=0;i<n;++i) {
		string t; cin>>t;
		for(int j=0;j<m;++j) if(t[j]!='.') a[i][j]=k++,col+=t[j];
	}
	cin>>O;
	for(auto c:O) {
		if(sz(q)&&f(q[sz(q)-1])==f(c)) q.pop_back();
		if(sz(q)<2||q[sz(q)-2]^c) q+=c;
	}
	if(q.size()<20) {
		for(auto c:q) mov(a,c);
		for(int i=0;i<n;++i,cout<<"\n") for(int j=0;j<m;++j) cout<<(~a[i][j]?col[a[i][j]]:'.');
		return ;
	}
	int p=sz(q)%4+4;
	for(int i=0;i<p;++i) mov(a,q[i]);
	Mat b=a;
	for(int i=p;i<p+4;++i) mov(b,q[i]);
	vi T(k),I(k);
	iota(I.begin(),I.end(),0);
	for(int i=0;i<n;++i) for(int j=0;j<m;++j) if(~a[i][j]) T[a[i][j]]=b[i][j];
	for(int z=(sz(q)-p)/4;z;z>>=1,mul(T,T,k)) if(z&1) mul(I,T,k);
	for(int i=0;i<n;++i,cout<<"\n") for(int j=0;j<m;++j) cout<<(~a[i][j]?col[I[a[i][j]]]:'.');
}
signed main() {
	ios::sync_with_stdio(false);
	int T; cin>>T;
	while(T--) solve();
	return 0;
}

詳細信息

Subtask #1:

score: 9
Accepted

Test #1:

score: 9
Accepted
time: 1ms
memory: 3700kb

input:

1
100 100
.avy.w.fb..d....f.mysvo..x.ijb.sm.b.il....g..cvd..i.....s.ur..yz.g...ss..dey.mha..yoisuwvbk...n.e...
y....h..f.tziku...e.oi..k..qh.m..b.p.rp.u...u.bzz..h...ic.s.s.......s.....oypb.m..jgqwt.cn.izy.l..g.
k...ufj.mqkl.bpk....iufk...ez.m..gy.wvyci..sz...s......gk....y.oz..alr.j....ezdt.....ife...

output:

avywfbdfmysvoxijbsmbilgcvdisuryzgssdeymhayoisuwvbkne................................................
yhftzikueoikqhmbprpuubzzhicsssoypbmjgqwtcnizylg.....................................................
kufjmqklbpkiufkezmgywvyciszsgkyozalrjezdtifehbcvbez..................................................

result:

ok 100 tokens

Test #2:

score: 9
Accepted
time: 1ms
memory: 3940kb

input:

1
100 100
w.i..p..t.qw..j...bv...y..nt.....r..i.oa..x...ns.l..o.....wwf...k...e.vkwumeh...y...rh.opu...ie.....
..t......i...q.ge..e..o.qn.h.y....azp....ve..t.iiuqunj.p..gu..mmtj..hwwsp.fq..q.d.qy.yx.ujfpvkh..qr.
cxs.e.hd..te.jxpc.cr.ut.uxcb.a.k.c.ab..sg....u...fn..o.at.u.y..ymu..u..qi....oayd.sb.m.....

output:

wxinephdtiqwqqjgenbvwuoyqnnteywkzrazivoagvxtdtnsilquojfptuwwfrmmkjusewvkwumehoqyycqyrhxopufpviecsqrt
cgtqppmimetewjxpcpceqstquxchdavyacpapsvsgeeqfuribuncnoyatiguyadytuwthawspefquxacdbsblyrmujtiykhvjrec
wgseqbywlwrpmfzgqkrrfdbzmaxbiwxfbhdlbsqnjmumbhcspfmtlhungpulthljmuoxuhcqigyevtkddyrawmwinyiapoigvn...

result:

ok 100 tokens

Test #3:

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

input:

1
100 100
.vrg.qnn....f..quha..ag...w.yv..mv.....iijlkwse.tr...kgh.kj..a.e..vss..jq.......prr.....di.nqykc.czg
jfxss..xy.y....ss..vd.x.cau.wv.u.t.wfmw.....r..pbo..gja.uvt..ge..lk.zoi..b.qesl.p..fdljhkjq...elo...
xlk.g.xaxcfe..n....q.shv.odc.j..at.t.z.....g.o....y.k.u.rm..mrkr.ll.zmqj.w.z.wktrymv.......

output:

...............................................vrgqnnfquhaagwyvmviijlkwsetrkghkjaevssjqprrdinqykcczg
..........................................jfxssxyyssvdxcauwvutwfmwrpbogjauvtgelkzoibqeslpfdljhkjqelo
............................................xlkgxaxcfenqshvodcjattzgoykurmmrkrllzmqjwzwktrymvnkumi...

result:

ok 100 tokens

Test #4:

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

input:

1
100 100
...rz...n...ckib.scvfmc..dzkutbob.p.focu.w.g..m...y.ms..e...yizxoghtt...ebjc.i.w.ojqcpyt...jds.n..j.
mpv.p...x....utfn.a..w.k.cdgb.qro.g.i..f.....wgt.of......si.z..zjvh.js.kzh.tw....x..k.k.r..j...q.r.s
....l.p..qw..xg.s..p.g..b.rbz.ps.g.ns.pss.lum.c..g..l.wipyg...y.d....q.pbnvg.t..hq..p......

output:

....................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 tokens

Test #5:

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

input:

1
100 100
.f..............k...r........yg......................i.............................z..w.............
...............if...d..............................s......xn..g..t..................................
........k....................o..l......c....u...f.......................a..hc..............

output:

fkrygizw............................................................................................
ifdsxngt............................................................................................
kolcufahc............................................................................................

result:

ok 100 tokens

Test #6:

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

input:

1
100 100
...........x.................g................h......o............................x.................
......ll....l.....................................h........d...........m.....wl......r..............
......................................e......................l..............hq........g....

output:

raakfnllwtuxlliivpikxkzmqvyfsgmhcdwijseeizradqhdikhdbohaotmdwlrhqnnublamvjduhwljwsxtirgyxpiyfvxcuyym
rgrgdgmyfwxzurgaapgmzcvzzejepyaunfhcoyucqkcbjnpoegomtwgjoplyxaiedviguzzrxqnnqqpjzianpsledyovvfpbjqug
yrsiglmpwbpfgsgpmtppnxazkyzxptmaofajitdvejansqomxinjwdstawulzsnjbeleefvislrtgrrgoaxohajnvjqhbfvvcs...

result:

ok 100 tokens

Test #7:

score: 9
Accepted
time: 1ms
memory: 3936kb

input:

1
100 100
t.......o.s....l..........pv...nd....................................b..y.i...c....h................
.y......f.....r...........i....y....................r..................................k............
..............a......h.....l.......w.........................e........n....oi..............

output:

.......................................................................................toslpvndbyich
.............................................................................................yfriyrk
..........................................................................................ahlwenoi...

result:

ok 100 tokens

Test #8:

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

input:

1
100 100
.fm......c.p....................................p..g.........z.....va.......h....s........d.....t..z
.................g......f.....t..cxw.............g.............zs............m......d.........k.....
.....c.........h............r..............o.............f........fq.......................

output:

....................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 tokens

Subtask #2:

score: 7
Accepted

Test #9:

score: 7
Accepted
time: 35ms
memory: 3592kb

input:

32768
3 3
...
...
...
LLLLLL
3 3
...
...
...
RLLLLL
3 3
...
...
...
LRLLLL
3 3
...
...
...
RRLLLL
3 3
...
...
...
LLRLLL
3 3
...
...
...
RLRLLL
3 3
...
...
...
LRRLLL
3 3
...
...
...
RRRLLL
3 3
...
...
...
LLLRLL
3 3
...
...
...
RLLRLL
3 3
...
...
...
LRLRLL
3 3
...
...
...
RRLRLL
3 3
...
...
...
LL...

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 98304 tokens

Test #10:

score: 7
Accepted
time: 19ms
memory: 9736kb

input:

1
1000 1000
mofku..o..m..d..m.vq.gvqa...ze..uht....u.eq.f.ux...f...oz.h.dnyrm.mx.gc..fw.b...zz.nzcsbwb.y....wx.....l..bu.tq.s....w..ck.yp.ndi.v...e...kw.y..jmx..za.......v..dvb.euoevy.gs......q....h...vu.g.l...zrh.fyde..q...cqt.pu...u..e......a.jge.y..xqj.sr..e......y.o....q..gu..i.ireb..vrd.b.lcghj...

output:

mofkuomdmvqgvqazeuhtueqfuxfozhdnyrmmxgcfwbzznzcsbwbywxlbutqswckypndivekwyjmxzavdvbeuoevygsqhvuglzrhfydeqcqtpuueajgeyxqjsreyoqguiirebvrdblcghjrbbcmyipylfaknhqmnpgjoqbqfhopytskyasotcfpscqnpplcdotxjexbbaaubykdymnerbcudpzlqzlvgkoubnviqwgbnvaspgqhkiwjvzetjeqglsqhunplhxviwsxafghorcdhsrdpsqxixjbtpzbpkcpfme...

result:

ok 1000 tokens

Test #11:

score: 7
Accepted
time: 15ms
memory: 9524kb

input:

1
1000 1000
.if.y..h.......q...j.o.........g.fy..............n.h..l...n.....w.g.o..v..........o..........k.............q......j.xo.y.....o......vtg...l.......c.........c............o.....c..k.o...r.....rtn.s.f...oef.q.l.......vv........c......l..ozh.de....g...fk.....x.....k............nt.z..t..h.y.....

output:

ifyhqjogfynhlnwgovokqjxoyovtglccockorrtnsfoefqlvvclozhdegfkxkntzthykrhrlndtyrfktxkpnfdefhdgyxmgwuvbgesplqpeucixfnrxgaiddzsvsxkndgnqkndmjtughhjsfllfiskkfxmhckkgadndtuoshuptkomcduknnzpasyccwaucciiplbjdmsxlqofddlkccemctsedablrjrcfwcxjmmimyj..................................................................

result:

ok 1000 tokens

Test #12:

score: 7
Accepted
time: 14ms
memory: 9416kb

input:

1
1000 1000
........za........a..w.........................a..j..d.....x.......r..................f............z...o..tk....i.........b......r.....................v...........f..........................h..j...............h....pi......q...............d.....................v..t..................b........

output:

zaawajdxrfzotkibrvfhjhpiqdvtbfxvkigalnjzuxyydpeqgrajkccmuclahijypuacqysqknhemkitzsewjrkegofsfopd...............................................................................................................................................................................................................

result:

ok 1000 tokens

Test #13:

score: 7
Accepted
time: 11ms
memory: 9444kb

input:

1
1000 1000
z.................................................z...r...............................f.k.k...................................vx....................................................t....m...j.......................................................................h.....grs........q............

output:

zzrfkkvxtmjhgrsqaqbhtghwdsfzkiifnikahfchualzbv.................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #14:

score: 7
Accepted
time: 13ms
memory: 9376kb

input:

1
1000 1000
...........................................................................................................................................a............................................................................................................s....................v.....................

output:

asvpcavpds.....................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #15:

score: 7
Accepted
time: 22ms
memory: 9700kb

input:

1
1000 1000
lg.snn.x...bj...l.v..dn...p...lv.....j.zjltwpa...mnd.lag.vcr.xg..mop..uzia.bo.yuwev..cyjsw..wtspo...fc....a.n.r.b.cj.ou.unk...m...wkah....wj..iz.n.....j.j....s.w.uayb.chnoc...b..dzz.ju..b..tthhty..x...y.es.ex..q.m...j..f..i.aqnxw...mvsd....foc.g.w..qjt.fenirew...l...w..v.q..d.s....g.g.p....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #16:

score: 7
Accepted
time: 18ms
memory: 9428kb

input:

1
1000 1000
....l.....q.ew..c......................u.....u.h.ae......e..a............v.dd.......bb..t.....v.r...o..agl.c........l.neer....l.......sq..gqt..z........x.c.x.c..p..e..w......g................w..yj..l......i.t.......f.........fy......ipnk....tm..q..h.........g....uf....ic........h.q.l...k...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #17:

score: 7
Accepted
time: 19ms
memory: 9468kb

input:

1
1000 1000
..........a..........................b..m.......d........................e...............f.m.a....j...........x..........t.......................c..........................d..........c...z..............e...g...c.......o.........u.........t..................c.........................w.......

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #18:

score: 7
Accepted
time: 14ms
memory: 9356kb

input:

1
1000 1000
........r..............................r..i...............................v...................g.....................................................................................................x..........................................................................s...................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #19:

score: 7
Accepted
time: 13ms
memory: 9248kb

input:

1
1000 1000
.......................................................................................................................y...................................................................................................................................x.......................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Subtask #3:

score: 13
Accepted

Dependency #1:

100%
Accepted

Test #20:

score: 13
Accepted
time: 67ms
memory: 3548kb

input:

65536
3 4
.g.i
r..o
h...
LLLLLLLL
3 4
.g.i
r..o
h...
DLLLLLLL
3 4
.g.i
r..o
h...
RLLLLLLL
3 4
.g.i
r..o
h...
ULLLLLLL
3 4
.g.i
r..o
h...
LDLLLLLL
3 4
.g.i
r..o
h...
DDLLLLLL
3 4
.g.i
r..o
h...
RDLLLLLL
3 4
.g.i
r..o
h...
UDLLLLLL
3 4
.g.i
r..o
h...
LRLLLLLL
3 4
.g.i
r..o
h...
DRLLLLLL
3 4
.g.i
r..o
...

output:

gi..
ro..
h...
....
ri..
hgo.
gi..
ro..
h...
rgi.
ho..
....
g...
ri..
ho..
....
ri..
hgo.
i...
go..
rh..
....
ri..
hgo.
gi..
ro..
h...
....
ri..
hgo.
gi..
ro..
h...
rgi.
ho..
....
gi..
ro..
h...
rgi.
ho..
....
gi..
ro..
h...
rgi.
ho..
....
g...
ri..
ho..
....
ri..
hgo.
g...
ri..
ho..
....
rg..
hoi.
...

result:

ok 196608 tokens

Test #21:

score: 13
Accepted
time: 14ms
memory: 3876kb

input:

1980
10 10
..r..q.cl.
.onx......
.....e..s.
k.nke.....
...m.w...j
..........
dy...hx.v.
a..a....pc
...x..hi..
....dk....
L
10 10
..r..q.cl.
.onx......
.....e..s.
k.nke.....
...m.w...j
..........
dy...hx.v.
a..a....pc
...x..hi..
....dk....
R
10 10
..r..q.cl.
.onx......
.....e..s.
k.nke.....
...m.w......

output:

rqcl......
onx.......
es........
knke......
mwj.......
..........
dyhxv.....
aapc......
xhi.......
dk........
......rqcl
.......onx
........es
......knke
.......mwj
..........
.....dyhxv
......aapc
.......xhi
........dk
..........
..........
..........
..........
..........
...x.q....
...k.e..l.
k.r...

result:

ok 19800 tokens

Test #22:

score: 13
Accepted
time: 140ms
memory: 3844kb

input:

131072
3 3
...
...
...
LLLL
3 3
...
...
...
DLLL
3 3
...
...
...
RLLL
3 3
...
...
...
ULLL
3 3
...
...
...
LDLL
3 3
...
...
...
DDLL
3 3
...
...
...
RDLL
3 3
...
...
...
UDLL
3 3
...
...
...
LRLL
3 3
...
...
...
DRLL
3 3
...
...
...
RRLL
3 3
...
...
...
URLL
3 3
...
...
...
LULL
3 3
...
...
...
DULL...

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 393216 tokens

Test #23:

score: 13
Accepted
time: 67ms
memory: 3592kb

input:

47104
3 3
...
...
...
L
3 3
...
...
...
R
3 3
...
...
...
D
3 3
...
...
...
U
3 3
...
...
...
LD
3 3
...
...
...
LU
3 3
...
...
...
RD
3 3
...
...
...
RU
3 3
...
...
...
DL
3 3
...
...
...
DR
3 3
...
...
...
UL
3 3
...
...
...
UR
3 3
...
...
...
LDR
3 3
...
...
...
LUR
3 3
...
...
...
RDL
3 3
...
.....

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 141312 tokens

Test #24:

score: 13
Accepted
time: 6ms
memory: 3652kb

input:

1916
5 5
.....
z....
or...
tdb..
undn.
L
5 5
.....
z....
or...
tdb..
undn.
R
5 5
.....
z....
or...
tdb..
undn.
D
5 5
.....
z....
or...
tdb..
undn.
U
5 5
.....
z....
or...
tdb..
undn.
LD
5 5
.....
z....
or...
tdb..
undn.
LU
5 5
.....
z....
or...
tdb..
undn.
RD
5 5
.....
z....
or...
tdb..
undn.
RU
5 5...

output:

.....
z....
or...
tdb..
undn.
.....
....z
...or
..tdb
.undn
.....
z....
or...
tdb..
undn.
zrbn.
odd..
tn...
u....
.....
.....
z....
or...
tdb..
undn.
zrbn.
odd..
tn...
u....
.....
.....
....z
...or
..tdb
.undn
.utoz
..ndr
...db
....n
.....
.....
z....
or...
tdb..
undn.
.....
....z
...or
..tdb
.undn
...

result:

ok 9580 tokens

Test #25:

score: 13
Accepted
time: 1ms
memory: 4012kb

input:

1
100 100
.k.x.i.qj.j..w.h....a.x.ck...wd.......f......cu..ub.fz.g...pao.nhj.sm.c.q....avdz..hioll.fgg.ks...lo
...vfm..g.b.suco.xaxjw.q...c....k..k.w....jxp.a..lqh..vl..n....it...q.c.ei.pk..dt..p.ypeik..nvm..fo.
fx.l.zgg..k.qdwkegow.yi.....xse...s.nbk..lx..c.gh.w.l.q.e..qjpt.vhl.gr.......zya.nurl......

output:

dllwkqfpxwehsjvokwintrdomibwfaqnqjfwbqqekpuriuvpxlcxfrcenewfioidwkwiwpstntpfcvnaspwklwatizsqbmbrcbgu
oqmqhxrcekdnrcpvsvergjwwngzgmsyunjjzreqaizpdbankticpdqxmbjxicjlkinhzupcerrriorljxagvckufcagwxddqameo
wvjinxxfzpccttsbfjtujhogxekkgapoyoqasizzjegkbcfyxnpfsshardjoqoicgpvqsvyrlnnuqkckyorsstcnajnyhmlral...

result:

ok 100 tokens

Test #26:

score: 13
Accepted
time: 1ms
memory: 3644kb

input:

1
100 100
m..h...u....d......h..q...c.xo...t.g..bmdsy..........xl......h.bw....i....u.sv....e.j.b.tg..z.......
.zf.........p..h...m.iz.k....h..r..b.......z......d.e....l.............j.a.....lsi.x.....z..al......
...u..qy..........br.t....t...teio........qva............q......kz....w.........c.y....g...

output:

....................................................................................................
....................................................................................................
.....................................................................................................

result:

ok 100 tokens

Test #27:

score: 13
Accepted
time: 1ms
memory: 3924kb

input:

1
100 100
r.u.yr.r..mxdcv....xvg.....y...h...tlwmp.k..rzm.lq...oyc...e.kt..mt...n.....vs.y.jdwhqpy...lzk..ok..
.b.nls..lj.....nu.ywb.o.n..qh.o..l....tnn........y..igh..bpiq.acysz......vs.he....p.sro...c.mf.fjyt.
....d.n.u..odj.....crfidx....ef.pgcf.aejsz..diiml.w.s.b.g.cm.gp..su.pw..lpw.cy...jp..db....

output:

upoqykautgdzgbopalrkrrtantfzkwjqgzxpbbhoqdhcqqzkzvrgrzhwnlabyoirybvcovvdibcafvgygbpnyrhqpxnugadylykj
unbsbpjqevtfpylwsogyqunukoaophmzzcaoqooaflvakkseowpumhorrwbpbeacbzkbcnvlstsachdwoqzezgqmfqgsvjfyckvz
sieelnbedtfegpdncxilrfynoneijyvhclinpdkkhwhfanntpngojvrelkvsazvdgflodcadoygdbsjckhvwwjtjmfzhesynku...

result:

ok 100 tokens

Test #28:

score: 13
Accepted
time: 1ms
memory: 3772kb

input:

1
100 100
.....xq......ihm.g...l......x......p........d...op......f.......o....j....j..ze.y..pc....l....pv..qt
...a.id..i..rc...v..d......c...y.s.ke.......ij....t.f.b......vjbu...k.......qa.....l.....hm.........
...hq...l...h.y..dx..i.....u......i...e...k...w..r...h..a..tc.....u.y....t.......y.........

output:

axqdsonrqvuqypvptiqtiefbejrolheglfnijysgguqjhykiscqijptyvrjecvkqqrhnirqiokhfqmvkafchoqgkxvsvbviuipyl
lgvwimupljgrruyxchnehzzwzbxvxnewjkhezyffakhfkwcucfieorejyrcstsouuhhakarzpohtnngiimfgtatpcdttjbohyydc
flfgnmcolaweprtinofnomtoejbboopiyqhwuejgdhwfkyueehsvlxieiqsnvnpagooexffugfenvwpruqavjobxcucctryckc...

result:

ok 100 tokens

Test #29:

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

input:

1
100 100
................d.........e.....g..........o.........................................s..............
go.......b................t.......................g.................v...............................
...............gbxq....................................s.............d......i...e..s.......

output:

................................................................................................xvjn
...............................................................................................xhdfe
...............................................................................................bvx...

result:

ok 100 tokens

Test #30:

score: 13
Accepted
time: 1ms
memory: 3980kb

input:

1
100 100
..........p.........f.........................k...l.....r...........................g...............
........x.........t..................w...........................................................o..
..c..........................p.............a................................t..............

output:

....................................................................................................
...................................................................................................y
.....................................................................................................

result:

ok 100 tokens

Test #31:

score: 13
Accepted
time: 1ms
memory: 3744kb

input:

1
100 100
....................................................................................................
n...................................................................................................
fu.........................................................................................

output:

....................................................................................................
z...................................................................................................
to...................................................................................................

result:

ok 100 tokens

Test #32:

score: 13
Accepted
time: 1ms
memory: 3680kb

input:

1
100 100
....................................................................................................
q...................................................................................................
rz.........................................................................................

output:

lilhkdtbrwbxsjhkflzpafqyxaeawweinaazxmxbxtaqkqmoihcuineytioghsbihnzopjwarwiexcphfnhlmptniqqzffcswfk.
wwryswpzhzcvmrtypxieihzxiayfvebyqnhumknrxarztykrrnrqtybgbriycipxtkgbtvcetfbnfrpclryjnjijysecwiozdq..
vlrrwfftblrkxksopnvcycppoaddundymhlwldfvfikohbefddfbiiubszefzibtcxyqqyyjujvxwtfnlehcoludqfgcduxtv....

result:

ok 100 tokens

Subtask #4:

score: 14
Accepted

Dependency #2:

100%
Accepted

Test #33:

score: 14
Accepted
time: 111ms
memory: 3624kb

input:

124416
3 3
...
...
...
LLLLL
3 3
...
...
...
RLLLL
3 3
...
...
...
ULLLL
3 3
...
...
...
LRLLL
3 3
...
...
...
RRLLL
3 3
...
...
...
URLLL
3 3
...
...
...
LULLL
3 3
...
...
...
RULLL
3 3
...
...
...
UULLL
3 3
...
...
...
LLRLL
3 3
...
...
...
RLRLL
3 3
...
...
...
ULRLL
3 3
...
...
...
LRRLL
3 3
......

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 373248 tokens

Test #34:

score: 14
Accepted
time: 32ms
memory: 9712kb

input:

1
1000 1000
.a..h.hs..h....jj.....nbe..q..k..xns...xb...j....k.n...y...y...rud...wok....j......n...d...h...nw.d..u...q..m.....nxx.eta..ap....r..vd.t.cn.......k..h.n..oeu.z....pn.zu.kb.pwa....aa..y..s..uq...bnfg..hds.k.a.q.plm......d.q.v.xf.j.ao..j.k.f.o..yjf...p..d.z.lbhsceb....la.e.im...d.a.nghoc.....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #35:

score: 14
Accepted
time: 29ms
memory: 9612kb

input:

1
1000 1000
.x...r........i..d..d.....x.g...f.......d.g.......a......c.jy....t....z.n......t.a.....v.m.f..z.....k..y......ldr.pzs.vb.....l.u...f...h...i.n.j..o..c........ps....g.r.vr....j.......ium..j.ci.fv....v..ku....v...he.y....y.og......w....ed................aa..............l.....uj.q.........t...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #36:

score: 14
Accepted
time: 28ms
memory: 9420kb

input:

1
1000 1000
.............xf............x.........................z...d....e......................l......w...x...................................j............r....gf.......................z....................a...................z..................q..t..........v.....r....m...............v..............

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #37:

score: 14
Accepted
time: 20ms
memory: 9288kb

input:

1
1000 1000
...................h....l...........n....o..........u..........................................y....w.....................i..................t.....l..g.......................vl...........l....f....s...........g..m.....................s..................................u.....................

output:

fkzvxgiyjhotbzoxcblhqscklxykkhqlptmsnfonmonkdtivcrtcuettopemuraqcecallytukovkprlvvazewbrotkizbgyonhewbjxoogzwhoxvlgpdoxmxjiapvgqlyinazdinxsbktwhtmhlrygdzjetnbtpdsonzzjjkxlpiovlqdajaugvucylovczfcqyjssccnnwrkkqhgiwmedkyrkvgmbzvigmckfvxyshzelqvfvqegnzdejpjtcatqkhyabucxaqqufboixeuwovskigjfctwmtuwrxzrahk...

result:

ok 1000 tokens

Test #38:

score: 14
Accepted
time: 18ms
memory: 9216kb

input:

1
1000 1000
..................................................................................................................................................................................................................o................................................................................

output:

olplxixendbgzhhpairiv..........................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #39:

score: 14
Accepted
time: 19ms
memory: 9716kb

input:

1
1000 1000
e.liwd.go..g.f.m..dnngvnc..k.ijqmm.ejs..zwth.vl...so.r...z.......q.......wrr.o.la.xt.v.uxvyg.b.b.yn.h...imhih...t.b.b.z..r.s.r.x.....itz...qx.qyiq..di..........j.t..c.un..ek.vy.w...l...a.e.y.oi..nfue.b.j.p.j.pmipdy.pywkv.gr..io...b.....a..h.....l.uq...anlh.bz..n......y.rk..q..a.qrym.c......

output:

eliwdgogfmdnngvnckijqmmejszwthvlsorzqwrrolaxtvuxvygbbynhimhihtbbzrsrxitzqxqyiqdijtcunekvywlaeyoinfuebjpjpmipdypywkvgriobahluqanlhbznyrkqaqrymckqxobeuioesdhhigafxdxdkrkpssfiotqkmwhxstpfjntporgedbghuvmoifizkdlepfzsojryqypwzyfhjhtpxinuvzwqdoknoqfznmjshviwdewfokkujqualtwyebojuorfaapxnyggyquyrmjyfjqidkgy...

result:

ok 1000 tokens

Test #40:

score: 14
Accepted
time: 15ms
memory: 9504kb

input:

1
1000 1000
....a........p.x...p..r.........c.kr.v.gm...jh..cpyyf...w...k.w.t..m.v.x......w........cry....i.....p............h......eb...q...v....mwf.w.hb.hea....r......c..z....m..s.o..nswdh............i.e..........z.....lwu......t.......h.zw....zm...........bk....q..v........i....k.mtq......u.ei......

output:

apxprckrvgmjhcpyyfwkwtmvxwcryiphebqvmwfwhbhearczmsonswdhiezlwuthzwzmbkqvikmtqueigfvjzvpsrrqpmchxhtiovrgbqdxdjqzaiukswxkjvjuopxwqlnrrfluwhkabewtyricecqlapyleubwaciczhyrihtogbhrasydledgtoevzgkrhokyuwfoyzwgprwpxmclkuojdpmtuzggdgejuvwsymfvgd..................................................................

result:

ok 1000 tokens

Test #41:

score: 14
Accepted
time: 11ms
memory: 9468kb

input:

1
1000 1000
q............................j....................h...r....s.....r...........l...........e.es.............s...t..f..z.....m..c...........j.u.................................a......d.b........f....w................o.s....................c....a...z.....u....l.........s.................x......

output:

qjhrsrleesstfzmcjuadbfwoscazulsxflbkursgkkoxljfqpatpcxcczyohjuivciqmuskmmzlexyadahttwp.........................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #42:

score: 14
Accepted
time: 11ms
memory: 9268kb

input:

1
1000 1000
..................................................................u..f...........................................q....m............u.............p.................o..........................t.....................v.i..................................................................a.........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #43:

score: 14
Accepted
time: 13ms
memory: 9372kb

input:

1
1000 1000
.........................................g.........................................................................................................l.......................................................................a.......................................................................

output:

glaemlmi.......................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #44:

score: 14
Accepted
time: 31ms
memory: 9688kb

input:

1
1000 1000
.xx.px.t....ui.h...l...ey.meq.rfj..xn.j.kiavp.xob.o.x.hgc.dx..pkl...t..dbx.....lmi.a.jy......j.....aabvw...m.yg.syoqwwlb.sdbwy.m.e...l.fo.a.u....jlqm.m.oc.df..tkeee.w.p...gr.e.kb..rg.o.k.m.ni..zci..i.btzidfp...q..lscb...nit.b..k...t....dg.efa.npv......qxr.h..h.f.u.lvtx.kx..c.dy.niqn.zbez...

output:

yxxgpxatfcvvuimhyvtlihjeyimeqarfjgwxngjtkiavpgxobrotxqhgcvdxpqpklbgqtmydbxugauslmihadjytsfagajdxmntaabvwadrmnygrsyoqwwlbnsdbwypmieffxlrfogaxuidnijlqmamtocodfjhtkeeefwvpnksgrlejkbylrgroykxmsniluzcitoiobtzidfpdnaqnplscbgdcnitgbkjkevetnamvdgxefahnpvqcsppxqxrbhvwhgfluhlvtxekxxhctdygniqnxzbezuvhncrhozyie...

result:

ok 1000 tokens

Test #45:

score: 14
Accepted
time: 29ms
memory: 9656kb

input:

1
1000 1000
.........vbo.a.qs...b........b....k..f.so.p...o....x....v.g.........b......tt...j..ju.f..d.........q...yi.....h..ybl..efx.j...i....ce..rd......d....nns.......efr..s........h.......c..v.mg.b.q..c......k......f....y.c..m.ehy...cj...n...t........v.....d....a.q.f...........f...a...v........a...

output:

zwoqmthopvbomaeqsajgbkzvrkdsubtcjhkwtfdsobpgvhongcdxclwkvagkfbytwjvablelwbxttvhjjcvjubfpodmmxdhlifrqujmyijjrhuhsjyblrtefxdjnhyicieccewlrdrgpogbddrbhnnsdrlvqnqefrbgsajnhpfughqexptppcoovjmgkbkqwncgfkzvakhzfimyfjktpyzcjqmzehyebbcjnqunlkktgizjvumfvpytnedvnxaarqefsybrwagrwepfmgxaibivmqhzqgofadoenulznttlj...

result:

ok 1000 tokens

Test #46:

score: 14
Accepted
time: 25ms
memory: 9472kb

input:

1
1000 1000
........b.........x..q..................................b.....w..gk...............h....kk......x............ff....j.................s...............................q.......................x......a.................................y.............h..b...v..t.............i..m....l.........w.....

output:

helayyrdbbkhssottfxqhqwceoctcumqmrfutcpkrfdgjicxcrcimberbdqxyewukgkttvbtccpxnkahichcdjokkzhzesgxejwkyufvmfkbfflpsejakognhnwmbmhwzgzystxefhegwwykvpomuxljymgjqyxedwgsqrdtzhjjcrbcfmngdfhdcmfixxrwxldacdxxpkqughsjeotdgrcgkqtjnpbqjjeapypkyuesmzkzpqchtkburbvlhtiycjqiolxtfwliegmsfyxlrsiickxchwbsxqptsuhcezld...

result:

ok 1000 tokens

Test #47:

score: 14
Accepted
time: 20ms
memory: 9304kb

input:

1
1000 1000
.....................................y.a................................v........w......n.....r...........k...........k..............l........................................................................z..k......k....................................................h.....................

output:

coddfoipovmgmrydhioveavlnfaznudtejuefysaywndqnewbppjxczsreuutyrdfhviskzpvmqiggxsgwgnzuuenujpjsrstzsxmrxhtqkgycnlxxfkbdkdtkwawiiwvqxfwlhnkyfdbmqgktksjfjbdlouqbeeebqphsfypleoncddcdacgiclpkpvsenzdttxtmdakdthimzbmkcfacnekojzrpgmtdjmydglyuxxxojlvswtxqlioxgidvqvolzgpkhgltrovhenhnrnihpxolggmvtaapxnwvsackbf...

result:

ok 1000 tokens

Test #48:

score: 14
Accepted
time: 18ms
memory: 9272kb

input:

1
1000 1000
...............................................................p................................................................e...............................................................................................................................................v..................

output:

zuajdcgaojgtoarzakivkptdtxwwmblvpfqapppxkzpxcqpyrbrityzukbsoyjppwstojxanqvdtfyoiptartgmliryjgckbqwwoghapuznvahzqbvbrpmielmsnsdzfejtmmubhvdpununqleoywsrmuzvleihsxposeraodbonpgzuzzfoicjzgucrpgadiudkvoelqbopmicomjlmvtzjoextpnsubgijgepwfnglurmapvowkjzeevhdenuksorngcadwcruzqavvmrieazpamwrjkoihnyogboamilk...

result:

ok 1000 tokens

Subtask #5:

score: 12
Accepted

Test #49:

score: 12
Accepted
time: 107ms
memory: 3848kb

input:

131072
3 3
...
...
...
LLLL
3 3
...
...
...
DLLL
3 3
...
...
...
RLLL
3 3
...
...
...
ULLL
3 3
...
...
...
LDLL
3 3
...
...
...
DDLL
3 3
...
...
...
RDLL
3 3
...
...
...
UDLL
3 3
...
...
...
LRLL
3 3
...
...
...
DRLL
3 3
...
...
...
RRLL
3 3
...
...
...
URLL
3 3
...
...
...
LULL
3 3
...
...
...
DULL...

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 393216 tokens

Test #50:

score: 12
Accepted
time: 71ms
memory: 3880kb

input:

47104
3 3
...
...
...
L
3 3
...
...
...
R
3 3
...
...
...
D
3 3
...
...
...
U
3 3
...
...
...
LD
3 3
...
...
...
LU
3 3
...
...
...
RD
3 3
...
...
...
RU
3 3
...
...
...
DL
3 3
...
...
...
DR
3 3
...
...
...
UL
3 3
...
...
...
UR
3 3
...
...
...
LDR
3 3
...
...
...
LUR
3 3
...
...
...
RDL
3 3
...
.....

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...

result:

ok 141312 tokens

Test #51:

score: 12
Accepted
time: 56ms
memory: 17648kb

input:

1
100 10000
.a.aaaa.a..a.aa.a...a...aa.a.a..aaa..a..a.aaa..aaa.a..aaaa..a...a...aaa..a..aaa..aaa.a.aaaaaaaaa...aa..........aa..a....aaaaa.aaa..a.a.aaa.a.aa.........a.aa....a..a.a..a.aa..aa..aaa.a..aa..a......aaaa.aa..a.aa.aaaa.aaa.aaa..a...aaaa....aaa.a.a...aaaaaa.aaaa.aaa.aa.a.....aa.aaaa...a..aaa....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #52:

score: 12
Accepted
time: 40ms
memory: 14476kb

input:

1
100 10000
...a.aaa.........a.......a........a........a.....aaa.a.aaa.....a........a.a..a....a....a...a.....a.a.a.aa...aa.a.a.a.a......a..a..aa.a..a........a....aa.......a..a....a...aaa.....a..........a..aa...a..a.a....a..aa...a...a.....a.......a......a....aa....a..a.aa....a.......a....a....a....a....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #53:

score: 12
Accepted
time: 29ms
memory: 12536kb

input:

1
100 10000
.......a.....................a.........................a......aaa......a...........aa......a.........a..........a...........a..a.......................aa.......a.a.......................a.a......a........aa.........a....................a.a....................a.a..a...........a..............

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 100 tokens

Test #54:

score: 12
Accepted
time: 41ms
memory: 17744kb

input:

1
100 10000
.aaa.a.a..aaaa.aaa.aa...aa.aa..aaaaaaaa..a.aa....aa....a..a.a..aaaaa..aa....a..a.aaa.aaaaaa.aaaa.aaaaa..aa.aa...a.a..aaaa..a.aaaa.a.a.a..aaaa.a.a.aaaa..a.....a...a.aaaa.a..aaaaaa.aaa..a..a..aaa..aa.aaa.aaa.aaa...a.aa.a.a.aa.aa...a....a.a.aa.a.aa..aa..a.a.a......a.a.aa..aa..aaa.a.aaaa...a...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #55:

score: 12
Accepted
time: 31ms
memory: 14476kb

input:

1
100 10000
.a..a......a.a...........a........a....a........aa.a.aa..a..a......aa...a.......a.....a....a...a...a...a........a.....a...........a.....aa.....a.aa...a..a............a.aa.......a..........a..a..aa.........aa..aa....a............a.a.a.....a.a..........aa.aa...a.........a.a..aa...a.aa........

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 100 tokens

Test #56:

score: 12
Accepted
time: 25ms
memory: 12836kb

input:

1
100 10000
..a.............a........a.a.a.....a.................a......a.a......a..........a......................a.........aa.a........a............a......a..aaaa...........a....a.a......a..................a.........a......................a............a....a........a..........................a...a...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #57:

score: 12
Accepted
time: 22ms
memory: 12044kb

input:

1
100 10000
...............................a.......................a.........................a.....................................................a........a...................................a................................................................a......a.........a............................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #58:

score: 12
Accepted
time: 14ms
memory: 11356kb

input:

1
100 10000
....................................a..........................................a.................................................................................a................................................................................a................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 100 tokens

Test #59:

score: 12
Accepted
time: 20ms
memory: 11392kb

input:

1
100 10000
...................................................................................................................................................................................................................................................................................................

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 100 tokens

Subtask #6:

score: 11
Accepted

Dependency #5:

100%
Accepted

Test #60:

score: 11
Accepted
time: 64ms
memory: 18632kb

input:

1
1000 1000
.aa.a....a.a...a.aa..aa.a.a.a....aa.a.....a..a.aa.a...aaa.....aaaaa..aa.a.aa..aa.aa.aaa.aaa...aaaa.a..aa..a.aaa.aa...aaaaaa..aa......a.aaaa..a.aaa......aaa.aa.aaa...aa..a.a....aaa......a.aa..aa.aa.a.aa.aa.aaaaaa..aa.aaaaa.aaaaaa.a.a....aaa.aaaaaa.aa.....aaaa.a.a..a.aa..aa.aa..aa..aaa...a...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 1000 tokens

Test #61:

score: 11
Accepted
time: 40ms
memory: 15212kb

input:

1
1000 1000
...a.......aa.......a.a...a...a..a.....a........aa..aa......a..........a..a.....aa...aa.....a..a.aa..a...aa....a.........a...a.aa.a.a........a.a...........a.a........a..............a...aa......a......a....a.aa...a..aa.a...............a.a...a...aa..a.....a.a.a.........a..a..a.........a.aa...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #62:

score: 11
Accepted
time: 43ms
memory: 13488kb

input:

1
1000 1000
...a.....a.....a.......a.a.................a......a...a...a.........a.a.a............................a...........a............a......a.............a.........a.......a.a..a.......a............a..............a..........................................a..a..a....a...a..........................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #63:

score: 11
Accepted
time: 46ms
memory: 19460kb

input:

1
1000 1000
.aaaaa.a..a.aa..aaa..a..aaaa..aaa..a..a...aaa.aa.aa..a.a..aaaaa..........aa.a.aaaaa.a...a...a.aa.aa...aaaa.....a.a.a....a....aa.aaa.a.a.a.a..a..aaa.aa..a.a......aa.a.a.a.a.aa...a.a.a.aaaaaaaaa..aa.a.aa.aaa.aa.a..aaa..a..a..a..aaa...a.aaa..a....a.aaa.aa.a...aaa.aa..a.a.......a..aaaaaa.aaa...

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 1000 tokens

Test #64:

score: 11
Accepted
time: 39ms
memory: 16236kb

input:

1
1000 1000
a......aaa.....a.....aa.....a........a.a..........a...a........a...aa.....a.............aa...a...........a............a.a...a..a.....a...a.....a..aa.a.aa....a...........a..a.a.....a.......a.....a.aa..a.a......a.aa....a....a...a...............aa...a...a.....aa.aa....a....aa......a...aaa.....

output:

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 1000 tokens

Test #65:

score: 11
Accepted
time: 31ms
memory: 14360kb

input:

1
1000 1000
..a.....a..aa........a......aaa.....a..a.......aa.......................a..a...............a..a..a.a.....a...........a....a.....a.......a..aa............a.......................a.................a.......aaa....................a...a...........a...........a..a.........a........a....a.........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #66:

score: 11
Accepted
time: 19ms
memory: 13700kb

input:

1
1000 1000
.................a...a...........................a.....a..a.............a.a....a.........a...........a.a........................................................a....aa.........................a...........................a...a....a...........a.....................a..........a....a...........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #67:

score: 11
Accepted
time: 14ms
memory: 13132kb

input:

1
1000 1000
........................................................................................................................................................................................................................................................a..........................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #68:

score: 11
Accepted
time: 17ms
memory: 13020kb

input:

1
1000 1000
..a................................................................................................................................................................................................................................................................................................

output:

..............................................................................aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

result:

ok 1000 tokens

Subtask #7:

score: 9
Accepted

Test #69:

score: 9
Accepted
time: 31ms
memory: 3884kb

input:

21844
5 5
.....
q....
ng...
gip..
dygv.
L
5 5
.....
q....
ng...
gip..
dygv.
D
5 5
.....
q....
ng...
gip..
dygv.
R
5 5
.....
q....
ng...
gip..
dygv.
U
5 5
.....
q....
ng...
gip..
dygv.
LL
5 5
.....
q....
ng...
gip..
dygv.
DL
5 5
.....
q....
ng...
gip..
dygv.
RL
5 5
.....
q....
ng...
gip..
dygv.
UL
5 ...

output:

.....
q....
ng...
gip..
dygv.
.....
q....
ng...
gip..
dygv.
.....
....q
...ng
..gip
.dygv
qgpv.
nig..
gy...
d....
.....
.....
q....
ng...
gip..
dygv.
.....
q....
ng...
gip..
dygv.
.....
q....
ng...
gip..
dygv.
qgpv.
nig..
gy...
d....
.....
.....
q....
ng...
gip..
dygv.
.....
q....
ng...
gip..
dygv.
...

result:

ok 109220 tokens

Test #70:

score: 9
Accepted
time: 4ms
memory: 3660kb

input:

1596
5 5
.....
g....
uq...
rzy..
csls.
L
5 5
.....
g....
uq...
rzy..
csls.
R
5 5
.....
g....
uq...
rzy..
csls.
D
5 5
.....
g....
uq...
rzy..
csls.
U
5 5
.....
g....
uq...
rzy..
csls.
LD
5 5
.....
g....
uq...
rzy..
csls.
LU
5 5
.....
g....
uq...
rzy..
csls.
RD
5 5
.....
g....
uq...
rzy..
csls.
RU
5 5...

output:

.....
g....
uq...
rzy..
csls.
.....
....g
...uq
..rzy
.csls
.....
g....
uq...
rzy..
csls.
gqys.
uzl..
rs...
c....
.....
.....
g....
uq...
rzy..
csls.
gqys.
uzl..
rs...
c....
.....
.....
....g
...uq
..rzy
.csls
.crug
..szq
...ly
....s
.....
.....
g....
uq...
rzy..
csls.
.....
....g
...uq
..rzy
.csls
...

result:

ok 7980 tokens

Test #71:

score: 9
Accepted
time: 49ms
memory: 18492kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #72:

score: 9
Accepted
time: 49ms
memory: 18452kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

cahwmrzsfwqutmckryykoorcqorfbufreyystfancxssssheekpaytgqdflhmezihiwielbmssmzpyedhubtvkhbzjyncociblmxplbadqjqfvbfkppjiwwnervthtddaxkxduumhjovhocxermysptjaslgkrxepqaindfpajccroyyngacguzdrvoyyvapxerewktquzsvhcbakhrjhonmxdmpuedmqrsdtxwlrnlamkmqzcysooixcywcdowtvqtcpqlpjjufoluuoxwdltatyykvwrvoasonnjertccn...

result:

ok 1000 tokens

Test #73:

score: 9
Accepted
time: 53ms
memory: 18624kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

.ywgiekdiznbsynqsikkdvyptoksxvlwjzrlqwgcubkufncmzxsdqipqitgrvxchctwjolyrqhvofehydhqnatypadyaztubwuevvokevijztwplzkqjxzwonptuoyvomlyhroqrbjbasnasenngrgfcpqtlpxiamkqxtbgceqrirvdmqxuczkceqeunpomuvwecjtijecddhtcnhltthwdeufrwhxuhskbmzvajkkfopxadwjnksfbpvdjcwjobllynnzgznaswacwpkkfbaxomybabbzeeuwjesweqkvfn...

result:

ok 1000 tokens

Test #74:

score: 9
Accepted
time: 44ms
memory: 19444kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #75:

score: 9
Accepted
time: 34ms
memory: 19416kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #76:

score: 9
Accepted
time: 28ms
memory: 19460kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #77:

score: 9
Accepted
time: 48ms
memory: 19440kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #78:

score: 9
Accepted
time: 50ms
memory: 19436kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

jarybxylthztevxmqrvbyyabgffoymnwebkzlwnsgszkscztfqftrurmdkeqhiztwlwhtksxspzajocamyaemwhgszrdupbcplgsrwmqbubfzcjjosbmcdkvclsqhmodyhpbhilztovimrnwelhvunrirtlsegyvhroohthmefhdhlmbulvtakoyvpifdenxjhgskpjefygaetsbtezmdgjxygyrfmjecwjrnddgoygcuhmdkpkrzurpavibbtuolbkbrzkgoxkcnkpugqouzqsmrohkaeuffmlcupesaeba...

result:

ok 1000 tokens

Test #79:

score: 9
Accepted
time: 40ms
memory: 19480kb

input:

1
1000 1000
...................................................................................................................................................................................................................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Subtask #8:

score: 14
Accepted

Test #80:

score: 14
Accepted
time: 108ms
memory: 3588kb

input:

49152
3 4
....
....
....
LURD
3 4
....
....
....
LURDLURD
3 4
....
....
....
LURDLURDLURD
3 4
....
....
....
LURDLURDLURDLURD
3 4
....
....
....
LURDLURDLURDLURDLURD
3 4
....
....
....
LURDLURDLURDLURDLURDLURD
3 4
....
....
....
LURDLURDLURDLURDLURDLURDLURD
3 4
....
....
....
LURDLURDLURDLURDLURDLUR...

output:

....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
....
...a
....
....
...a
....
....
...a
....
....
...a
....
....
...a
....
....
...a
....
....
...a
....
....
...a
...

result:

ok 147456 tokens

Test #81:

score: 14
Accepted
time: 120ms
memory: 3652kb

input:

49152
4 3
...
...
...
...
LURD
4 3
...
...
...
...
LURDLURD
4 3
...
...
...
...
LURDLURDLURD
4 3
...
...
...
...
LURDLURDLURDLURD
4 3
...
...
...
...
LURDLURDLURDLURDLURD
4 3
...
...
...
...
LURDLURDLURDLURDLURDLURD
4 3
...
...
...
...
LURDLURDLURDLURDLURDLURDLURD
4 3
...
...
...
...
LURDLURDLURDLUR...

output:

...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
..a
...
...
...
..a
...
...
...
..a
...
...
...
..a
...
...
...
..a
...
...
...
..a
...
...
...
...

result:

ok 196608 tokens

Test #82:

score: 14
Accepted
time: 48ms
memory: 19404kb

input:

1
1000 1000
.igk...obd.pt.pe..ctn..oz..ws.ze...kun..fq..egs...ry......soj....ksiridr...w.i...q.wx.qovu.m.......m..sr..ev.nu..s..dwg.....j.z.t..un.qjrd..nm.v...j..wt.t.n.ym.ue..k.w..aj...lud..v.d..va.mjx.k.....qng..h.b..r.dvirvyyhv....fsqonar.kc..bw....xc.o.fe.b.a.rf.o.z..bmmmv..tru......fou......zr....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #83:

score: 14
Accepted
time: 26ms
memory: 16264kb

input:

1
1000 1000
...y.......f..f.n......h.....qe....i.l....i.zj..............oo.maa......m......f........i....l...p........q.........a.u.n...fs.e.....c.wh......u.....ctx.qg...r..d.t........wd.......pg.b......mm..j..h...v....h....s.o.....d....p...e...q..........jb.r.d..f......e...........t..x.c.oa...........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #84:

score: 14
Accepted
time: 30ms
memory: 14380kb

input:

1
1000 1000
...........c........u....u...................y......................................................n............b.r.................y.........d.............................e..........n...k................n........................n.............i.....c............l...........k..........k....

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #85:

score: 14
Accepted
time: 23ms
memory: 13860kb

input:

1
1000 1000
...............h.....h...........................................................................................b........z..................................................k.........................c...........b................................................g..uy..........................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #86:

score: 14
Accepted
time: 20ms
memory: 13172kb

input:

1
1000 1000
...........................................................................................................................................................................................................................................................................................k.......

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Subtask #9:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #87:

score: 11
Accepted
time: 139ms
memory: 3588kb

input:

131072
3 4
.tf.
..di
b...
LLLLLLLL
3 4
.tf.
..di
b...
DLLLLLLL
3 4
.tf.
..di
b...
RLLLLLLL
3 4
.tf.
..di
b...
ULLLLLLL
3 4
.tf.
..di
b...
LDLLLLLL
3 4
.tf.
..di
b...
DDLLLLLL
3 4
.tf.
..di
b...
RDLLLLLL
3 4
.tf.
..di
b...
UDLLLLLL
3 4
.tf.
..di
b...
LRLLLLLL
3 4
.tf.
..di
b...
DRLLLLLL
3 4
.tf.
..di...

output:

tf..
di..
b...
....
f...
btdi
tf..
di..
b...
btfi
d...
....
t...
df..
bi..
....
f...
btdi
f...
ti..
db..
....
f...
btdi
tf..
di..
b...
....
f...
btdi
tf..
di..
b...
btfi
d...
....
tf..
di..
b...
btfi
d...
....
tf..
di..
b...
btfi
d...
....
t...
df..
bi..
....
f...
btdi
t...
df..
bi..
....
b...
dtfi
...

result:

ok 393216 tokens

Test #88:

score: 11
Accepted
time: 111ms
memory: 3848kb

input:

14360
10 10
......pywj
...r......
.z....m..p
l....z.q.t
...v....m.
....m..ua.
.....n..c.
....nu..sj
.pb....t.f
..ytw.....
L
10 10
......pywj
...r......
.z....m..p
l....z.q.t
...v....m.
....m..ua.
.....n..c.
....nu..sj
.pb....t.f
..ytw.....
R
10 10
......pywj
...r......
.z....m..p
l....z.q.t
...v.......

output:

pywj......
r.........
zmp.......
lzqt......
vm........
mua.......
nc........
nusj......
pbtf......
ytw.......
......pywj
.........r
.......zmp
......lzqt
........vm
.......mua
........nc
......nusj
......pbtf
.......ytw
..........
..........
..........
..........
..........
........wj
.......ymp
......

result:

ok 143600 tokens

Test #89:

score: 11
Accepted
time: 55ms
memory: 18516kb

input:

1
1000 1000
....x.urz.z.hf..i.qj...ft.a..lvi..s..c.a..h.ql.yfe...p.vdd.ja......h.i.od..v.f.........mo.........y..o......ri.lomjv.rh...m.fl....s.j.e...ru...tf..xg.ua.m...n.w.m...ndh.....zh.m..x..d.e.q...tukn..sp.wx....o.zxb.w..g.fl...tn.s..eii.q.lw.vl.tibc..o..u.pffzu.n.yik..n..ib....ufddpx..azp....u...

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #90:

score: 11
Accepted
time: 40ms
memory: 15212kb

input:

1
1000 1000
.pal..mo.....b.f...j.............bs..k.....m...b.v.m...x....h..zz.....x..s....d......kn....gt......g................irxf..f.q..g....q.z...o...........wh.m....x..b......app........ve.u.j.f.....lw..c....dpe....e..cn..b..gk.t..........l..n.d........a.........n.yh.....vgcul.n...v.....jh........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #91:

score: 11
Accepted
time: 39ms
memory: 13444kb

input:

1
1000 1000
..v.......d.......e.....n...........................t...pa.........u...........b..................m......................o........n...........z....u..........e..................o.................i....h..............o...d........o...........................d..........v.......................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #92:

score: 11
Accepted
time: 39ms
memory: 19444kb

input:

1
1000 1000
.y..i.sd.av..ucy....t..tv..k.rw.b.n.t.s..mjt....cx..cg.......nz..x.z.r...w.tr.o...g.g....m....o....f...a.gk.....z.w...ll.ye..i..y...nzv.nm.p.mh...zm.kac...zgroj..od..kv.g....tt..i.ot...d.p.zp.pljlqd..i......zl.kf.y..w..........pv.g.ja..il..hove...r.lvf..h......pq...fu....w...oo.kv.u........

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #93:

score: 11
Accepted
time: 31ms
memory: 16228kb

input:

1
1000 1000
h.i..u....b........b.m..t..r.......d.........tt..o....gx..yl.p.r..h.e.h...f.......w..zw...m.q.......i..vd.d.e..x.w.....l..h...l..k...a.s....g.a..i...d..ax....l...z..b.k.ln.d....x..g........a..hr....i....v...q....r.o...l.j.p.ml......vs.m.........w.qnpf.........z...uu...i.......o.k...........

output:

dteqmproxwfyzhyifqoycjklgjmatqchmcwspbwllrgcisepgrosssgrvzqhxjfaxnozptbpoivibmolgkhcuijcpupashnsnzyjfeldqnleiwjagogcwrtbonfzttlilgruospmmrfzmzsjduijeturqtwshlscvmqlqajfwaxsanntjtcdnbwsybpqispftszrfwrwdlrnyphjxyxsnbrnwqqqelrpizisvtkodkqpxqeyejpvqlerjojxielvvwkbhqwtjfwsrdzlibbratwjrkaqpzxhqiojhxnpxilc...

result:

ok 1000 tokens

Test #94:

score: 11
Accepted
time: 23ms
memory: 14328kb

input:

1
1000 1000
.....g...m........q.............fw..m................v..n.................................a...........r..v......................c........ag...ll..........m.......................l...............l............j.y......lb..........................d...........w......r...z...........m...........

output:

xcjztfbvzskyiwgjpmulyoisvczemudjtjbjkimsydmtwyknahwcngelntcinjuzpzwvweptcjmqqfscyryrcvczqsyywhlbwubxdqcntgdlaznwdzmqaufcphiadkvrruvvgxqququwptuxfijekomnvjrhpbhgfskciooyjyaimhdliloctnokrocgpodqbesuwkzzgbwvwaqydrjikpjpqxtzhykezdzeosorjpmcuprgvutcnyhgvynhjrxfnomietxysapsdzwvhpeglzvtanqhcfvepovkegvimlqf...

result:

ok 1000 tokens

Test #95:

score: 11
Accepted
time: 27ms
memory: 13716kb

input:

1
1000 1000
.........................p..........tt............w.......m....................................e..............................................o.......................................l........................o..e........d..........c..............b...........................h.................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #96:

score: 11
Accepted
time: 12ms
memory: 13184kb

input:

1
1000 1000
..................................................................................................................i.............................a.......................................................u..........................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Test #97:

score: 11
Accepted
time: 21ms
memory: 13104kb

input:

1
1000 1000
.............................................................................................................................................i.................................................h...................................................................................................

output:

...............................................................................................................................................................................................................................................................................................................

result:

ok 1000 tokens

Extra Test:

score: 0
Extra Test Passed