QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#253748#4237. Word Ladderchen_zexingAC ✓2ms5320kbC++171.5kb2023-11-17 13:51:162023-11-17 13:51:16

Judging History

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

  • [2023-11-17 13:51:16]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:5320kb
  • [2023-11-17 13:51:16]
  • 提交

answer

#pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
vector <string> v[11];
void build(int x){
    if(x==2){
        for(int i=0;i<26;i++){
            string temp="";
            temp+='a'+i,temp+='a'+i;
            v[x].push_back(temp);
            if(i!=25) {
                temp = "";
                temp += 'a' + i, temp += 'a' + i + 1;
                v[x].push_back(temp);
            }
        }
    }
    else{
        for(int i=0;i<26;i++){
            if(i%2==0){
                for(int j=0;j<v[x-2].size();j++){
                    string temp="";
                    temp+='a'+i,temp+='a'+i,temp+=v[x-2][j];
                    v[x].push_back(temp);
                }
            }
            else{
                for(int j=v[x-2].size()-1;j>=0;j--){
                    string temp="";
                    temp+='a'+i,temp+='a'+i,temp+=v[x-2][j];
                    v[x].push_back(temp);
                }
            }
            if(i!=25){
                string temp="";
                temp+='a'+i,temp+='a'+i+1;
                if(i%2==0) temp+=v[x-2].back();
                else temp+=v[x-2][0];
                v[x].push_back(temp);
            }
        }
    }
}
int main() {
    int T = 1, kase = 0;
    //cin >> T;
    while (T--) {
        build(2),build(4),build(6);
        int n;
        cin>>n;
        for(int i=0;i<n;i++) cout<<v[6][i]<<'\n';
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 5068kb

input:

5

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc

result:

ok good solution

Test #2:

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

input:

3

output:

aaaaaa
aaaaab
aaaabb

result:

ok good solution

Test #3:

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

input:

4

output:

aaaaaa
aaaaab
aaaabb
aaaabc

result:

ok good solution

Test #4:

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

input:

6

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd

result:

ok good solution

Test #5:

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

input:

7

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd

result:

ok good solution

Test #6:

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

input:

8

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade

result:

ok good solution

Test #7:

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

input:

9

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee

result:

ok good solution

Test #8:

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

input:

10

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef

result:

ok good solution

Test #9:

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

input:

64

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #10:

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

input:

51

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #11:

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

input:

97

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #12:

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

input:

100

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #13:

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

input:

1000

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #14:

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

input:

1001

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #15:

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

input:

1024

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #16:

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

input:

1025

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #17:

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

input:

5000

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #18:

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

input:

4999

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #19:

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

input:

4096

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #20:

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

input:

4097

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #21:

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

input:

4098

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution

Test #22:

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

input:

3751

output:

aaaaaa
aaaaab
aaaabb
aaaabc
aaaacc
aaaacd
aaaadd
aaaade
aaaaee
aaaaef
aaaaff
aaaafg
aaaagg
aaaagh
aaaahh
aaaahi
aaaaii
aaaaij
aaaajj
aaaajk
aaaakk
aaaakl
aaaall
aaaalm
aaaamm
aaaamn
aaaann
aaaano
aaaaoo
aaaaop
aaaapp
aaaapq
aaaaqq
aaaaqr
aaaarr
aaaars
aaaass
aaaast
aaaatt
aaaatu
aaaauu
aaaauv
aaaavv...

result:

ok good solution