QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#141558 | #6684. Trie | OvO_Zuo | AC ✓ | 100ms | 25888kb | C++14 | 2.7kb | 2023-08-17 16:30:10 | 2023-08-17 16:30:14 |
Judging History
answer
#include <bits/stdc++.h>
#define mp make_pair
using namespace std;
const int N=2e5+5;
int n,m,fa[N],dep[N];
vector<int> edg[N],pos[N];
bool tag[N];
void dfs(int idx)
{
pos[dep[idx]].push_back(idx);
for(int to:edg[idx])
{
dep[to]=dep[idx]+1;
dfs(to);
}
}
struct node{
int id;
vector<pair<int,int>> num;
bool operator<(node a)
{
int i;
for(i=0;i<min(a.num.size(),num.size());i++)
if(a.num[i].first!=num[i].first) return num[i].first<a.num[i].first;
return num.size()>a.num.size();
}
bool operator==(node a)
{
if(num.size()!=a.num.size()) return false;
for(int i=0;i<num.size();i++)
if(num[i].first!=a.num[i].first) return false;
return true;
}
};
vector<node> help[2];
int rk[N];
int kk=0;
void sol(int x)
{
int i,j;
help[0].clear(),help[1].clear();
node tmp;
for(int t:pos[x])
{
// cout<<"dep:"<<x<<" "<<t-1<<endl;
tmp.id=t;
tmp.num.clear();
for(int to:edg[t])
tmp.num.push_back(mp(rk[to],to));
sort(tmp.num.begin(),tmp.num.end());
help[tag[t]].push_back(tmp);
}
sort(help[0].begin(),help[0].end());
sort(help[1].begin(),help[1].end());
//for(node t:help[0]) cout<<"node:"<<t.id-1<<" "<<t.num.size()<<endl;
kk=0;
if(help[1].size()) rk[help[1][0].id]=++kk;
for(i=1;i<help[1].size();i++)
rk[help[1][i].id]=(help[1][i]==help[1][i-1]?kk:++kk);
if(help[0].size()) rk[help[0][0].id]=++kk;
for(i=1;i<help[0].size();i++)
rk[help[0][i].id]=(help[0][i]==help[0][i-1]?kk:++kk);
//for(int t:pos[x]) cout<<"rk:"<<t-1<<" "<<rk[t]<<endl;
}
bool cmp(int x,int y){ return rk[x]!=rk[y]?(rk[x]<rk[y]):(x<y);}
char ans[N];
int cc=0,tt;
void sol()
{
scanf("%d%d",&n,&m);
int i,j;
++n;
for(i=1;i<=n;i++) pos[i].clear(),edg[i].clear(),tag[i]=0,rk[i]=0;
kk=0;
for(i=2;i<=n;i++)
{
scanf("%d",&j);
++j;
edg[j].push_back(i);
}
for(i=1;i<=m;i++)
{
scanf("%d",&j);
++j;
tag[j]=1;
}
dep[1]=1;
dfs(1);
for(i=n;i>=1;--i)
sol(i);
for(i=1;i<=n;i++)
{
sort(edg[i].begin(),edg[i].end(),cmp);
for(j=0;j<edg[i].size();j++)
ans[edg[i][j]]='a'+j;
}
//for(i=1;i<=n;i++) cout<<rk[i]<<" ";
for(i=2;i<=n;i++) printf("%c",ans[i]);
puts("");
}
int main()
{
int t;
scanf("%d",&t);
tt=t;
while(t)
{
--t;
sol();
}
return 0;
}
/*
长度更短的字符串字典序更小更优
初始将每个点的值设为其深度 dep
当有多个儿子时,按照其儿子边从小到大排序后拼起来(类似树哈希)
而儿子边大小按儿子子树内值从小到大赋
儿子哈希值相同时,按儿子边编号从小到大排
每次将同一深度的点排序即可
最坏情况 sqrt(n)个儿子,每个儿子sqrt(n)个儿子,比较是sqrt(n)*sqrt(n)*log (吗
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 4ms
memory: 14080kb
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: 4ms
memory: 13916kb
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: 52ms
memory: 13052kb
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: 55ms
memory: 14092kb
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: 47ms
memory: 13912kb
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: 4ms
memory: 14204kb
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: 100ms
memory: 20220kb
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: 68ms
memory: 16480kb
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: 73ms
memory: 17924kb
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: 65ms
memory: 16448kb
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: 91ms
memory: 20100kb
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: 53ms
memory: 21192kb
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: 78ms
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: 94ms
memory: 20540kb
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: 100ms
memory: 20044kb
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: 88ms
memory: 20368kb
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: 61ms
memory: 22192kb
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: 90ms
memory: 20112kb
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: 69ms
memory: 25872kb
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: 33ms
memory: 19860kb
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: 78ms
memory: 25888kb
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: 66ms
memory: 25880kb
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: 58ms
memory: 24796kb
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: 57ms
memory: 24332kb
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: 53ms
memory: 22996kb
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: 46ms
memory: 25644kb
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'