QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#277578#6684. Trieucup-team191#AC ✓119ms32388kbC++141.9kb2023-12-06 20:22:222023-12-06 20:22:22

Judging History

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

  • [2023-12-06 20:22:22]
  • 评测
  • 测评结果:AC
  • 用时:119ms
  • 内存:32388kb
  • [2023-12-06 20:22:22]
  • 提交

answer

#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>

#define X first
#define Y second
#define PB push_back

using namespace std;

typedef pair < int, int > pii;

const int N = 2e5 + 500;
const int INF = 0x3f3f3f3f;

vector < int > v[N], raz[N];
vector < pair < vector < int >, int > > red;
int miin[N], key[N], dep[N], ima[N];
int ord[N], p[N];
char tata[N];

bool cmp(int A, int B){
    if(ord[A] == ord[B]) return A < B;
    return ord[A] < ord[B];
}

void solve(){
    int n, m; scanf("%d%d", &n, &m);
    for(int i = 0;i <= n;i++) v[i].clear(), key[i] = ima[i] = ord[i] = 0;
    for(int i = 1;i <= n;i++) {
        scanf("%d", p + i);
        v[p[i]].PB(i);
        dep[i] = 1 + dep[p[i]];
        raz[dep[i]].PB(i);
    }
    raz[0].PB(0);
    for(;m--;) {int x; scanf("%d", &x); key[x] = 1;}
    for(int i = n;i >= 0;i--) {
        for(int j : v[i]) ima[i] |= ima[j];
        ima[i] |= key[i];
    }
    for(int i = n;i >= 0;i--) {
        if(raz[i].empty()) continue;
        for(int x : raz[i]) {
            sort(v[x].begin(), v[x].end(), cmp);
            for(int i = 0;i < (int)v[x].size();i++)
                tata[v[x][i]] = 'a' + i;
            if(!ima[x]) {
                ord[x] = INF;
                continue;
            }
            vector < int > ja;
            if(key[x]) ja.PB({-1});
            for(int y : v[x]) if(ima[y]) ja.PB(ord[y]);
            ja.PB(INF);
            red.PB({ja, x});
        }
        sort(red.begin(), red.end());
        int aa = 0;
        for(int i = 0;i < (int)red.size();i++) {
            if(i && red[i].X != red[i - 1].X) aa++;
            ord[red[i].Y] = aa;
        }
        red.clear(); raz[i].clear();
    }
    for(int i = 1;i <= n;i++)
        printf("%c", tata[i]);
    printf("\n");
}

int main(){
    int T; scanf("%d", &T);
    for(;T--;) solve();
    return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 4ms
memory: 17004kb

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: 15992kb

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: 58ms
memory: 17980kb

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: 60ms
memory: 16860kb

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: 49ms
memory: 16960kb

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: 17880kb

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: 119ms
memory: 22476kb

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: 82ms
memory: 19132kb

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: 77ms
memory: 20684kb

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: 76ms
memory: 20452kb

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: 23224kb

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: 80ms
memory: 28696kb

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: 104ms
memory: 23404kb

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: 96ms
memory: 24196kb

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: 81ms
memory: 23300kb

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: 98ms
memory: 23632kb

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: 63ms
memory: 23896kb

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: 86ms
memory: 23224kb

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: 25132kb

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: 21228kb

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: 72ms
memory: 25388kb

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: 74ms
memory: 25180kb

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: 64ms
memory: 28296kb

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: 74ms
memory: 27848kb

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: 75ms
memory: 27884kb

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: 65ms
memory: 32388kb

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'