QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#720897 | #5539. Nightmare Brother | xuxuxuxuxu# | AC ✓ | 1ms | 3876kb | C++14 | 3.5kb | 2024-11-07 14:37:39 | 2024-11-07 14:37:41 |
Judging History
answer
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstring>
// #define meow(args...) fprintf(stderr,args)
#define reg
using namespace std;
int n,m,x[1002],len[1002],du[1002];
string t[1002];
char res[1002];
int vis[1002];
int main()
{
cin>>n>>m;
for(reg int i=1;i<=n;++i)
{
cin>>x[i]>>t[i];
len[i]=t[i].length();
}
for(reg int i=1;i<=n;++i)
{
for(reg int j=i+1;j<=n;++j)
{
// meow("%d %d:\n",i,j);
int u=i,v=j;
if(x[u]>x[v]) swap(u,v);
// meow("x:%d %d len:%d %d \n",x[u],x[v],len[u],len[v]);
if(x[u]+len[u]-1<x[v]) continue;
bool flag=0;
for(reg int k=x[v];k<=min(x[u]+len[u]-1,x[v]+len[v]-1);++k)
{
// meow("%d %c %c\n",k,t[v][k-x[v]],t[u][k-x[u]]);
if(t[v][k-x[v]]!=t[u][k-x[u]])
{
flag=1;
break;
}
}
if(flag)
{
++du[u];
++du[v];
}
}
}
int cnt2=0,cnt1=0,cntd=0;
for(reg int i=1;i<=n;++i)
{
if(du[i]>=2) ++cnt2,cntd=du[i];
else if(du[i]==1) ++cnt1;
}
if(cnt2>1)
{
// meow("2>1\n");
return !printf("-1\n");
}
if(cnt2==1)
{
// meow("2==1\n");
if(cnt1>cntd) return !printf("-1\n");
for(reg int i=1;i<=n;++i)
{
if(du[i]<2)
{
for(reg int j=0;j<len[i];++j)
{
vis[j+x[i]]=1;
res[j+x[i]]=t[i][j];
}
}
}
for(reg int i=1;i<=m;++i)
{
if(!vis[i]) return !printf("-1\n");
}
for(reg int i=1;i<=m;++i)
{
putchar(res[i]);
}
putchar('\n');
return 0;
}
if(cnt1>2) return !printf("-1\n");
if(cnt1==2)
{
// meow("1==2\n");
reg int rt=0;
reg bool flag=0;
for(reg int k=1;k<=n;++k)
if(du[k]==1)
{
flag=0;
for(reg int i=1;i<=m;++i) vis[i]=res[i]=0;
for(reg int i=1;i<=n;++i)
if(i!=k)
{
for(reg int j=0;j<len[i];++j)
{
++vis[x[i]+j];
}
}
for(reg int i=1;i<=m;++i)
{
if(!vis[i])
{
flag=1;
break;
}
}
if(!flag)
{
if(!rt) rt=k;
else return !printf("-2\n");
}
}
if(!rt) return !printf("-1\n");
for(reg int i=1;i<=n;++i)
if(i!=rt)
{
for(reg int j=0;j<len[i];++j)
{
res[x[i]+j]=t[i][j];
}
}
for(reg int i=1;i<=m;++i)putchar(res[i]);
putchar('\n');
return 0;
}
// meow("0==0\n");
for(reg int i=1;i<=n;++i)
{
for(reg int j=0;j<len[i];++j)
{
++vis[x[i]+j];
res[x[i]+j]=t[i][j];
}
}
for(reg int i=1;i<=m;++i)
{
if(!vis[i]) return !printf("-1\n");
}
for(reg int i=1;i<=m;++i)putchar(res[i]);
putchar('\n');
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3728kb
input:
3 11 5 JAKARTA 1 ICPC 3 BINUS
output:
ICPCJAKARTA
result:
ok single line: 'ICPCJAKARTA'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
3 9 6 EX 8 AM 1 FINAL
output:
FINALEXAM
result:
ok single line: 'FINALEXAM'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3748kb
input:
3 8 1 GRAD 5 UAL 6 ATE
output:
-1
result:
ok single line: '-1'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3764kb
input:
3 5 1 BIN 4 US 4 OM
output:
-2
result:
ok single line: '-2'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
1 1 1 X
output:
X
result:
ok single line: 'X'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3620kb
input:
67 39 6 DWQ 9 H 38 QH 14 YELVTIGSXHTMBQYQTJLJQUENQ 28 YQTJ 10 PLXKYELVTIGSXHT 8 QHPLXKYELVTIGSX 24 TMBQ 18 TIGSXHTMBQYQTJL 11 LXKYELVTI 18 TIGSXHTMBQ 24 TMBQYQTJLJQ 2 NSCDDWQHPLXKYELVTIGSXHTMBQYQT 38 Q 1 YNSCDDWQHPL 18 TIGSXHT 32 LJQUEN 33 J 12 X 6 DWQHPLXKYELVTIGSXHTMBQYQTJLJ 31 JLJQUE 3 SCDDW 39 H...
output:
YNSCDDWQHPLXKYELVTIGSXHTMBQYQTJLJQUENQH
result:
ok single line: 'YNSCDDWQHPLXKYELVTIGSXHTMBQYQTJLJQUENQH'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
41 46 7 JOEEKMVR 37 FKBNYM 1 VOTPCSJOEEKMVRQKAKYEZJ 42 MKQQY 41 YMKQQ 13 V 1 VOTPCSJOEEKMVRQKAKYEZJVCVRAP 19 YEZJVCVRAPQTTJPXBBFKBNYMKQQ 10 EKMVRQKAKYEZJVCVRAPQTTJPXBBFKBNY 18 KYEZJVCVRAPQTTJ 30 TTJPX 44 QQY 37 FK 15 QKAKYEZJV 7 JOEEKMVRQKAKYEZJVCVRAPQTTJPXBBFK 17 AKYEZJVCVRAPQ 7 JOEEK 36 BFKBNYMKQQ...
output:
VOTPCSJOEEKMVRQKAKYEZJVCVRAPQTTJPXBBFKBNYMKQQY
result:
ok single line: 'VOTPCSJOEEKMVRQKAKYEZJVCVRAPQTTJPXBBFKBNYMKQQY'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
80 70 52 BJFEWTXAKJAPKM 68 F 33 ZOULJDJUQWS 4 WXQBSQSRNRIMVATOHRIIKCSMIIPYHZOULJDJUQWSTAFCPJSUBJFEWTXAK 4 WXQBSQSRNRIMVATOHRIIKCSMIIP 11 RNRIMVATOHRIIKC 5 XQBSQSRNRIMVATOHRIIKCSMIIPYHZOULJDJUQWSTAFCPJSUBJFEWTXAKJAPKM 69 H 70 B 4 WXQBSQSRNRIMVATOHRIOKCSMIIPYHZOULJDJUQ 7 BSQSRNRIMVATOHRIIKCSM 63 PKMAB...
output:
YRTWXQBSQSRNRIMVATOHRIIKCSMIIPYHZOULJDJUQWSTAFCPJSUBJFEWTXAKJAPKMABFHB
result:
ok single line: 'YRTWXQBSQSRNRIMVATOHRIIKCSMIIP...UQWSTAFCPJSUBJFEWTXAKJAPKMABFHB'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3876kb
input:
100 100 2 OATBKIVDGPIHYXZIBUCISNPWBMJYLGCWQYMAQKKXNSDEBOBYMWLPLSLQZWILJOI 43 HNLM 100 M 62 UMKIIKBLTHTPTARTNZ 37 YKUO 84 MRMBHTJGCJVPSP 12 GJNSXWIVMFNLKZMEKGRYKOHXZGEJOMGYSAHEMNMYOIOSLXNCOJOLUCQZDFEEZXOHWMPGNXVVMXSXPDIEVRCIWLWT 46 ULOANSBZWGPNMFDPKFXVIKCVKDETUJVTVZUKL 19 QXAOUKCAPOQWXTRDMBWXTFXFWU 5...
output:
-1
result:
ok single line: '-1'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3768kb
input:
100 100 77 LMMWYWIQTHVYGTAOUJQKX 11 TKLNADIYLZJXIVMVPEGCZUZYYGZNVSHBGMIGWQAXNCTJAO 35 XCGQHQJYYNBXUYDHQKTKFUEVVHKNFYTHFAAURAGYANGERMVHK 49 SCVD 17 MKXTQXQADCRQCUJTEDDUOPSZVARXCPPWAHIXYGZKDIJAYBAVIBUKUTBZSB 13 DJNBZVKNKGBQRFCZDGOOUHBUHV 5 DOEURZKEMTRRCPDIJHOQZXKSLZLXJIB 28 KQGCCOHHJCVINJAVVVYTSMTZNSZ...
output:
-1
result:
ok single line: '-1'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
100 100 10 RZEGNADHNKJXURYZCKJJ 69 X 89 MSBCOEIK 12 EGNADHNKJ 8 VBRZEGNADH 16 DHNKJXURYZCKJ 26 CKJJZLA 86 CS 57 QSCSWZNR 71 VK 89 MSBCOEI 80 F 89 MSBCOEIKTLKX 94 EIKTLKX 24 Y 66 XB 26 CKJJ 82 JMD 5 OFRVBRZEGNADHNKJXUR 23 RYZCKJJZLA 86 C 3 BJ 35 KMEHCRUW 98 LKX 17 HNKJXURYZCKJJZLA 95 I 52 PJGTCQSCSWZ...
output:
-1
result:
ok single line: '-1'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3792kb
input:
100 100 9 GTWEYVZSCUAYGOFZMAGCUEUHSEXJTYKVJCUCCOKISWIJRQMRJXNCFQRYVBDAOGHXATTY 79 ZZHJQVYPMRNFZXJURHJA 1 JKBNCWSUGTWEYV 66 BDAO 16 SCUAYGOFZMAGCUEUHSEXJTYKVJCUCCOKISWIJRQMR 22 OFZMAGCUEUHSEXJTYKVJCUCCOKISWIJRQMRJXNCFQRYVBDAOGHX 4 NCWSUGTWEYVZSCUAYGOFZMAGCUEUHSEXJTYKVJCUCCOKISWIJRQM 82 JQVYPMRNFZXJUR...
output:
-1
result:
ok single line: '-1'
Test #13:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
100 100 58 NCEELMSRGU 82 KPDIDPFXJVZHS 96 E 62 LMSRGU 29 USKIRHKRE 5 XLXKO 37 EQGC 38 QGC 67 UJTZJT 26 KSPU 96 EUXZW 79 BEL 71 JTT 28 PUSK 5 XLXKOWTOSPATLQBPDGAXIKSPUS 43 HRKWZDTYRXELTXCNCEELMSRGUJTZJTTKXIIRBELKPDIDPFXJVZHSUEUXZW 76 IIRBELKPDIDPFXJVZHS 58 NCEELMSRGUJTZJTTKXIIRB 31 K 46 WZDTYRXELTXCN...
output:
-2
result:
ok single line: '-2'
Test #14:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
100 100 21 BPKVFHLQKKQMBVQQMR 23 KVFHLQKKQMBVQQMR 2 OSBBTEKXKPYXSTSMPZDBPKVFHLQKKQMBVQQMRYMYPDPMXRBDOYFKIYKFDVPSJIOAROBOADVBQKQFKGOHMLPHFIAX 83 LPH 30 KQMBVQQMR 70 ADVBQKQFKGOHMLPHFIAXPGIDXJ 89 XPGIDXJ 32 M 36 QMRYMYPDPMXRBDOYFKIYKFDVPSJIOAROBOADVBQKQFKGOHMLPHFIAXPGIDXJH 34 VQQMRYMYPDPMXRBDOYFKIYKFD...
output:
QOSBBTEKXKPYXSTSMPZDBPKVFHLQKKQMBVQQMRYMYPDPMXRBDOYFKIYKFDVPSJIOAROBOADVBQKQFKGOHMLPHFIAXPGIDXJHBQVD
result:
ok single line: 'QOSBBTEKXKPYXSTSMPZDBPKVFHLQKK...ADVBQKQFKGOHMLPHFIAXPGIDXJHBQVD'
Test #15:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
100 100 93 BSKOZQUI 71 MNYBVZ 77 PVBCSXVY 57 LJNIBMRYPR 44 F 36 QLRHMCGAFDKFEQWKFYYBMLJNIBMRYPRTDEIMNY 81 SXVYLGXOIIBIBS 73 YBVZPVBCSXVYLGXOIIBIBSKOZ 17 YCLJCUJASKASLVWUWKRQLRHMCGAFDKFEQWKF 79 BCSXVYLGXOIIBI 55 BMLJNIBMRYPRTDE 99 UI 45 DKFEQWKFYYBMLJNIBMRY 26 KASLVWUWKRQLRHMCGAFDKFEQWKFYYBMLJNIBMRYP...
output:
XAXZNGYCQABFKDWNYCLJCUJASKASLVWUWKRQLRHMCGAFDKFEQWKFYYBMLJNIBMRYPRTDEIMNYBVZPVBCSXVYLGXOIIBIBSKOZQUI
result:
ok single line: 'XAXZNGYCQABFKDWNYCLJCUJASKASLV...IMNYBVZPVBCSXVYLGXOIIBIBSKOZQUI'
Test #16:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
1 2 1 K
output:
-1
result:
ok single line: '-1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
100 100 2 KMHUGDRYJDVZGDVYFJEWNGWQHCQZHVOUXPDZIKVRKIQIKSINUGICFKOOTCKFSBHDUFLWGJMXCKSYOIKKUUXLYWHDMXFAOKZC 5 UGDRYJDVZGDVYFJEWNGWQHCQZHVOUXPDZIKVRKIQIKSINUGICFKOOTCKFSBHDUFLWGJMXCKSYOIKKUUXLYWHDMXFAO 10 JDVZGDVYFJEWNGWQHCQZHVOUXPDZIKVRKIQIKSINUGICFKOOTCKFSBHDUFLWGJMXCKSYOIKKUUXLYWHDMXFAOKZCRJP 3 MHU...
output:
RKMHUGDRYJDVZGDVYFJEWNGWQHCQZHVOUXPDZIKVRKIQIKSINUGICFKOOTCKFSBHDUFLWGJMXCKSYOIKKUUXLYWHDMXFAOKZCRJP
result:
ok single line: 'RKMHUGDRYJDVZGDVYFJEWNGWQHCQZH...GJMXCKSYOIKKUUXLYWHDMXFAOKZCRJP'
Test #18:
score: 0
Accepted
time: 0ms
memory: 3796kb
input:
100 100 82 NJEL 60 USWVIVJPJFIQHGAAOWGYGFNJELP 68 J 41 TGALOONOCKPGZQEWJRAUSWVIVJP 80 G 20 IANE 63 VIV 6 BIOTHZWD 4 SCBIOTHZWDZ 84 ELPVARQLTNWXXSIWN 8 OTH 16 G 17 WH 25 L 85 LP 52 GZQEWJRAUSWVIVJPJFIQHGAAOWGYGFNJELPVARQLT 11 ZWDZWG 29 MTVYDRIVBBILTGALOONOCKPG 28 GMTVYDRIVBBILTGALOONOCKPGZQEWJRAUSWVI...
output:
-2
result:
ok single line: '-2'
Test #19:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
100 100 45 DLIOSCIXWDXVILMLDIXJNSYZRVAAPMDG 59 MLDIXJNSYZRVAAPMDG 23 YABBXCIAGXSQHPVNCJYIQDDLIOSCIXWDXVILMLDIXJNSYZRV 61 DIXJNSYZRVAAPMDGJYTDZUNNDHKGOQORGBALDQ 2 LIBLSDGFXEDAQIVJBFDZPYABBXCIAGXSQH 39 CJYIQDDLIOSCIXWDXVILMLDIXJNSYZRVAAPMDGJYTDZUNNDHKGOQO 81 ZUNNDHKGOQO 6 SDGFXEDAQIVJBFDZPYABBXCIAGXSQ...
output:
MLIBLSDGFXEDAQIVJBFDZPYABBXCIAGXSQHPVNCJYIQDDLIOSCIXWDXVILMLDIXJNSYZRVAAPMDGJYTDZUNNDHKGOQORGBALDQWC
result:
ok single line: 'MLIBLSDGFXEDAQIVJBFDZPYABBXCIA...VAAPMDGJYTDZUNNDHKGOQORGBALDQWC'
Test #20:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
100 100 97 FMRJ 24 ZTMBUUPTVMYNNAGJXWDNAQRVESJBJGTIWZNBGO 89 WCCHNTUH 86 ERKWCCHNT 47 VESJBJGTIWZNBGOPYCDAWDOWTPNYJRZFQKVSJCSERKWCCHNTU 72 PNYJRZFQKVSJCS 7 IGURIKASMDTPGEMRKZTMBUUP 88 KWCCHNTUH 64 CDAWDOWTPNYJRZF 4 JXEIGURIKASMDT 33 MYNNAGJXWDNAQRVESJBJGTIWZNBGOPYCDAW 33 MYNNAGJXWDNAQRVESJBJGTIWZNBG...
output:
MOLJXEIGURIKASMDTPGEMRKZTMBUUPTVMYNNAGJXWDNAQRVESJBJGTIWZNBGOPYCDAWDOWTPNYJRZFQKVSJCSERKWCCHNTUHFMRJ
result:
ok single line: 'MOLJXEIGURIKASMDTPGEMRKZTMBUUP...WTPNYJRZFQKVSJCSERKWCCHNTUHFMRJ'
Test #21:
score: 0
Accepted
time: 1ms
memory: 3744kb
input:
100 100 9 BUGASHEWWLJNHXUNRRBWAGKQESFWYQDXFGWBZVLDAFMYQZTNHFAMTGXTJWIRPAEQKDPSHPCTJCMLGWJJVGJSEIZ 1 FONBYBIDBUGASHEWWLJNHXUNRRBWAGKQESFWYQDXFGWBZVLDAFMYQZTNHFAMTGXTJWIRPAEQKDPSHPCTJCMLGWJJVGJSEIZCTIQ 2 ONBYBIDBUGASHEWWLJNHXUNRRBWAGKQESFWYQDXFGWBZVLDAFMYQZTNHFAMTGXTJWIRPAEQKDPSHPCTJCMLGWJJVGJSEIZ 9 B...
output:
FONBYBIDBUGASHEWWLJNHXUNRRBWAGKQESFWYQDXFGWBZVLDAFMYQZTNHFAMTGXTJWIRPAEQKDPSHPCTJCMLGWJJVGJSEIZCTIQX
result:
ok single line: 'FONBYBIDBUGASHEWWLJNHXUNRRBWAG...AEQKDPSHPCTJCMLGWJJVGJSEIZCTIQX'
Test #22:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
100 100 48 BESMUJFWFKPEQRTGYXRHCHMCXTUYV 66 RHCHMCXTUYVAKCH 4 NOTRDVLGVL 9 VLGVLITYJIXUOEAPSJMUNYJFSN 6 TRDVLGVLITYJIXUOEAPSJMUNYJFS 11 GVLITYJIXUOEA 83 CGSZQLLLYC 66 RHCHMCXTUYVAKCHIGCGSZQLLLYCDZVPG 35 D 50 SMUJFWFKPEQRTGYXRHCHMCXTUYVAKC 55 WFKPEQRTGYXRHCHMCXTUYVAKCHI 71 CXTUYVAKCH 66 RHCHMCXTUYVAK...
output:
-2
result:
ok single line: '-2'
Test #23:
score: 0
Accepted
time: 0ms
memory: 3692kb
input:
100 100 66 LQNENIYSBK 19 SIMMRKCRMBYERGPJTGGQWAPATQTHJUEITUTWGWXCYAZWSBRLQNENIYSBKJAWA 25 CRMBYERGPJTGGQWA 39 WAPATQTHJUEITUTWGWX 44 QTHJUEITUTWGWXCYAZWSBRLQNENIYSBKJAWAFYCDHKKTVCC 21 MMRKCRMBYERGPJTGGQWAPATQTHJUEITUTWGWXCYAZWSBRLQNENIYSBKJAWAFYCDHKK 40 APATQTHJUE 76 JAWAFYCDH 89 CCQ 33 PJTG 34 JTGG...
output:
QWQGVGVHMLSOISFEISSIMMRKCRMBYERGPJTGGQWAPATQTHJUEITUTWGWXCYAZWSBRLQNENIYSBKJAWAFYCDHKKTVCCQUNWKWRZNU
result:
ok single line: 'QWQGVGVHMLSOISFEISSIMMRKCRMBYE...NIYSBKJAWAFYCDHKKTVCCQUNWKWRZNU'
Test #24:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
100 100 61 CDKXCDNVAJSMCRDLCDTYCORXQMWZEFICLR 65 CDNVAJSMCRDLCDTYCORXQMWZEFICLRVCKEG 8 WQVOBKCBMUSNYYOUVXNNUGUDTTXEHA 53 SXMBGCAACDKXCDNVAJ 72 MCRDLCDTYCORXQMWZEFICL 24 VXNNUGUDTTXEHAGZPCYCBXTVNUVYOSXMBGCAA 44 BXTVNUVYOSXMBGCAACDKXCDNVAJSMCRDLCD 11 OBKCBMUSNYYOUVXNNUGUDTTXEHAGZPCYCBXTVNUVYOSXMBGCAAC...
output:
ITUUBRUWQVOBKCBMUSNYYOUVXNNUGUDTTXEHAGZPCYCBXTVNUVYOSXMBGCAACDKXCDNVAJSMCRDLCDTYCORXQMWZEFICLRVCKEGL
result:
ok single line: 'ITUUBRUWQVOBKCBMUSNYYOUVXNNUGU...JSMCRDLCDTYCORXQMWZEFICLRVCKEGL'
Test #25:
score: 0
Accepted
time: 1ms
memory: 3700kb
input:
100 100 5 EDBTIOCNNSDBEVHZMYANZEHMRAWWUGBRAZLUZXAXCKHNUDMELSQVPHGKINXSXPAIGVAKIQWLOKERXDBOUNQOOOKCSY 7 BTIOCNNSDBEVHZMYANZEHMRAWWUGBRAZLUZXAXCKHNUDMELSQVPHGKINXSXPAIGVAKIQWLOKERXDBOUNQOOOKCSY 6 DBTIOCNNSDBEVHZMYANZEHMRAWWUGBRAZLUZXAXCKHNUDMELSQVPHGKINXSXPAIGVAKIQWLOKERXDBOUNQOOOKCSY 4 YEDBTIOCNNSDBE...
output:
TLSYEDBTIOCNNSDBEVHZMYANZEHMRAWWUGBRAZLUZXAXCKHNUDMELSQVPHGKINXSXPAIGVAKIQWLOKERXDBOUNQOOOKCSYXFOZTG
result:
ok single line: 'TLSYEDBTIOCNNSDBEVHZMYANZEHMRA...VAKIQWLOKERXDBOUNQOOOKCSYXFOZTG'
Test #26:
score: 0
Accepted
time: 0ms
memory: 3744kb
input:
100 100 70 UR 55 WGTZNHDLGDNNRXUURBMBCXJMZRDHONZPDYWK 43 IWCFNDOSLOGMWGTZNHDLGDN 48 DOSLOGMWGTZNHDLGDNNRXUU 27 HIFQEFHVBQQXDHKTIWCFNDOSLOGMWGTZNHDLG 78 MZRDHONZPDYWKKAVTTOFL 66 NRXUURBMBCXJMZRDHON 73 MBCXJMZRDHONZP 39 DHKTIWCFNDOSLOGM 22 OBBIWHIFQEFHVBQQXDHKTIWCFNDOSLOGMWGTZNHDLGDNNRXUURBMBC 4 AATTJ...
output:
-1
result:
ok single line: '-1'
Test #27:
score: 0
Accepted
time: 0ms
memory: 3748kb
input:
2 1 1 A 1 B
output:
-2
result:
ok single line: '-2'
Test #28:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
100 100 13 EMKAWJJZGUDGYYVQOWLZVLNZLOTKCPHOAJSAUBRYLTQMVHBHGOKOXOIVYABLBVSJKNJXO 19 JZGUDGYYVQOWLZVLNZ 94 BR 79 JX 63 K 7 BGUZESEMKA 73 BVSJKNJXODVCINLITCXFNBRQGDQ 33 V 2 IP 86 NLITC 47 SAUBRYLTQMVHBHGOKOXOIVYABLBVSJKNJXODVCINLITCXFNBRQG 91 XFNBRQGD 41 CP 47 SAUBRYLTQMVHBHGOKOXO 5 Q 90 CXFNBRQ 79 JX...
output:
-1
result:
ok single line: '-1'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3728kb
input:
2 2 2 U 1 S
output:
SU
result:
ok single line: 'SU'
Test #30:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
5 64 38 VPWOWLQQJLHXBZHJMUVN 31 KYVBICQAJVYUDWWZMUUL 34 RDSQPDNYTNCKMGEUTLFODAIQD 40 QKYXRL 24 LXSCBZRQREFJDTIPJIOALQZYCQ
output:
-1
result:
ok single line: '-1'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
5 36 36 I 1 CRRIDUFYJRVACQVRCZZWMNZB 24 PLTABLHZDJHMD 6 RIWKXBFSOOWGNNXCXOCYH 23 IARVDQS
output:
-1
result:
ok single line: '-1'
Test #32:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
88 43 16 THZLGTOKPXOQFXYRLLWZSDH 11 DROHSTHZLGTOKPX 15 STHZLGTOKPXOQFXYRLLWZSDHT 13 OHST 14 HSTHZLGTOKPXOQFXYRLLWZSDHT 35 ZSDHTVKK 37 DHTV 15 STHZLGTOKPXOQFXYRL 5 OAEVJADR 41 KKR 14 HSTHZLGTOKPXOQFX 5 OAEVJADROHSTHZLGTOKPXOQFXYRL 32 L 41 K 12 ROH 7 EVJADROHSTHZLGT 30 YRLLWZSDHTV 38 H 11 DROHSTHZLGTO...
output:
GEKPOAEVJADROHSTHZLGTOKPXOQFXYRLLWZSDHTVKKR
result:
ok single line: 'GEKPOAEVJADROHSTHZLGTOKPXOQFXYRLLWZSDHTVKKR'
Test #33:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
50 83 27 HJRXBEHCXPTWCUCXVZRIXX 31 BEHCXPTWCUCXVZRIXXBVWCJWGQDSZSHPLYHPM 45 RIXXBVWCJWGQDSZSHPLYHPMIROQQSRBSRWOARXI 45 RIXXBVWCJWGQDSZSHPLYHPMIROQ 33 HCXPTWCUCXVZRIXXBVWC 6 JFVBAW 73 SRBSRWOA 7 FVBAWGQVLUMGABOGAENXHJRXBEHC 43 VZRIXXBVWC 21 OGAENXHJRXBEHCXPTWCUCXVZRIXXBVWCJWGQDSZSHPLYHPMIROQ 50 VWCJW...
output:
BMZFNJFVBAWGQVLUMGABOGAENXHJRXBEHCXPTWCUCXVZRIXXBVWCJWGQDSZSHPLYHPMIROQQSRBSRWOARXI
result:
ok single line: 'BMZFNJFVBAWGQVLUMGABOGAENXHJRX...JWGQDSZSHPLYHPMIROQQSRBSRWOARXI'
Test #34:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
85 93 30 QBATLSTWJAOKWGNILSMYUPGPSWYK 69 PTBGJOBUKT 75 BU 39 AOKWGNILSMYUPGPSWYKYMKTFCB 19 JMAGDCEMFQVQBATLSTWJAOKWGNILSMYUPGPSWYKYMKTFCBRYNPPTBGJO 45 ILSMYUPGPSWYKYMKTFCBRYNPPTBGJO 25 EMFQVQBATLSTWJAOKWGNI 57 KYMKTFCBR 35 STWJAOKWGNILSMYUPGPSWYKYMKTFCBRYNPPTBGJOBUKTDKT 87 QK 34 LSTWJAOKWGNILSMYUPGP...
output:
ITLPSRIQHQUEWEOSVSJMAGDCEMFQVQBATLSTWJAOKWGNILSMYUPGPSWYKYMKTFCBRYNPPTBGJOBUKTDKTWWKLCQKVLCOE
result:
ok single line: 'ITLPSRIQHQUEWEOSVSJMAGDCEMFQVQ...CBRYNPPTBGJOBUKTDKTWWKLCQKVLCOE'