QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#511044 | #4237. Word Ladder | RngBased# | AC ✓ | 113ms | 4364kb | C++17 | 1.3kb | 2024-08-09 15:35:21 | 2024-08-09 15:35:21 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pdd pair<double, double>
#define F first
#define S second
#define all(x) x.begin(), x.end()
using namespace std;
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
vector<string> base;
string s = "aa";
for (int i = 0; i < 25; i++)
{
base.emplace_back(s);
s[1]++;
base.emplace_back(s);
s[0]++;
}
vector<string> res = base;
while (res.size() < 5000)
{
vector<string> nxt;
for (int i = 0; i < base.size(); i += 2)
{
for (auto s : res)
nxt.emplace_back(base[i] + s);
nxt.emplace_back(base[i + 1] + res.back());
reverse(all(res));
}
res.swap(nxt);
}
res.resize(5000);
for (int i = 0; i < 5000; i++)
for (int j = i + 2; j < 5000; j++)
{
int diff = 0;
for (int k = 0; k < res[i].size(); k++)
if (res[i][k] != res[j][k])
diff++;
assert(diff >= 2);
}
int n;
cin >> n;
for (int i = 0; i < n; i++)
cout << res[i] << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 62ms
memory: 4164kb
input:
5
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc
result:
ok good solution
Test #2:
score: 0
Accepted
time: 62ms
memory: 4312kb
input:
3
output:
aaaaaa aaaaab aaaabb
result:
ok good solution
Test #3:
score: 0
Accepted
time: 63ms
memory: 4236kb
input:
4
output:
aaaaaa aaaaab aaaabb aaaabc
result:
ok good solution
Test #4:
score: 0
Accepted
time: 58ms
memory: 4096kb
input:
6
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd
result:
ok good solution
Test #5:
score: 0
Accepted
time: 62ms
memory: 4180kb
input:
7
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd
result:
ok good solution
Test #6:
score: 0
Accepted
time: 60ms
memory: 4180kb
input:
8
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade
result:
ok good solution
Test #7:
score: 0
Accepted
time: 62ms
memory: 4312kb
input:
9
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee
result:
ok good solution
Test #8:
score: 0
Accepted
time: 62ms
memory: 4164kb
input:
10
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef
result:
ok good solution
Test #9:
score: 0
Accepted
time: 59ms
memory: 4172kb
input:
64
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 62ms
memory: 4020kb
input:
51
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #11:
score: 0
Accepted
time: 62ms
memory: 4108kb
input:
97
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 63ms
memory: 4196kb
input:
100
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 62ms
memory: 4168kb
input:
1000
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 62ms
memory: 4084kb
input:
1001
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 63ms
memory: 4364kb
input:
1024
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 62ms
memory: 4180kb
input:
1025
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 58ms
memory: 4200kb
input:
5000
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 62ms
memory: 4212kb
input:
4999
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 66ms
memory: 4020kb
input:
4096
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 97ms
memory: 4092kb
input:
4097
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 113ms
memory: 4216kb
input:
4098
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 58ms
memory: 4216kb
input:
3751
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef aaaaff aaaafg aaaagg aaaagh aaaahh aaaahi aaaaii aaaaij aaaajj aaaajk aaaakk aaaakl aaaall aaaalm aaaamm aaaamn aaaann aaaano aaaaoo aaaaop aaaapp aaaapq aaaaqq aaaaqr aaaarr aaaars aaaass aaaast aaaatt aaaatu aaaauu aaaauv aaaavv...
result:
ok good solution