QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#105446#4237. Word Laddermarsxiang5902AC ✓3ms3832kbC++171.2kb2023-05-14 04:12:052023-05-14 04:12:07

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-14 04:12:07]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:3832kb
  • [2023-05-14 04:12:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int MN = 5005, M = 10;

int N; vector<string> ans{"aaaaaaaaaa", "baaaaaaaaa"};

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);

    cin >> N;
    for (int i = 1; i < 5; i++) {
        vector<string> pv = ans;
        ans.clear();
        for (int j = 0; j < 25; j+=2) {
            vector<string> ns;
            ns.insert(ns.end(), pv.begin(), pv.end());
            for (int n = 0; n < ns.size(); n++)
                ns[n][i<<1] = ns[n][i<<1|1] = 'a'+j;
            ns.push_back(pv.back());
            ns.back()[i<<1] = 'a'+j+1;
            ns.back()[i<<1|1] = 'a'+j;
            int n = ns.size();
            ns.insert(ns.end(), pv.rbegin(), pv.rend());
            for (; n < ns.size(); n++)
                ns[n][i<<1] = ns[n][i<<1|1] = 'a'+j+1;
            if (j+2 < 25) {
                ns.push_back(ns.back());
                ns.back()[i<<1] = 'a'+j+2;
            }
            ans.insert(ans.end(), ns.begin(), ns.end());
            if (ans.size() >= N) break;
        }
        if (ans.size() >= N) break;
    }
    for (int i = 0; i < N; i++)
        printf("%s\n", ans[i].c_str());

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3464kb

input:

5

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa

result:

ok good solution

Test #2:

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

input:

3

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa

result:

ok good solution

Test #3:

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

input:

4

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa

result:

ok good solution

Test #4:

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

input:

6

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa

result:

ok good solution

Test #5:

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

input:

7

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa

result:

ok good solution

Test #6:

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

input:

8

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa

result:

ok good solution

Test #7:

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

input:

9

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa

result:

ok good solution

Test #8:

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

input:

10

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa

result:

ok good solution

Test #9:

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

input:

64

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #10:

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

input:

51

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #11:

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

input:

97

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #12:

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

input:

100

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #13:

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

input:

1000

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #14:

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

input:

1001

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #15:

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

input:

1024

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #16:

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

input:

1025

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #17:

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

input:

5000

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #18:

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

input:

4999

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #19:

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

input:

4096

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #20:

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

input:

4097

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #21:

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

input:

4098

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution

Test #22:

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

input:

3751

output:

aaaaaaaaaa
baaaaaaaaa
babaaaaaaa
babbaaaaaa
aabbaaaaaa
aacbaaaaaa
aaccaaaaaa
baccaaaaaa
badcaaaaaa
baddaaaaaa
aaddaaaaaa
aaedaaaaaa
aaeeaaaaaa
baeeaaaaaa
bafeaaaaaa
baffaaaaaa
aaffaaaaaa
aagfaaaaaa
aaggaaaaaa
baggaaaaaa
bahgaaaaaa
bahhaaaaaa
aahhaaaaaa
aaihaaaaaa
aaiiaaaaaa
baiiaaaaaa
bajiaaaaaa
baj...

result:

ok good solution