QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#181455 | #6684. Trie | jaker | AC ✓ | 90ms | 30836kb | C++14 | 3.2kb | 2023-09-16 19:17:48 | 2023-09-16 19:17:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = j;i <= k;++i)
#define repp(i,j,k) for(int i = j;i >= k;--i)
#define ll long long
#define pb push_back
#define rank Rank
#define mp make_pair
#define P pair<int,int>
#define fr first
#define se second
#define rept(i,x) for(int i = linkk[x];i;i = e[i].n)
int rd() {
int sum = 0;char c = getchar();bool flag = true;
while(c < '0' || c > '9') {if(c == '-') flag = false;c = getchar();}
while(c >= '0' && c <= '9') sum = sum * 10 + c - 48,c = getchar();
if(flag) return sum;
else return -sum;
}
int T;
vector<int>G[201000],node[201000];
int fa[201000],dep[201000],rank[201000];
int n,m,mx_dep;
char ans[201000];
bool spe[201000];
// 0 ~ n
void dfs(int x) {
mx_dep = max( mx_dep , dep[x] );
node[dep[x]].pb(x);
for(auto y:G[x])
dep[y] = dep[x] + 1 , dfs(y);
}
int get(int x,int y) {
if( spe[x] && !spe[y] ) return 1;
if( !spe[x] && spe[y] ) return 0;
for(int i = 0;i < (int)(G[x].size()) && i < (int)(G[y].size());++i) {
/* if( min(x,y) == 7 && max(x,y) == 8 ) {
printf("#%d %d\n",G[x][i],G[y][i]);
}*/
if( rank[G[x][i]] != rank[G[y][i]] )
return rank[G[x][i]] < rank[G[y][i]];
}
if( (int)(G[x].size()) != (int)(G[y].size()) )
return (int)(G[x].size()) > (int)(G[y].size());
else
return 2;
}
bool cmp( int x,int y ) {
int res = get(x,y);
if( res != 2 ) return res;
else return x < y;
}
void dfs1(int x) {
char ch = 'a';
// printf("#%d\n",x);
// for(auto y:G[x]) printf("#%d ",y); printf("\n\n");
for(int i = 0;i < (int)(G[x].size());++i) {
int y = G[x][i];
dfs1(y);
}
sort(G[x].begin(),G[x].end(),cmp);
for(int i = 0;i < (int)(G[x].size());++i) {
int y = G[x][i];
ans[y] = ch;
ch++;
}
}
int TTT;
void work() {
n = rd(); m = rd();
// if(TTT == 40 && T == 50000) cerr<<n<<" "<<m<<endl;
rep(x,0,n) {
spe[x] = false; G[x].clear();
node[x].clear(); rank[x] = 0;
ans[x] = 'a'; fa[x] = 0;
}
rep(i,1,n) {int x = rd(); fa[i] = x; G[fa[i]].pb(i);}
// if(TTT==40 && T == 50000) rep(i,1,n) printf("%d ",fa[i]);
// if(TTT==40 && T == 50000) printf("\n");
rep(i,1,m) {
int x = rd();
// if(TTT == 40 && T == 50000) printf("%d ",x);
spe[x] = true;
}
//if(TTT==40 && T == 50000) printf("\n");
dfs(0);
repp(i,mx_dep,0) {
for(auto x:node[i])
sort(G[x].begin(),G[x].end(),cmp);
sort( node[i].begin() , node[i].end() , cmp );
int rk = 1;
rank[node[i][0]] = rk;
for(int j = 1;j < (int)(node[i].size());++j)
if( get(node[i][j],node[i][j-1]) != 2 ) rank[node[i][j]] = ++rk;
else rank[node[i][j]] = rk;
// for(auto x:node[i]) printf("*%d ",x); printf("\n");
// for(auto x:node[i]) printf("*%d ",rank[x]); printf("\n\n");
}
dfs1(0);
//if(TTT == 40 || T != 50000) {
rep(i,1,n) putchar(ans[i]);
printf("\n");
//}
}
int main(){
// freopen("input.txt","r",stdin);
T = rd();
for(TTT=1;TTT<=T;++TTT) {
work();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 15120kb
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: 15588kb
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: 26ms
memory: 13992kb
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: 20ms
memory: 15596kb
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: 14396kb
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: 0ms
memory: 14604kb
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: 77ms
memory: 19636kb
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: 51ms
memory: 16608kb
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: 52ms
memory: 18724kb
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: 49ms
memory: 16476kb
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: 83ms
memory: 20216kb
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: 64ms
memory: 18460kb
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: 90ms
memory: 20204kb
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: 78ms
memory: 19236kb
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: 72ms
memory: 20508kb
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: 78ms
memory: 19800kb
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: 38ms
memory: 24512kb
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: 55ms
memory: 20676kb
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: 63ms
memory: 30836kb
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: 27ms
memory: 22948kb
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: 66ms
memory: 30832kb
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: 54ms
memory: 30808kb
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: 30ms
memory: 19364kb
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: 18516kb
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: 38ms
memory: 18156kb
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: 32ms
memory: 17204kb
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'