QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#54919 | #4237. Word Ladder | KING_UT# | AC ✓ | 3ms | 3940kb | C++20 | 528b | 2022-10-11 17:15:58 | 2022-10-11 17:15:58 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
char nxt(char c){
if(c=='z') return 'a';
return c+1;
}
int main(){
string S="";
int L=10;
for(int i=0;i<L;i++) S+="a";
vector <string> vec;
vec.push_back(S);
for(int i=0;i<26;i++){
for(int j=0;j<25;j++){
for(int k=0;k<L-2;k++){
S[k]=nxt(S[k]);
vec.push_back(S);
}
}
if(i+1<26){
S[L-2]=nxt(S[L-2]);
vec.push_back(S);
S[L-1]=nxt(S[L-1]);
vec.push_back(S);
}
}
int n;
scanf("%d",&n);
for(int i=0;i<n;i++) printf("%s\n",vec[i].c_str());
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3852kb
input:
5
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa
result:
ok good solution
Test #2:
score: 0
Accepted
time: 3ms
memory: 3784kb
input:
3
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa
result:
ok good solution
Test #3:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
4
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa
result:
ok good solution
Test #4:
score: 0
Accepted
time: 3ms
memory: 3940kb
input:
6
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa
result:
ok good solution
Test #5:
score: 0
Accepted
time: 3ms
memory: 3708kb
input:
7
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa
result:
ok good solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
8
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa
result:
ok good solution
Test #7:
score: 0
Accepted
time: 2ms
memory: 3936kb
input:
9
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa
result:
ok good solution
Test #8:
score: 0
Accepted
time: 3ms
memory: 3784kb
input:
10
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa
result:
ok good solution
Test #9:
score: 0
Accepted
time: 2ms
memory: 3848kb
input:
64
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 3ms
memory: 3852kb
input:
51
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #11:
score: 0
Accepted
time: 2ms
memory: 3788kb
input:
97
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 2ms
memory: 3852kb
input:
100
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1000
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 0ms
memory: 3924kb
input:
1001
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 2ms
memory: 3840kb
input:
1024
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 2ms
memory: 3940kb
input:
1025
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 3ms
memory: 3828kb
input:
5000
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 3ms
memory: 3832kb
input:
4999
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
4096
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 3ms
memory: 3936kb
input:
4097
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 3ms
memory: 3940kb
input:
4098
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 2ms
memory: 3920kb
input:
3751
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa bbbaaaaaaa bbbbaaaaaa bbbbbaaaaa bbbbbbaaaa bbbbbbbaaa bbbbbbbbaa cbbbbbbbaa ccbbbbbbaa cccbbbbbaa ccccbbbbaa cccccbbbaa ccccccbbaa cccccccbaa ccccccccaa dcccccccaa ddccccccaa dddcccccaa ddddccccaa dddddcccaa ddddddccaa dddddddcaa ddddddddaa edddddddaa eeddddddaa eee...
result:
ok good solution