QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644745 | #6684. Trie | Lautisticyc | AC ✓ | 82ms | 29164kb | C++14 | 3.0kb | 2024-10-16 15:21:35 | 2024-10-16 15:21:36 |
Judging History
answer
/*
先找最近的,全部边变成a,如果有多个,我现在先不管。
然后接下来最小的肯定是它子树里的,分割成子问题。
其他的按深度来。其实按不按深度无所谓。总之分割成子问题,只是根少一个儿子a。
那么最后排起来就是各子问题排好之后按照深度排起来
来考虑怎么选。
选了一个之后,接下来要找子树里的下一个,先找子树里距离最近的。如果还有同样的,就递归下去,
然后要走尽量多。
如果同时走到叶子的话。
就得回上面……
算了从底下来。
给每个子树排名吗?
0上面再加个关键点吧。
我们从叶子开始,然后关键点链最长长度递增来插入。
加入时,先找到下面的所有子树及距离。
前面要加的字符个数不一样好像不方便比。
那就所有点都拉进来排序吧。
也就是直接来了。
子树内部都分配好了。
直接来就好。
这个就直接按照子树的排名来分配就好。
但是怎么给子树排名捏。
比子树的子树捏。
那么我们按照深度维护排名就好了!
还是字典序大佬。
*/
#include<bits/stdc++.h>
using namespace std;
int cas,n,m,f,k,ky[200010],dep[200010],rk[200010],mxdp;
char ans[200010];
vector<int> e[200010],dp[200010];
void dfs(int x)
{
mxdp=max(mxdp,dep[x]);
dp[dep[x]].push_back(x);
for(int i=0;i<(int)e[x].size();++i)
{
int y=e[x][i];
dep[y]=dep[x]+1;
dfs(y);
}
}
bool cmp(int one,int ano)
{
if(ky[one]!=ky[ano]) return ky[one]>ky[ano];
for(int i=0;i<26;++i)
{
if(i>=(int)e[one].size()||i>=(int)e[ano].size()) break;
if(rk[e[one][i]]!=rk[e[ano][i]]) return rk[e[one][i]]<rk[e[ano][i]];
}
return e[one].size()>e[ano].size();
}
bool pmc(int one,int ano)
{
if(rk[one]!=rk[ano]) return rk[one]<rk[ano];
else return one<ano;
}
bool eq(int one,int ano)
{
if(ky[one]!=ky[ano]) return 0;
for(int i=0;i<26;++i)
{
if(i>=(int)e[one].size()||i>=(int)e[ano].size()) break;
if(rk[e[one][i]]!=rk[e[ano][i]]) return 0;
}
return e[one].size()==e[ano].size();
}
void dfs2(int x)
{
for(int i=0;i<(int)e[x].size();++i)
{
int y=e[x][i];
ans[y]='a'+i;
dfs2(y);
}
}
int main()
{
scanf("%d",&cas);
while(cas--)
{
scanf("%d %d",&n,&m);
for(int i=0;i<=n;++i)
{
dp[i].clear();
e[i].clear();
}
ky[0]=0;
for(int i=1;i<=n;++i)
{
scanf("%d",&f);
e[f].push_back(i);
ky[i]=0;
}
for(int i=1;i<=m;++i)
{
scanf("%d",&k);
ky[k]=1;
}
mxdp=0;
dfs(0);
for(int i=mxdp-1;i>=0;--i)
{
sort(dp[i+1].begin(),dp[i+1].end(),cmp);
rk[dp[i+1][0]]=0;
for(int j=1;j<(int)dp[i+1].size();++j)
{
if(!eq(dp[i+1][j-1],dp[i+1][j])) rk[dp[i+1][j]]=rk[dp[i+1][j-1]]+1;
else rk[dp[i+1][j]]=rk[dp[i+1][j-1]];
}
for(int j=0;j<(int)dp[i].size();++j)
{
int x=dp[i][j];
sort(e[x].begin(),e[x].end(),pmc);
}
}
dfs2(0);
ans[n+1]='\0';
printf("%s\n",ans+1);
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 15648kb
input:
2 5 4 0 1 1 2 2 1 4 3 5 1 1 0 1
output:
abaab a
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 14632kb
input:
400 3 3 0 1 2 1 2 3 2 2 0 1 2 1 5 3 0 0 0 3 1 4 2 5 4 4 0 1 0 3 3 4 1 2 1 1 0 1 2 1 0 1 2 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 1 8 4 0 0 2 3 2 5 1 5 7 6 8 4 5 3 0 1 2 1 3 5 4 1 1 1 0 1 2 2 0 1 2 1 2 1 0 1 2 1 1 0 1 3 3 0 1 2 3 2 1 3 3 0 1 1 2 3 1 2 1 0 1 2 1 1 0 1 2 2 0 1 2 1 1 1 0 1 2 1 0 1 2 1 1 ...
output:
aaa aa bacaa aaba a aa a a a a a abbaaaab abaaa a aa aa a aaa aab aa a aa a aa a abca ab aa aa a ab a aa a aaab a a abaaacba aaaa a a ab baaab aa a aa baaab aa ab a a abc a a abbaaaa aaa baaa a aa aaaa aa aaaab bcaab aaa aabaaaa aaa baaaaa baaaa aa a aab aa a abaa a baa aab aa baaa aba a abaa aa a a...
result:
ok 400 lines
Test #3:
score: 0
Accepted
time: 30ms
memory: 14364kb
input:
50000 3 2 0 0 1 3 2 4 4 0 1 1 2 3 4 2 1 7 5 0 1 2 2 3 4 2 7 6 4 1 5 4 4 0 1 1 1 3 4 2 1 4 4 0 1 2 3 4 3 1 2 2 1 0 1 2 2 2 0 0 2 1 3 3 0 0 1 2 3 1 3 3 0 1 2 3 1 2 4 3 0 1 0 3 2 1 4 5 2 0 0 2 3 4 1 5 1 1 0 1 18 11 0 0 1 3 4 3 3 3 7 9 5 11 11 10 2 11 11 15 9 12 13 10 6 17 14 8 16 15 18 1 1 0 1 18 14 0 ...
output:
baa aaba aacaaab aabc aaaa aa ab aba aaa aaba abaaa a baadaacbaaaabaacda a bacabaaacaabaaabaa aaab aaa aabaaa aa baaaa aab a aaaabbaaaaa aaabb baaa aab a abababaaa a aba aab aababaaa caabaabcabaa a aaa aaaba a ab aa aaacbbbaabaabaaaaaabaaa a aa aaaa ab a ab baa baa a aaabac aa aa baaab abaaa aa abac...
result:
ok 50000 lines
Test #4:
score: 0
Accepted
time: 35ms
memory: 14220kb
input:
50000 1 1 0 1 11 8 0 0 0 0 1 3 2 3 0 7 2 5 8 9 6 11 10 4 2 4 4 0 0 0 1 3 4 2 1 6 4 0 0 2 0 3 0 5 4 1 6 6 5 0 0 1 1 0 0 2 4 3 6 5 2 2 0 0 1 2 6 6 0 0 0 1 1 0 3 4 6 2 1 5 1 1 0 1 1 1 0 1 3 3 0 0 0 1 3 2 8 8 0 1 1 2 1 0 3 2 3 5 1 8 7 4 6 2 1 1 0 1 2 2 0 1 2 1 2 2 0 1 1 2 1 1 0 1 4 4 0 0 0 0 1 4 3 2 2 2...
output:
a eadbaabbcaa abca adabac daabbc ab abcabd a a abc aabacbab a aa aa a abcd ab aba ab ab ab baacd a abcabd abc a a ab aba abc a abc a aabbcda ab a abcda ab aa afbabcade a a ab cdaaba dababca aa ab a a abac ab ab abac abc aa ab baab abaa abc baaa bcdaedafbaaaaca aedaaaabcb a abaaa ab baabca a a abc ba...
result:
ok 50000 lines
Test #5:
score: 0
Accepted
time: 28ms
memory: 15528kb
input:
50000 3 3 0 1 2 1 3 2 2 2 0 1 2 1 1 1 0 1 12 2 0 1 2 3 4 5 6 7 8 8 10 11 12 9 3 2 0 1 2 3 1 4 2 0 1 2 3 4 3 5 5 0 1 2 3 4 4 2 3 1 5 2 1 0 1 2 6 4 0 1 2 3 4 5 4 3 2 6 7 5 0 1 2 3 4 4 6 7 3 2 4 5 2 1 0 1 2 4 2 0 1 2 3 3 4 6 4 0 1 2 2 4 5 1 3 6 2 2 2 0 1 1 2 4 1 0 1 2 3 4 1 1 0 1 1 1 0 1 1 1 0 1 1 1 0 ...
output:
aaa aa a aaaaaaaaabaa aaa aaaa aaaaa aa aaaaaa aaaaaba aa aaaa aaabaa aa aaaa a a a a a aaaa aaaa aaaa aaaaaaba aaaaaaabaaa aaaaaabaaabab aaaaaaaaa aaaaaaaaa aa aaaaaa aaaaaaabba a a a aaaaaa aaaaaa aa aa aaa aaabaaab aaaaaaaaa aa aaaaa a aaa a aaaa aa aa a aa aa a a aaa a a aaaaaaabaabaaab a a aaaa...
result:
ok 50000 lines
Test #6:
score: 0
Accepted
time: 3ms
memory: 14728kb
input:
3 288 171 0 1 0 1 3 2 3 6 4 8 4 11 8 5 12 9 11 14 9 11 17 17 13 11 5 25 25 23 28 16 6 19 29 11 27 8 32 33 15 17 34 2 33 19 34 24 29 18 38 35 43 43 34 45 26 23 20 57 44 51 45 22 51 63 52 61 27 41 57 44 70 71 54 10 56 72 46 44 72 12 56 76 66 45 19 74 46 68 74 44 57 62 47 76 50 89 21 45 23 96 70 80 63 ...
output:
baabaabbabbdcbbbabaecaacabacbaaccbbaacabcbbabababbbadaabaaccbabbaaabcaacabbbbdaacaadbcaabebaabbaacaabaaaacaaaaaaaaaaacadbaaabbaaaaabbcaaaabaaaabbbbaabbaaaabbababaabbaaabaaaababaaaaabaabaaaaacbaabaaaaabaaabaaaabbabbabacbabaabcaacaaaaabdbbaaaaaabaacaaaabaaaabaababbaaaacaaaaababaaabaaaaabaa adbbacbabab...
result:
ok 3 lines
Test #7:
score: 0
Accepted
time: 82ms
memory: 19364kb
input:
4 3728 3156 0 0 2 2 4 2 5 4 8 4 5 8 9 10 12 6 13 14 18 17 17 20 12 15 21 23 12 24 2 22 21 11 28 28 34 1 12 33 13 38 24 39 8 14 40 45 17 42 30 44 46 39 19 30 49 11 51 57 21 26 32 55 48 41 9 61 52 37 39 53 55 8 22 42 55 73 67 24 60 53 68 58 78 40 46 40 41 62 66 69 70 69 92 45 62 87 84 81 35 89 100 32 ...
output:
baadbbbabcaabbbaaaaacacbbadacaaabaaaabbabbcbcabbcacaaaabaacabbbbacaacaadbccabcabaaabaaaaacadadcbbabaaababaabbbbacbbaaaaababbcadbbbaaabaaacbcabbcaabadcabaabdaaaccaabeababbaaeaaaaaabaccacaababababadaadabaaaaaaadabdcacacaaaabbaeababaabaaaababbbcaaabbacbaebabcbaccadbaaabaababaaabedcaaacaaabbebcccbbbabaa...
result:
ok 4 lines
Test #8:
score: 0
Accepted
time: 52ms
memory: 16420kb
input:
5 25004 22919 0 0 2 0 1 2 4 0 1 2 7 0 5 1 7 7 3 6 11 6 12 1 6 1 7 2 16 6 4 25 21 10 7 8 5 25 10 5 8 14 4 19 6 31 1 6 8 12 14 21 31 21 14 38 4 27 2 23 46 12 26 31 51 4 21 0 30 3 53 26 12 9 65 1 9 18 22 23 28 2 12 5 40 50 21 34 5 41 56 33 7 8 68 48 9 11 54 29 43 28 15 73 35 55 76 37 24 92 44 22 74 52 ...
output:
cbbjqqqddcaalaclaalgaccbbakdbaabdbalakcjdatbebackcapanaadaabaoacbkifbbdaarcaabbfocbffbbeaamojadaafadaabaaamaabihcclcfddfjbeagfafaaoejbfcdkacbbdcdpidbaaeaadceaabnbafcadchebcngbjefabeaablbnbmachabaaaeafcaaadfbnmbjcabmdbcblbabdeaaaaaaabfbfcbacbaaaacadhldaddhjadbgqraccabbfcbbcefcbbbblaclgcagabaacnbbeqic...
result:
ok 5 lines
Test #9:
score: 0
Accepted
time: 56ms
memory: 18348kb
input:
6 26746 14833 0 1 2 3 4 5 6 7 8 9 9 11 12 11 14 14 16 15 14 18 20 19 20 21 24 25 26 25 28 28 30 31 32 32 34 33 36 37 35 38 36 39 36 41 43 45 45 43 38 42 49 50 47 51 54 53 54 56 48 59 51 51 55 57 56 59 58 65 56 61 56 60 72 69 65 69 76 64 54 77 78 77 80 80 84 85 85 86 85 87 82 87 81 92 94 87 89 76 90 ...
output:
aaaaaaaaaabbaaabaacabaaaabaaabaabaaaaaaacabaababbaaaabbacdabcaaacaaaaabaaabbaaabaadbaabacdaaaaababacaaaaaaacabdbababbaabaaaabbabbaababbaccababaaaabcbcbaaababbbcaaaaaaabbaaaaaacbbaabaaaaacaabaaaaabababaabaaaaababaaacacacaaaabaaaaaaaacadabbbbaabaaacbaababaaaacaaabaaabbbaabaaababababbabdaaaaabbdcbbaaab...
result:
ok 6 lines
Test #10:
score: 0
Accepted
time: 46ms
memory: 15368kb
input:
5 71039 60992 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 1 0 0 2 0 1 6 1 0 0 1 3 5 1 1 0 0 0 0 2 2 0 4 7 1 2 37 10 33 3 1 1 2 2 10 1 7 3 1 2 50 5 16 8 9 10 8 3 17 17 10 1 9 8 8 18 5 19 15 13 16 1 2 10 2 7 6 6 73 87 5 76 69 80 1 2 3 2 3 5 2 1 16 7 100 1 9 4 17 22 11 5 8 45 1 12 16 23 7 17 4 6 110 2 2 5 ...
output:
mnoaqepfkigszjijchruecbhvnmmxywbkqlktldbdwandaadaqoafmaymavojgabmeldlnoxpiaablplkbcmqaablamhklfrnttanrlbasnhalaokatmckrkpcjzgcjmpsxihkndproroammopaogfogfayaabaapglpazoboforkhbadledncnvqfisoppojaaaibuurnbufmkllipajcsqfrhgqpbmqlopqcmcoeatbsaflbpncqnpqoejnbnalcisngcalcrjneeckphbnwpjgtoodassusqsfaaniorv...
result:
ok 5 lines
Test #11:
score: 0
Accepted
time: 73ms
memory: 20208kb
input:
1 200000 155141 0 1 2 3 3 5 6 6 8 9 9 10 11 12 14 15 16 17 18 19 16 20 22 20 24 25 25 25 27 28 29 31 31 33 23 33 34 36 37 32 38 40 39 35 42 45 38 38 45 46 50 36 48 52 53 48 55 49 55 58 54 52 59 57 50 65 51 64 66 61 67 71 65 66 68 72 66 76 74 77 68 65 81 76 84 83 75 81 77 80 90 85 88 92 94 76 93 96 6...
output:
aaabaabaaabaaaaabaaaabaaacabaaababaaaaaaaaaaaabcbabbababbaaaaaaaaaaabaaababacbaaacbcaaaabaaaaaaaaaaababaabbabaaaacabbaabaaaacabaaaaabaaacaabbabababbaabaaabaaaabaaaacabaaaaaaaaabbbbabbabaaabaaaabbaaebababdacbbbbacbacaabcaaaabdbcbcaaababbcaaaababaccaaaabbcaaaaabaaaaaaaaaaaaabaaaaaaaabaabbbbcaaaaaabbaa...
result:
ok single line: 'aaabaabaaabaaaaabaaaabaaacabaa...cbdaadebaadaaaaaacbabaababaabac'
Test #12:
score: 0
Accepted
time: 58ms
memory: 18396kb
input:
1 200000 164056 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 1 0 3 0 0 0 1 0 0 1 1 1 2 1 0 0 0 1 0 9 5 1 1 0 6 1 8 4 16 2 0 3 4 2 11 1 4 3 6 2 2 2 0 4 5 5 7 17 4 4 15 4 6 0 2 55 7 55 9 8 66 3 55 1 1 6 7 5 6 69 4 76 1 21 85 2 4 1 7 73 1 2 12 8 19 4 2 5 11 12 2 10 102 1 10 29 5 10 1 19 4 12 16 9 1 28 58 105 34 10 14...
output:
hagiokfshxgcnjrfylwcpebvtaidddlulqheuqtcoenaemkpagrdmaijleodfakjbeklzqcqfcceaakjbgikjiebhgkvsbdyromdemghickepfjjjnfljfjwgjfcgaaxhogiuocnhevhaffljgfhgnahchfleeaiarhfvbqkifaaoamokdsgkhzmeqgengjldegjmkgogjfiazvjhjpbbsiiimtmibmafmatsmcgahaxpgfikdaibimqisfmghihgjqprhuienaednmgkimuyagboxthknsphnxejanctwna...
result:
ok single line: 'hagiokfshxgcnjrfylwcpebvtaiddd...dcbdcahaiqipagkfahhabfhcafbdbif'
Test #13:
score: 0
Accepted
time: 82ms
memory: 19996kb
input:
1 200000 176126 0 0 2 1 3 5 5 7 5 8 4 10 7 11 8 7 13 10 12 14 18 18 14 17 14 8 19 19 10 25 16 25 29 16 28 10 31 14 21 22 37 39 28 38 16 23 18 43 15 46 38 36 51 16 40 50 28 38 45 36 48 51 33 54 40 30 50 54 53 25 65 62 65 12 46 44 68 34 53 56 48 79 56 61 42 64 53 74 75 79 84 46 40 54 87 55 49 82 54 52...
output:
abababaccaaababaadadbceaccbacbbcaddbbfbaaaaacaaaaacaaabacbababacaabdcdabcbbaaabcbbbcaaacaccccaacabbabababadababbcccabaadcbbaaaadbbaaaacdbbaecaacaabeccbdaaaaacdbaecdaceaabbdcabbdbccfbaaadabbaaabebfbaabdabbbcacacbbabbbaebbaebabbaaabcaaeabaaadaccaaaabaabaaaecbaaaeabaadbabcbaaaaaabbbdbcaeaabccbbbdacaaba...
result:
ok single line: 'abababaccaaababaadadbceaccbacb...aabbcaaaaacgababadababacaaaaabb'
Test #14:
score: 0
Accepted
time: 73ms
memory: 19212kb
input:
1 200000 196662 0 0 0 0 3 1 2 2 3 3 0 1 2 0 12 7 0 11 4 10 17 7 10 1 7 15 6 19 2 0 7 17 8 11 18 10 17 14 2 4 5 6 12 38 15 23 3 0 13 17 4 7 20 6 47 18 25 7 14 35 19 14 10 19 11 15 6 19 31 57 5 9 39 41 43 16 14 15 6 50 32 21 46 1 33 36 18 56 14 8 4 12 4 28 38 67 51 59 16 29 16 20 32 2 15 48 29 59 88 4...
output:
cbafbbabcadadeavgoabccadbafacuabbaecdceddbbddadhcachaebaanabcedfceadaabccbbcbccaaaacbcbadafdbaepbabaafbflcbbabeabefaefccaiacdbaefdcgvacbabaahbbacbbibbaecacbdaaajbddbcadbebacgaabbcaebfmbabgnagbaacababaldbeaecaacaaadbabaaabfaaacbaabcddbadpfafabcbcaedbcdiededacafdedobdabdbarbbbbaafbcagabbgbeebdbbahcaaa...
result:
ok single line: 'cbafbbabcadadeavgoabccadbafacu...dabaacbcaabbccbahaiabbgeabdabaa'
Test #15:
score: 0
Accepted
time: 67ms
memory: 20360kb
input:
1 200000 147291 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 22 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 43 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 61 64 64 66 67 67 69 69 70 72 73 74 74 76 76 78 79 80 81 81 82 81 85 86 87 88 88 90 91 91 93 93 95 94 97 ...
output:
aaaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaaaaaaaabaaaaaaaaaaaaaaabaaabababaaaaabbaaaaacabaaaabaabbaaaaaaabcaabaabaaaaaaabaabbaaaabaaabaabaabaabacabaaaaabaaabaaaabaaacabbaaaaabbabaaaaabaaaacbaabaaabaabaababaaaabbaabaaaabbaaaaaabaaaabaacaaabaaabacaaabaaaaaaaaabcabaabaabaabcaababaaaaabbbaaaaaabbacaabcbbdaa...
result:
ok single line: 'aaaaaaaaaaaaaaaaaaaaaaabaaaaaa...aaaaaaaabaabaadbaabbbabaaaaaaaa'
Test #16:
score: 0
Accepted
time: 66ms
memory: 19724kb
input:
1 200000 136669 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 17 15 28 27 20 9 25 12 21 22 31 28 27 20 29 1 28 29 1 46 41 44 42 46 27 49 42 1 49 40 41 1 52 55 57 52 59 42 46 43 42 1 52 61 67 49 58 68 55 58 53 71 72 1 75 1 1 2 65 82 62 71 2 75 2 81 75 76 84 88 92 75 1 1 83 97 1 84 92 1 94 107...
output:
kpqmafwuoygcihnelrsbtvbdjzxjrmmaalleljjlgepkholakioammjlakugnjjhlbjagibakksbabmkkpmdodimkinbnbpbknoniarfaacqnlexannpapqqanqrmqnqaqaablkpvabhrawaaqapeuaaumssbzvadsufysjpurtjastvhoydsaataraubsqtsaqaovfbtbnhnrropozmcaxfqsevrwoutvtpsbbwzianavatredbclayaetzopdraabsbtpqgvcsysraunbtsrssrttsblrptoxrkavraxta...
result:
ok single line: 'kpqmafwuoygcihnelrsbtvbdjzxjrm...paabaaaababjaabaanaablbsgaaqaaa'
Test #17:
score: 0
Accepted
time: 43ms
memory: 23816kb
input:
1 200000 75359 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
result:
ok single line: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...baaacabbbaaaaaaabaaaaaaaaaaaaba'
Test #18:
score: 0
Accepted
time: 64ms
memory: 20572kb
input:
1 200000 182195 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 13 10 7 5 17 22 10 26 19 19 24 22 32 17 31 40 17 31 36 45 25 47 28 27 36 49 50 43 31 52 33 56 48 38 46 54 45 53 62 42 61 59 57 45 60 46 68 73 74 65 74 75 63 76 69 72 61 77 82 63 63 67 66 77 69 70 76 90 89 72 81 73 73 98 81 79 81 92 ...
output:
xgqintjmsfuhkzwvcadyrbpleobabebacayabbbcbaacacaaaxxabaaabaaaaaaaaavawbabaaabvcxcbcwcbcabcadcbaabacbaxdwbbfcaaeacbfacadabbadbdbeaaaaicbcabfcaaabacbaaaebbdabcbaaaaaaabbebabcdbaabcbbacabbacabbaaaaaaabaaabaaabaaaaaabaaabbaaabaabbbacaaaaabaaaaaccababababdbabbaaaacaaabbaaabababaaabaaaabaaaababbaaabcaaaaaa...
result:
ok single line: 'xgqintjmsfuhkzwvcadyrbpleobabe...aabaacaaabbbaaabcbabcbaaabdaccb'
Test #19:
score: 0
Accepted
time: 52ms
memory: 29100kb
input:
1 200000 93047 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
caaabbaabbbaaaaaaacabbbbabaaaaacaabaaabbababaacabaaaaaacacabbaaabbbaabaaabbabbababbcbaaaacbacaaaaabaabacabaaaaaaaaabaaaaaabaabbaabaacacabaaaaabaaaaaaabbabaacaacabbaabbbbbabbacbaaabbabbaaaaacabbaaacaaabaaaaabaaababaaaaaaaaabaaaaacabbcabababaabbabcabaabaaaaabbaacaaababadbbbabbabbaaaaaabaaaaababaaaabab...
result:
ok single line: 'caaabbaabbbaaaaaaacabbbbabaaaa...acaaaabaaababbaacbaaaabaaaaaaab'
Test #20:
score: 0
Accepted
time: 28ms
memory: 21864kb
input:
1 100000 42640 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 9...
output:
acaabdababaabcbaaabaababcbbaaaababababbbaaabbacabaabaaacbebabbacaababaaabbacabaababaaababaaabbaabcaaaaaacaaaaabacaaabababaababbbbacaaaabbaabaabbbbbbaababadaaabcbcaabbaaabcaaaabaaaaacabbaaaaccbaabbbbbaaabaabaaaabbcbabbaaaaababbcaabbabaacadaaaaaaacaabaaaccbbbbabacaabbabaaacabaabababbbababcabbcbaaaabab...
result:
ok single line: 'acaabdababaabcbaaabaababcbbaaa...aaaadacaacabaacaaabbaacbaabaabb'
Test #21:
score: 0
Accepted
time: 58ms
memory: 29164kb
input:
1 199999 105866 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...
output:
aaadaaaabababaabaaaaccbababcababbabbbaaaabbaabbabceaaaacacbaabaabebabaaaabbabaacbaadaaaaadbabaaaabaaabaabbabbbbabaaabaacabaaaaababaabbaaabaabcaacbaabaaaadbcaaacabaaaababaaacababaaababaacaacaabaacbaaabababaaabaaacaaaadbaabaacacbaaababaacaaaaaaaaaaabcaababbbaabaaaaabaaaabadaabaaaaaaaaaaaaacccbabcbcaac...
result:
ok single line: 'aaadaaaabababaabaaaaccbababcab...aabbbbaacbaaaaaaabaacaaaaabaabb'
Test #22:
score: 0
Accepted
time: 56ms
memory: 29084kb
input:
1 199992 158872 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 ...
output:
aaaaaaababacaaaadaaaabaaaabaaaaaabbaaaaaaaaaaaaaaabaaadaaaadaaaaaaaaaaabaaaaaaaaaaaaaabaaaabaaaaabbaaaabbaaaaabaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaababcabaabaaabaaaaaaaacaabaaabaaaaaaaaadaaaaaabaaaaaacaabacaacabaacaaababaaaabaaaaaaabaaaaacacaaaaaaaaaaacaaabababbaaaaabaaaaabaabaaaaaaaaaaaaaaaaaaaaa...
result:
ok single line: 'aaaaaaababacaaaadaaaabaaaabaaa...aadacdbaabbbabaabaacaaaabadbacb'
Test #23:
score: 0
Accepted
time: 31ms
memory: 19244kb
input:
1 200000 107064 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 ...
output:
aabbababaabbaababbaabababbabaabbabababababababaabbabaabbaababababababbababaabbaababababababbababababaabbaabababbaabbaabbababaabababbaabbabababaabbabaabbababaabbabaabbaabbabaababbabaabbabaabbaabbabaabbaabbaabababbabaabbaabababababbaabbaabbabababaababababbabaababababbaabababababbaabababbaabbabaabbaaba...
result:
ok single line: 'aabbababaabbaababbaabababbabaa...abababababababababababababababa'
Test #24:
score: 0
Accepted
time: 40ms
memory: 18288kb
input:
1 200000 142365 0 0 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12 13 13 13 14 14 14 15 15 15 16 16 16 17 17 17 18 18 18 19 19 19 20 20 20 21 21 21 22 22 22 23 23 23 24 24 24 25 25 25 26 26 26 27 27 27 28 28 28 29 29 29 30 30 30 31 31 31 32 32 32 33 33 33 34 34 34 3...
output:
bacabcabbcacabcabcabacbbacabcbacacbacbbcacbacabcbabacbcacabbaccbaabccbaabcacbabcabccbaabccbacabacbbacbcaabcbacacbacbbacabcbcabacbacabccabacbcabcbaacbcabacbabcbaccbacbabcabacbcacbacbacabcabacbacbbaccbacabbcaacbabccabbaccbabacbcabcacabacbcbaabcbcacababcacbacbcabcbacbaabcbcacabbcacbaabcabcbcaacbbacbcab...
result:
ok single line: 'bacabcabbcacabcabcabacbbacabcb...cabcabcabcabcabcabcabcabcabcabc'
Test #25:
score: 0
Accepted
time: 42ms
memory: 18080kb
input:
1 200000 181860 0 0 0 0 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 8 8 8 8 8 9 9 9 9 9 10 10 10 10 10 11 11 11 11 11 12 12 12 12 12 13 13 13 13 13 14 14 14 14 14 15 15 15 15 15 16 16 16 16 16 17 17 17 17 17 18 18 18 18 18 19 19 19 19 19 20 20 20 20 20 21 21 21 21 21 22 22 ...
output:
bdacadbceacbdeabdecebcdadcebacaedbadcbebaedcdcbaedceabacedbedcabbdeacbadeccebadaebcdedacbadbceabdecdcbaedecabadcebedabceadcbcedabbadecaecdbacdebdebaccdbeabacedbacdebcdaecdeababcdedcabebdeacbaceddabecdacbecedbacbdaeedcabebadcbadecdbecaeacbdadebcecabdbecadbcdeaacbededcabeacdbabdecdacebdcbeadbceabcadee...
result:
ok single line: 'bdacadbceacbdeabdecebcdadcebac...abcdeabcdeabcdeabcdeabcdeabcdea'
Test #26:
score: 0
Accepted
time: 39ms
memory: 17004kb
input:
1 200000 199316 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
evabgfxdhcwirjsntuokyplmqcudhevqijfkgrlwmnostaxpbzyajbkolcdepvfxtqwrszghiumynuemzfnvgaohpqxrwibycdstjkltaydwzijuefkoplmbnqgrchsxvmszabgnhticxwjduvkyeflopqrbmnoacgduthipvwjkyelxqzfrsndexfowakbpczsghqyturijlmvicjkdlerxmabnsfvytghopuwzqflmawngopvqrhbziscjdextukyldgmzastnopuqveyhwijxbckfrbfiagjcdehklmno...
result:
ok single line: 'evabgfxdhcwirjsntuokyplmqcudhe...efghijklmnopqrstuvwxyzabcdefghi'