QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#370069#4237. Word LadderInfinityNS#AC ✓3ms4056kbC++14875b2024-03-28 21:39:082024-03-28 21:39:08

Judging History

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

  • [2024-03-28 21:39:08]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:4056kb
  • [2024-03-28 21:39:08]
  • 提交

answer

#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;

string a="aaaaaaaaaa";
int n;
vector<bool> dir(5);
vector<string> vals;
void rec(int pos){
    if(pos==5)return;
    while(vals.size()<=n){
        rec(pos+1);
        if(a[pos*2]=='a'&&dir[pos]){
            dir[pos]=0;
            break;
        }
        if(a[pos*2]=='z'&&!dir[pos]){
            dir[pos]=1;
            break;
        }
        if(!dir[pos]){
            a[2*pos]++;
            vals.pb(a);
            a[2*pos+1]++;
            vals.pb(a);
        }
        else{
            a[2*pos]--;
            vals.pb(a);
            a[2*pos+1]--;
            vals.pb(a);
        }
    }
}

int main(){
    scanf("%i",&n);
    vals.pb(a);
    rec(0);
    for(int i=0;i<n;i++){
        cout << vals[i] << endl;
    }
}

詳細信息

Test #1:

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

input:

5

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc

result:

ok good solution

Test #2:

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

input:

3

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb

result:

ok good solution

Test #3:

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

input:

4

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb

result:

ok good solution

Test #4:

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

input:

6

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc

result:

ok good solution

Test #5:

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

input:

7

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd

result:

ok good solution

Test #6:

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

input:

8

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed

result:

ok good solution

Test #7:

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

input:

9

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee

result:

ok good solution

Test #8:

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

input:

10

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe

result:

ok good solution

Test #9:

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

input:

64

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #10:

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

input:

51

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #11:

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

input:

97

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #12:

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

input:

100

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #13:

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

input:

1000

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #14:

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

input:

1001

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #15:

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

input:

1024

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #16:

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

input:

1025

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #17:

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

input:

5000

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #18:

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

input:

4999

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #19:

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

input:

4096

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #20:

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

input:

4097

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #21:

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

input:

4098

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution

Test #22:

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

input:

3751

output:

aaaaaaaaaa
aaaaaaaaba
aaaaaaaabb
aaaaaaaacb
aaaaaaaacc
aaaaaaaadc
aaaaaaaadd
aaaaaaaaed
aaaaaaaaee
aaaaaaaafe
aaaaaaaaff
aaaaaaaagf
aaaaaaaagg
aaaaaaaahg
aaaaaaaahh
aaaaaaaaih
aaaaaaaaii
aaaaaaaaji
aaaaaaaajj
aaaaaaaakj
aaaaaaaakk
aaaaaaaalk
aaaaaaaall
aaaaaaaaml
aaaaaaaamm
aaaaaaaanm
aaaaaaaann
aaa...

result:

ok good solution