QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#33785#4237. Word Ladder4fecta#AC ✓3ms3836kbC++1.4kb2022-06-05 06:40:192022-06-05 06:40:20

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-05 06:40:20]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3836kb
  • [2022-06-05 06:40:19]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)

const int MN = 5005;
vector<string> v;
string cur = "aaaaa", suf = "aaaaa";

void gen() {
    if (cur == "aaaaa") {
        //v.push_back(cur + suf);
        for (int i = 1; i < 26; i++) {
            for (int j = 0; j < 5; j++) {
                cur[j] = (char) ('a' + i);
                v.push_back(cur + suf);
            }
        }
    } else {
        //v.push_back(cur + suf);
        for (int i = 24; i >= 0; i--) {
            for (int j = 0; j < 5; j++) {
                cur[j] = (char) ('a' + i);
                v.push_back(cur + suf);
            }
        }
    }
}

int32_t main() {
    boost();

    gen();
    for (int i = 1; i < 26; i++) {
        for (int j = 0; j < 2; j++) {
            suf[j] = (char) ('a' + i);
            v.push_back(cur + suf);
        }
        gen();
        for (int j = 2; j < 5; j++) {
            suf[j] = (char) ('a' + i);
            v.push_back(cur + suf);
        }
        gen();
    }
    //printf("%lld\n", v.size());
    //for (string s : v) printf("%s\n", s.c_str());
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        printf("%s\n", v[i].c_str());
    }

    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 3832kb

input:

5

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa

result:

ok good solution

Test #2:

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

input:

3

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa

result:

ok good solution

Test #3:

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

input:

4

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa

result:

ok good solution

Test #4:

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

input:

6

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa

result:

ok good solution

Test #5:

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

input:

7

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa

result:

ok good solution

Test #6:

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

input:

8

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa

result:

ok good solution

Test #7:

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

input:

9

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa

result:

ok good solution

Test #8:

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

input:

10

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa

result:

ok good solution

Test #9:

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

input:

64

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #10:

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

input:

51

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #11:

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

input:

97

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #12:

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

input:

100

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #13:

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

input:

1000

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #14:

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

input:

1001

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #15:

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

input:

1024

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #16:

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

input:

1025

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #17:

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

input:

5000

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #18:

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

input:

4999

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #19:

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

input:

4096

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #20:

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

input:

4097

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #21:

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

input:

4098

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution

Test #22:

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

input:

3751

output:

baaaaaaaaa
bbaaaaaaaa
bbbaaaaaaa
bbbbaaaaaa
bbbbbaaaaa
cbbbbaaaaa
ccbbbaaaaa
cccbbaaaaa
ccccbaaaaa
cccccaaaaa
dccccaaaaa
ddcccaaaaa
dddccaaaaa
ddddcaaaaa
dddddaaaaa
eddddaaaaa
eedddaaaaa
eeeddaaaaa
eeeedaaaaa
eeeeeaaaaa
feeeeaaaaa
ffeeeaaaaa
fffeeaaaaa
ffffeaaaaa
fffffaaaaa
gffffaaaaa
ggfffaaaaa
ggg...

result:

ok good solution