QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#847975#4237. Word Ladderparkky#AC ✓42ms62524kbC++17922b2025-01-08 14:14:542025-01-08 14:14:54

Judging History

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

  • [2025-01-08 14:14:54]
  • 评测
  • 测评结果:AC
  • 用时:42ms
  • 内存:62524kb
  • [2025-01-08 14:14:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
vector<string> init(){
    vector<string>A;
    string x="aa";
    while(1){
        A.push_back(x);
        if(x=="zz")break;
        if(x[0]==x[1])x[1]++;
        else x[0]++;
    }
    for(ll t=0;t<2;t++){
        vector<string>B;
        ll k=A.size();
        for(ll i=0;i<k;i++){
            if(i%4==0){
                for(ll j=0;j<k;j++)B.push_back(A[i]+A[j]);
            }else if(i%4==1){
                B.push_back(A[i]+A[k-1]);
            }else if(i%4==2){
                for(ll j=k-1;j>=0;j--)B.push_back(A[i]+A[j]);
            }else{
                B.push_back(A[i]+A[0]);
            }
        }
        A=B;
    }
    return A;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    vector<string>A=init();
    ll n;
    cin>>n;
    for(ll i=0;i<n;i++){
        cout<<A[i]<<"\n";
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 20ms
memory: 61384kb

input:

5

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc

result:

ok good solution

Test #2:

score: 0
Accepted
time: 20ms
memory: 60588kb

input:

3

output:

aaaaaaaa
aaaaaaab
aaaaaabb

result:

ok good solution

Test #3:

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

input:

4

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc

result:

ok good solution

Test #4:

score: 0
Accepted
time: 24ms
memory: 61908kb

input:

6

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd

result:

ok good solution

Test #5:

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

input:

7

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd

result:

ok good solution

Test #6:

score: 0
Accepted
time: 34ms
memory: 60676kb

input:

8

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade

result:

ok good solution

Test #7:

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

input:

9

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee

result:

ok good solution

Test #8:

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

input:

10

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef

result:

ok good solution

Test #9:

score: 0
Accepted
time: 20ms
memory: 61180kb

input:

64

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #10:

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

input:

51

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #11:

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

input:

97

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #12:

score: 0
Accepted
time: 24ms
memory: 61948kb

input:

100

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #13:

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

input:

1000

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #14:

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

input:

1001

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #15:

score: 0
Accepted
time: 35ms
memory: 61272kb

input:

1024

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #16:

score: 0
Accepted
time: 29ms
memory: 60776kb

input:

1025

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #17:

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

input:

5000

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #18:

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

input:

4999

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #19:

score: 0
Accepted
time: 34ms
memory: 62524kb

input:

4096

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #20:

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

input:

4097

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #21:

score: 0
Accepted
time: 26ms
memory: 61224kb

input:

4098

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution

Test #22:

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

input:

3751

output:

aaaaaaaa
aaaaaaab
aaaaaabb
aaaaaabc
aaaaaacc
aaaaaacd
aaaaaadd
aaaaaade
aaaaaaee
aaaaaaef
aaaaaaff
aaaaaafg
aaaaaagg
aaaaaagh
aaaaaahh
aaaaaahi
aaaaaaii
aaaaaaij
aaaaaajj
aaaaaajk
aaaaaakk
aaaaaakl
aaaaaall
aaaaaalm
aaaaaamm
aaaaaamn
aaaaaann
aaaaaano
aaaaaaoo
aaaaaaop
aaaaaapp
aaaaaapq
aaaaaaqq
aaa...

result:

ok good solution