QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#370069 | #4237. Word Ladder | InfinityNS# | AC ✓ | 3ms | 4056kb | C++14 | 875b | 2024-03-28 21:39:08 | 2024-03-28 21:39:08 |
Judging History
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;
}
}
Details
Tip: Click on the bar to expand more detailed information
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