QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261657#6449. Incremental Double Free StringsZhouShang#AC ✓188ms23616kbC++143.6kb2023-11-23 07:39:462023-11-23 07:39:47

Judging History

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

  • [2023-11-23 07:39:47]
  • 评测
  • 测评结果:AC
  • 用时:188ms
  • 内存:23616kb
  • [2023-11-23 07:39:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define rep(i,a,b) for(int i = a; i < (b); i++)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back
#define FS first
#define SD second
#define cmx(x, y) x = max(x, y)
#define cmn(x, y) x = min(x, y)
#define ary(k) array<int, k>
typedef pair<int, int> pii;
typedef vector<int> vi;
map <vector<int>,int> mp;
long long inf=1000000000000000001;
int k;
long long solve(vector<int> v){
    sort(v.begin()+1,v.end());
    if(mp.count(v)) return mp[v];
    int f[27]={};
    for(int i=0;i<v.size();i++) {
        if(v[i]>k) return mp[v]=0;
        for (int j = 1; j <= v[i]; j++)
            f[j]++;
    }
    int gd=1;
    for(int i=k;i;i--){
        if(f[i]>k-i+1) return mp[v]=0;
        if(f[i]!=k-i+1) gd=0;
    }
    //cout<<"#";for(auto t:v) cout<<t<<" ";cout<<"\n";
    //cout<<gd<<'\n';
    if(gd) return mp[v]=1;
    long long ans=0;
    for(int i=1;i<v.size();i++){
        vector <int> nxt;
        nxt.push_back(v[i]+1);
        for(int j=0;j<v.size();j++) if(j!=i) nxt.push_back(v[j]);
        int temp=solve(nxt);
        ans+=temp;
        if(ans>=inf) return mp[v]=inf;
    }
    if(v.size()<k) {
        vector <int> nxt;
        nxt.push_back(1);
        for (int i = 0; i < v.size(); i++) nxt.push_back(v[i]);
        //cout<<"?";for(auto t:nxt) cout<<t<<" ";cout<<"\n";
        int temp = solve(nxt);
        if(temp) {
            if (inf / temp <= 26 - v.size()) return mp[v] = inf;
            ans += temp * (26 - v.size());
            if (ans > inf) return mp[v] = inf;
        }
    }
    //for(auto t:v) cout<<t<<" ";cout<<ans<<'\n';
    return mp[v]=ans;
}
signed main() {
	cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit);
    int n;
    cin>>k>>n;
    char lst='?';
    int rest=n;
    vector <int> v;
    int f[27]={};
    for(int i=1;i<=k*(k+1)/2;i++){
        int cnt=0;
        for(int j=0;j<26;j++)
            if(j+'a'!=lst){
                vector <int> nxt;
                if(!f[j]){
                    nxt.push_back(1);
                    for(auto t:v) nxt.push_back(t);
                    int oc=cnt;
                    cnt+=solve(nxt);
                    if(cnt>=rest){
                        rest-=oc;
                        v=nxt;
                        sort(v.begin()+1,v.end());
                        f[j]++,lst=j+'a';
                        cout<<lst;
                        break;
                    }
                }
                else{
                    int pos=-1;
                    for(int l=1;l<v.size();l++) if(v[l]==f[j]){
                        pos=l;
                        break;
                    }
                    if(pos!=-1){
                        vector <int> nxt;
                        nxt.push_back(v[pos]+1);
                        for(int l=0;l<v.size();l++)
                            if(l!=pos)
                                nxt.push_back(v[l]);
                        int oc=cnt;
                        cnt+=solve(nxt);
                        if(cnt>=rest){
                            rest-=oc;
                            v=nxt;
                            sort(v.begin()+1,v.end());
                            f[j]++,lst=j+'a';
                            cout<<lst;
                            break;
                        }
                    }
                }
                //cout<<j<<" "<<cnt<<'\n';
            }
        if(cnt<rest){
            cout<<"-1\n";
            return 0;
        }
    }
    cout<<'\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3452kb

input:

2 650

output:

zyz

result:

ok single line: 'zyz'

Test #2:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

2 651

output:

-1

result:

ok single line: '-1'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

5 12345678901234

output:

yuzczuyuyuzuyci

result:

ok single line: 'yuzczuyuyuzuyci'

Test #4:

score: 0
Accepted
time: 1ms
memory: 3500kb

input:

1 26

output:

z

result:

ok single line: 'z'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3452kb

input:

1 27

output:

-1

result:

ok single line: '-1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3484kb

input:

3 156000

output:

zyzyzx

result:

ok single line: 'zyzyzx'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3392kb

input:

3 156001

output:

-1

result:

ok single line: '-1'

Test #8:

score: 0
Accepted
time: 1ms
memory: 3408kb

input:

4 385351200

output:

zyzyzyzxwx

result:

ok single line: 'zyzyzyzxwx'

Test #9:

score: 0
Accepted
time: 1ms
memory: 3404kb

input:

4 385351201

output:

-1

result:

ok single line: '-1'

Test #10:

score: 0
Accepted
time: 1ms
memory: 3480kb

input:

5 12922802006400

output:

zyzyzyzyzxwxwxv

result:

ok single line: 'zyzyzyzyzxwxwxv'

Test #11:

score: 0
Accepted
time: 1ms
memory: 3436kb

input:

5 12922802006401

output:

-1

result:

ok single line: '-1'

Test #12:

score: 0
Accepted
time: 53ms
memory: 9400kb

input:

21 504997606437015617

output:

ababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghgijijijijijijijijijijijijiklklklklklklklklklklkmnmnmnmnmnmnmnmnmopopoptxpxoxoxotoxpvtuvuzvtp

result:

ok single line: 'ababababababababababababababab...mnmopopoptxpxoxoxotoxpvtuvuzvtp'

Test #13:

score: 0
Accepted
time: 32ms
memory: 7268kb

input:

17 956419027625223297

output:

ababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefeghghghghghghghghghghgijijijijijijijijiklklklkvkovplyukuvulolopokou

result:

ok single line: 'ababababababababababababababab...ijiklklklkvkovplyukuvulolopokou'

Test #14:

score: 0
Accepted
time: 59ms
memory: 12356kb

input:

25 700029135738361729

output:

ababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopoqrqrqrqrqrqrqrqrqsts...

result:

ok single line: 'ababababababababababababababab...qrqststzyvzwywtyvytzvtvtzxzszvt'

Test #15:

score: 0
Accepted
time: 32ms
memory: 7056kb

input:

20 295056960215823937

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnqoruroqozorqrozumrzrvz

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnqoruroqozorqrozumrzrvz'

Test #16:

score: 0
Accepted
time: 59ms
memory: 10832kb

input:

23 399517591257179585

output:

ababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijiklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmopopopopopopopopoqrqrqtrxqyrqrxtrytryuxsxtutq

result:

ok single line: 'ababababababababababababababab...opoqrqrqtrxqyrqrxtrytryuxsxtutq'

Test #17:

score: 0
Accepted
time: 42ms
memory: 8260kb

input:

19 840231597177243777

output:

ababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefeghghghghghghghghghghghghgijijijijijijijijijijiklklklklklklklklkmnmnmnpnwpwpywztzwpwpwymwpmz

result:

ok single line: 'ababababababababababababababab...klkmnmnmnpnwpwpywztzwpwpwymwpmz'

Test #18:

score: 0
Accepted
time: 59ms
memory: 10924kb

input:

23 346835459261086529

output:

ababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijiklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmopopopopopopopopoqrqrqsyxtrysxsqsysrxwqstyrsq

result:

ok single line: 'ababababababababababababababab...opoqrqrqsyxtrysxsqsysrxwqstyrsq'

Test #19:

score: 0
Accepted
time: 2ms
memory: 3760kb

input:

8 170974737705428481

output:

abababababababacymxcxycmdfxcmcmcxydm

result:

ok single line: 'abababababababacymxcxycmdfxcmcmcxydm'

Test #20:

score: 0
Accepted
time: 22ms
memory: 5804kb

input:

13 125190426534672385

output:

ababababababababababababacdcdcdcdcdcdcdcdcdcdcefefefefefefefefeghghghghihujuiuihtjitiuiptgh

result:

ok single line: 'ababababababababababababacdcdc...efeghghghghihujuiuihtjitiuiptgh'

Test #21:

score: 0
Accepted
time: 14ms
memory: 4916kb

input:

11 664212519666044417

output:

ababababababababababacdcdcdcdcdcdcdcdcefefefefmfurmuenerwrurermrwu

result:

ok single line: 'ababababababababababacdcdcdcdc...cdcefefefefmfurmuenerwrurermrwu'

Test #22:

score: 0
Accepted
time: 55ms
memory: 10868kb

input:

23 537623633106591105

output:

ababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijiklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmopopopopopopopopoqrqrqustxszxqzqzszsxzrqrszuq

result:

ok single line: 'ababababababababababababababab...opoqrqrqustxszxqzqzszsxzrqrszuq'

Test #23:

score: 0
Accepted
time: 4ms
memory: 3844kb

input:

8 289718312292826881

output:

abababababababadqmdmqmqpndpmvqdmndnd

result:

ok single line: 'abababababababadqmdmqmqpndpmvqdmndnd'

Test #24:

score: 0
Accepted
time: 7ms
memory: 4204kb

input:

12 615453088345830657

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefepvpxjupwpuvupujvuvujw

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefepvpxjupwpuvupujvuvujw'

Test #25:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

2 305175987747354305

output:

-1

result:

ok single line: '-1'

Test #26:

score: 0
Accepted
time: 78ms
memory: 11832kb

input:

22 264626752761756737

output:

abababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghgijijijijijijijijijijijijijiklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmopopopopopopopxtwtxvxtvqtvxvquxowxvq

result:

ok single line: 'ababababababababababababababab...popopopopxtwtxvxtvqtvxvquxowxvq'

Test #27:

score: 0
Accepted
time: 32ms
memory: 7008kb

input:

20 574252293235197441

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnsquvusumuvpsvzpsvzuvpu

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnsquvusumuvpsvzpsvzuvpu'

Test #28:

score: 0
Accepted
time: 1ms
memory: 3384kb

input:

2 575078602539790017

output:

-1

result:

ok single line: '-1'

Test #29:

score: 0
Accepted
time: 33ms
memory: 7044kb

input:

20 881368213586277761

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnuwsuosuswuosowosxmszxo

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnuwsuosuswuosowosxmszxo'

Test #30:

score: 0
Accepted
time: 0ms
memory: 3448kb

input:

2 176644281198093729

output:

-1

result:

ok single line: '-1'

Test #31:

score: 0
Accepted
time: 96ms
memory: 13368kb

input:

24 921520011326414593

output:

abababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijiklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopoqrqrqrqrqrqrqzvsysztvsyzsuzvuyszyzqz

result:

ok single line: 'ababababababababababababababab...rqrqrqrqzvsysztvsyzsuzvuyszyzqz'

Test #32:

score: 0
Accepted
time: 1ms
memory: 3496kb

input:

5 946117265260411905

output:

-1

result:

ok single line: '-1'

Test #33:

score: 0
Accepted
time: 32ms
memory: 7008kb

input:

20 173320119792428769

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnpoyrponzsporzozporprso

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnpoyrponzsporzozporprso'

Test #34:

score: 0
Accepted
time: 7ms
memory: 4128kb

input:

12 338963391006217281

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefelokwolwkwlwmzkowokowm

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefelokwolwkwlwmzkowokowm'

Test #35:

score: 0
Accepted
time: 18ms
memory: 5744kb

input:

16 80320307274810433

output:

abababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefeghghghghghghghghghgijijijijijijijiozkxkrkxokolkxrxlxrox

result:

ok single line: 'ababababababababababababababab...jijijijijiozkxkrkxokolkxrxlxrox'

Test #36:

score: 0
Accepted
time: 19ms
memory: 5336kb

input:

14 637037669681589633

output:

abababababababababababababacdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefeghghghghghghghigwizorqwrwiwiwqwqoqoi

result:

ok single line: 'abababababababababababababacdc...hghghghghigwizorqwrwiwiwqwqoqoi'

Test #37:

score: 0
Accepted
time: 15ms
memory: 5256kb

input:

14 472183589009851777

output:

abababababababababababababacdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefeghghghghghghghgwjriyiuywrirjiwiwyiyw

result:

ok single line: 'abababababababababababababacdc...hghghghghgwjriyiuywrirjiwiwyiyw'

Test #38:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

2 236964121532764705

output:

-1

result:

ok single line: '-1'

Test #39:

score: 0
Accepted
time: 3ms
memory: 3640kb

input:

6 946551301587284353

output:

didixujdudjdujudjquqi

result:

ok single line: 'didixujdudjdujudjquqi'

Test #40:

score: 0
Accepted
time: 1ms
memory: 3452kb

input:

1 534873447159057473

output:

-1

result:

ok single line: '-1'

Test #41:

score: 0
Accepted
time: 59ms
memory: 10928kb

input:

23 638296633489851265

output:

ababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijiklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmopopopopopopopopoqrqrqvrqyzytqsvqyqzrtrtvrvtv

result:

ok single line: 'ababababababababababababababab...opoqrqrqvrqyzytqsvqyqzrtrtvrvtv'

Test #42:

score: 0
Accepted
time: 182ms
memory: 23564kb

input:

26 39796290472878585

output:

abababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopopoqrqr...

result:

ok single line: 'ababababababababababababababab...tstststusyvwtyuvuvxywuxvtyzyuyw'

Test #43:

score: 0
Accepted
time: 19ms
memory: 5220kb

input:

14 949679788537885313

output:

abababababababababababababacdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefeghghghghghghghiluyqlililquyihlyuyjil

result:

ok single line: 'abababababababababababababacdc...hghghghghiluyqlililquyihlyuyjil'

Test #44:

score: 0
Accepted
time: 91ms
memory: 13360kb

input:

24 633658193501830145

output:

abababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijiklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopoqrqrqrqrqrqrqxrsqsxuxsyuszuyvsysyzuy

result:

ok single line: 'ababababababababababababababab...rqrqrqrqxrsqsxuxsyuszuyvsysyzuy'

Test #45:

score: 0
Accepted
time: 5ms
memory: 3936kb

input:

10 67761908474857081

output:

abababababababababacdcdcdcdcdcdcdcerxqmremrxewxwrxmexex

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdcerxqmremrxewxwrxmexex'

Test #46:

score: 0
Accepted
time: 7ms
memory: 4128kb

input:

12 719617661871382145

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefernzurnrjnrnjunkrunjuk

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefernzurnrjnrnjunkrunjuk'

Test #47:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

2 509958959298991489

output:

-1

result:

ok single line: '-1'

Test #48:

score: 0
Accepted
time: 13ms
memory: 4396kb

input:

9 707157613566394625

output:

ababababababababacdcdcdcdhdcuqcudqjqjduhnqhuq

result:

ok single line: 'ababababababababacdcdcdcdhdcuqcudqjqjduhnqhuq'

Test #49:

score: 0
Accepted
time: 6ms
memory: 4008kb

input:

7 211112055721450529

output:

ababababaiziruzbnizribuzarza

result:

ok single line: 'ababababaiziruzbnizribuzarza'

Test #50:

score: 0
Accepted
time: 32ms
memory: 7112kb

input:

20 482234434985770113

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnruxtrwrtwrutrwmwvrtuvt

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnruxtrwrtwrutrwmwvrtuvt'

Test #51:

score: 0
Accepted
time: 37ms
memory: 7164kb

input:

17 382831221813212609

output:

ababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefeghghghghghghghghghghgijijijijijijijijiklklklkokolnklnovynynyvonknr

result:

ok single line: 'ababababababababababababababab...ijiklklklkokolnklnovynynyvonknr'

Test #52:

score: 0
Accepted
time: 7ms
memory: 4152kb

input:

12 329884479876781697

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefelkntnztntmnzntkzkmznz

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefelkntnztntmnzntkzkmznz'

Test #53:

score: 0
Accepted
time: 53ms
memory: 9288kb

input:

21 265674425990674465

output:

ababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghgijijijijijijijijijijijijiklklklklklklklklklklkmnmnmnmnmnmnmnmnmopopoprososroroursvsvsrusuxu

result:

ok single line: 'ababababababababababababababab...mnmopopoprososroroursvsvsrusuxu'

Test #54:

score: 0
Accepted
time: 27ms
memory: 6440kb

input:

15 106586680964142033

output:

ababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefeghghghghghghghghgijijijijlxluxixlioljojxujolk

result:

ok single line: 'ababababababababababababababac...ghgijijijijlxluxixlioljojxujolk'

Test #55:

score: 0
Accepted
time: 13ms
memory: 4484kb

input:

9 75116947484140433

output:

ababababababababacdcdcdcdcglcgklogqgdgcgloklk

result:

ok single line: 'ababababababababacdcdcdcdcglcgklogqgdgcgloklk'

Test #56:

score: 0
Accepted
time: 5ms
memory: 3916kb

input:

10 207608563473641537

output:

abababababababababacdcdcdcdcdcdcdcfxnfntnfynfufnfxuyuxu

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdcfxnfntnfynfufnfxuyuxu'

Test #57:

score: 0
Accepted
time: 13ms
memory: 4428kb

input:

9 672036791833754369

output:

ababababababababacdcdcdcdgvgfdivcfgdvdvigpicg

result:

ok single line: 'ababababababababacdcdcdcdgvgfdivcfgdvdvigpicg'

Test #58:

score: 0
Accepted
time: 54ms
memory: 9380kb

input:

21 213372916791200865

output:

ababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghgijijijijijijijijijijijijiklklklklklklklklklklkmnmnmnmnmnmnmnmnmopopopqswpwosopwozpqrzqpwqzq

result:

ok single line: 'ababababababababababababababab...mnmopopopqswpwosopwozpqrzqpwqzq'

Test #59:

score: 0
Accepted
time: 2ms
memory: 3900kb

input:

10 417004037264071297

output:

abababababababababacdcdcdcdcdcdcdchvjzlivlzvzvljlvilili

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdchvjzlivlzvzvljlvilili'

Test #60:

score: 0
Accepted
time: 14ms
memory: 5784kb

input:

16 717050257695447553

output:

abababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefeghghghghghghghghghgijijijijijijijksyutuynskykysyuyusits

result:

ok single line: 'ababababababababababababababab...jijijijijksyutuynskykysyuyusits'

Test #61:

score: 0
Accepted
time: 7ms
memory: 4124kb

input:

12 85054724501354433

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefehnrurnuwurhunwrurhgrn

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefehnrurnuwurhunwrurhgrn'

Test #62:

score: 0
Accepted
time: 184ms
memory: 23588kb

input:

26 187209568455443777

output:

abababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopopoqrqr...

result:

ok single line: 'ababababababababababababababab...tstststvxvywzvwstxsyzxwxvuvwvyw'

Test #63:

score: 0
Accepted
time: 71ms
memory: 12416kb

input:

25 804517262216826625

output:

ababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopoqrqrqrqrqrqrqrqrqsts...

result:

ok single line: 'ababababababababababababababab...qrqstsutsusxszuzsztwxtuyzutyuxs'

Test #64:

score: 0
Accepted
time: 2ms
memory: 3984kb

input:

10 274173178094955009

output:

abababababababababacdcdcdcdcdcdcdcgpgqgogpogoqoqomgpmyp

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdcgpgqgogpogoqoqomgpmyp'

Test #65:

score: 0
Accepted
time: 4ms
memory: 3736kb

input:

8 561130371304493313

output:

abababababababafdtrdtftdrftrfptrofpf

result:

ok single line: 'abababababababafdtrdtftdrftrfptrofpf'

Test #66:

score: 0
Accepted
time: 6ms
memory: 3932kb

input:

10 462072637790669185

output:

abababababababababacdcdcdcdcdcdcdcijefeiftjeieifixjtjei

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdcijefeiftjeieifixjtjei'

Test #67:

score: 0
Accepted
time: 30ms
memory: 6432kb

input:

15 589060396133795969

output:

ababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefeghghghghghghghghgijijijikupkykpkikiuipjywyjpj

result:

ok single line: 'ababababababababababababababac...ghgijijijikupkykpkikiuipjywyjpj'

Test #68:

score: 0
Accepted
time: 77ms
memory: 11832kb

input:

22 651467584194037377

output:

abababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghgijijijijijijijijijijijijijiklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmopopopopopopoqurqryuoruqupzvquqzurvz

result:

ok single line: 'ababababababababababababababab...popopopoqurqryuoruqupzvquqzurvz'

Test #69:

score: 0
Accepted
time: 25ms
memory: 5776kb

input:

13 806031432255245825

output:

ababababababababababababacdcdcdcdcdcdcdcdcdcdcefefefefefefefefeghghghghxktkytgygkhsghtkskty

result:

ok single line: 'ababababababababababababacdcdc...efeghghghghxktkytgygkhsghtkskty'

Test #70:

score: 0
Accepted
time: 15ms
memory: 4892kb

input:

11 146370449944924993

output:

ababababababababababacdcdcdcdcdcdcdcdcefefefefetksftftsmsymksmstfe

result:

ok single line: 'ababababababababababacdcdcdcdc...cdcefefefefetksftftsmsymksmstfe'

Test #71:

score: 0
Accepted
time: 37ms
memory: 7320kb

input:

17 583788220281327617

output:

ababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefeghghghghghghghghghghgijijijijijijijijiklklklkqpnltnkqnpnkqpzltqlnl

result:

ok single line: 'ababababababababababababababab...ijiklklklkqpnltnkqnpnkqpzltqlnl'

Test #72:

score: 0
Accepted
time: 4ms
memory: 3812kb

input:

8 646843031280027905

output:

abababababababafpnmfmimilfilmflfifni

result:

ok single line: 'abababababababafpnmfmimilfilmflfifni'

Test #73:

score: 0
Accepted
time: 1ms
memory: 3396kb

input:

3 461308197315354113

output:

-1

result:

ok single line: '-1'

Test #74:

score: 0
Accepted
time: 7ms
memory: 4124kb

input:

12 511847920930023297

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefeoioioqiqixloxhqoiqlxo

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefeoioioqiqixloxhqoiqlxo'

Test #75:

score: 0
Accepted
time: 5ms
memory: 3996kb

input:

10 680979542857592449

output:

abababababababababacdcdcdcdcdcdcdckhseshkoskevhesksksho

result:

ok single line: 'abababababababababacdcdcdcdcdcdcdckhseshkoskevhesksksho'

Test #76:

score: 0
Accepted
time: 18ms
memory: 5792kb

input:

16 570225222946689345

output:

abababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefeghghghghghghghghghgijijijijijijijkqkqsiqsklosoksqklqplk

result:

ok single line: 'ababababababababababababababab...jijijijijkqkqsiqsklosoksqklqplk'

Test #77:

score: 0
Accepted
time: 36ms
memory: 7224kb

input:

17 572405568080874625

output:

ababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefeghghghghghghghghghghgijijijijijijijijiklklklkqmtqntmkylqmyklqmqklt

result:

ok single line: 'ababababababababababababababab...ijiklklklkqmtqntmkylqmyklqmqklt'

Test #78:

score: 0
Accepted
time: 45ms
memory: 8256kb

input:

19 699624347204746753

output:

ababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefeghghghghghghghghghghghghgijijijijijijijijijijiklklklklklklklklkmnmnmnouyoxynmxmyonzxnyzxnym

result:

ok single line: 'ababababababababababababababab...klkmnmnmnouyoxynmxmyonzxnyzxnym'

Test #79:

score: 0
Accepted
time: 31ms
memory: 7064kb

input:

20 130246438237044513

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnoxsxrorsvqxvxsxsrsmxrv

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnoxsxrorsvqxvxsxsrsmxrv'

Test #80:

score: 0
Accepted
time: 22ms
memory: 6392kb

input:

18 858678597582937217

output:

abababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefeghghghghghghghghghghghgijijijijijijijijijiklklklklklklklonpnowrpopwpoxnpwlpnor

result:

ok single line: 'ababababababababababababababab...lklklklklonpnowrpopwpoxnpwlpnor'

Test #81:

score: 0
Accepted
time: 36ms
memory: 7228kb

input:

17 577856050230984449

output:

ababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefeghghghghghghghghghghgijijijijijijijijiklklklkqoklowlowlywlokwqoxqx

result:

ok single line: 'ababababababababababababababab...ijiklklklkqoklowlowlywlokwqoxqx'

Test #82:

score: 0
Accepted
time: 7ms
memory: 4184kb

input:

12 107018281744871041

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefehuihjhikiuhkjiwikjhkh

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefehuihjhikiuhkjiwikjhkh'

Test #83:

score: 0
Accepted
time: 30ms
memory: 6416kb

input:

15 114328973580605009

output:

ababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefeghghghghghghghghgijijijijmjmnjyitnitnmitytomt

result:

ok single line: 'ababababababababababababababac...ghgijijijijmjmnjyitnitnmitytomt'

Test #84:

score: 0
Accepted
time: 28ms
memory: 7060kb

input:

20 756852744512443137

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmntwtzwxzyznzyvztyztvtyv

result:

ok single line: 'ababababababababababababababab...nmnmnmnmntwtzwxzyznzyvztyztvtyv'

Test #85:

score: 0
Accepted
time: 3ms
memory: 3616kb

input:

6 386478765569073345

output:

bjmimababiaihbaiamabh

result:

ok single line: 'bjmimababiaihbaiamabh'

Test #86:

score: 0
Accepted
time: 49ms
memory: 9332kb

input:

21 310414623553128897

output:

ababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghgijijijijijijijijijijijijiklklklklklklklklklklkmnmnmnmnmnmnmnmnmopopopruptrvrtopupuoutrorsos

result:

ok single line: 'ababababababababababababababab...mnmopopopruptrvrtopupuoutrorsos'

Test #87:

score: 0
Accepted
time: 13ms
memory: 4512kb

input:

9 877388752889693569

output:

ababababababababacdcdcdcdiqckqidqckekrkecdqke

result:

ok single line: 'ababababababababacdcdcdcdiqckqidqckekrkecdqke'

Test #88:

score: 0
Accepted
time: 177ms
memory: 23616kb

input:

26 406777307987240961

output:

abababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopopoqrqr...

result:

ok single line: 'ababababababababababababababab...tstststxyzuzyzvyvyvzysxtvuztyuw'

Test #89:

score: 0
Accepted
time: 19ms
memory: 5332kb

input:

14 368298594984246081

output:

abababababababababababababacdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefeghghghghghghghgsztpsvtosztvzszsvspzt

result:

ok single line: 'abababababababababababababacdc...hghghghghgsztpsvtosztvzszsvspzt'

Test #90:

score: 0
Accepted
time: 4ms
memory: 3796kb

input:

8 52280610062240385

output:

abababababababacjojojwcnjiowojnwcjco

result:

ok single line: 'abababababababacjojojwcnjiowojnwcjco'

Test #91:

score: 0
Accepted
time: 7ms
memory: 4176kb

input:

12 810128671082232193

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefesxmutsmxnmututxumtmtm

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefesxmutsmxnmututxumtmtm'

Test #92:

score: 0
Accepted
time: 32ms
memory: 7040kb

input:

20 879506599738462593

output:

abababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefeghghghghghghghghghghghghghgijijijijijijijijijijijiklklklklklklklklklkmnmnmnmnmnmnmnuwqosqtwoqonostqoqtqst

result:

ok single line: 'ababababababababababababababab...nmnmnmnmnuwqosqtwoqonostqoqtqst'

Test #93:

score: 0
Accepted
time: 53ms
memory: 9324kb

input:

21 374938626161359425

output:

ababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghgijijijijijijijijijijijijiklklklklklklklklklklkmnmnmnmnmnmnmnmnmopopopspxwxzsoszwvoszsxposxo

result:

ok single line: 'ababababababababababababababab...mnmopopopspxwxzsoszwvoszsxposxo'

Test #94:

score: 0
Accepted
time: 7ms
memory: 4132kb

input:

12 774538964384134913

output:

abababababababababababacdcdcdcdcdcdcdcdcdcefefefefefefefeslslstuxiuxslxusutxsx

result:

ok single line: 'abababababababababababacdcdcdc...fefefefefeslslstuxiuxslxusutxsx'

Test #95:

score: 0
Accepted
time: 91ms
memory: 13468kb

input:

24 576730333168747265

output:

abababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijiklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopoqrqrqrqrqrqrqwvwtsvwvzsrxsvqtzwvwsvz

result:

ok single line: 'ababababababababababababababab...rqrqrqrqwvwtsvwvzsrxsvqtzwvwsvz'

Test #96:

score: 0
Accepted
time: 63ms
memory: 10876kb

input:

23 650841703287326849

output:

ababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijiklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmopopopopopopopopoqrqrqvrwrxqxzrwtxrwvqrwzxzqw

result:

ok single line: 'ababababababababababababababab...opoqrqrqvrwrxqxzrwtxrwvqrwzxzqw'

Test #97:

score: 0
Accepted
time: 30ms
memory: 6432kb

input:

15 226528142367719457

output:

ababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefeghghghghghghghghgijijijijqpjpyipmjmpqmnympiyi

result:

ok single line: 'ababababababababababababababac...ghgijijijijqpjpyipmjmpqmnympiyi'

Test #98:

score: 0
Accepted
time: 2ms
memory: 3788kb

input:

8 415858011858489345

output:

abababababababaejkjzegegekjekrgkzkje

result:

ok single line: 'abababababababaejkjzegegekjekrgkzkje'

Test #99:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

4 580514656106693377

output:

-1

result:

ok single line: '-1'

Test #100:

score: 0
Accepted
time: 1ms
memory: 3492kb

input:

4 774334415719508225

output:

-1

result:

ok single line: '-1'

Test #101:

score: 0
Accepted
time: 188ms
memory: 23600kb

input:

26 454707451144564353

output:

abababababababababababababababababababababababababacdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcefefefefefefefefefefefefefefefefefefefefefeghghghghghghghghghghghghghghghghghghghgijijijijijijijijijijijijijijijijijiklklklklklklklklklklklklklklklkmnmnmnmnmnmnmnmnmnmnmnmnmnmopopopopopopopopopopopoqrqr...

result:

ok single line: 'ababababababababababababababab...tstststyuzxuvxzsvzxyxvwszvxvyvt'