QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#524329 | #4237. Word Ladder | LittleCube | AC ✓ | 2ms | 4360kb | C++17 | 955b | 2024-08-19 15:50:03 | 2024-08-19 15:50:04 |
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;
for (int i = 1; i <= 50; i++)
{
string s = "aa";
s[0] += (i - 1) / 2;
s[1] += i / 2;
base.emplace_back(s);
}
vector<string> sol = base;
while (sol.size() <= 5000)
{
vector<string> nxt;
for (int i = 0; i < 50; i += 2)
{
for (auto s : sol)
nxt.emplace_back(base[i] + s);
nxt.emplace_back(base[i + 1] + sol.back());
reverse(all(sol));
}
sol.swap(nxt);
}
int N;
cin >> N;
for (int i = 0; i < N; i++)
cout << sol[i] << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 4080kb
input:
5
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 4020kb
input:
3
output:
aaaaaa aaaaab aaaabb
result:
ok good solution
Test #3:
score: 0
Accepted
time: 2ms
memory: 4360kb
input:
4
output:
aaaaaa aaaaab aaaabb aaaabc
result:
ok good solution
Test #4:
score: 0
Accepted
time: 2ms
memory: 4180kb
input:
6
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd
result:
ok good solution
Test #5:
score: 0
Accepted
time: 2ms
memory: 4100kb
input:
7
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd
result:
ok good solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 4100kb
input:
8
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 4216kb
input:
9
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee
result:
ok good solution
Test #8:
score: 0
Accepted
time: 2ms
memory: 4104kb
input:
10
output:
aaaaaa aaaaab aaaabb aaaabc aaaacc aaaacd aaaadd aaaade aaaaee aaaaef
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 4356kb
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: 2ms
memory: 4176kb
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: 0ms
memory: 4024kb
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: 2ms
memory: 4100kb
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: 2ms
memory: 4176kb
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: 2ms
memory: 4184kb
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: 2ms
memory: 4184kb
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: 2ms
memory: 4360kb
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: 2ms
memory: 4360kb
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: 2ms
memory: 4140kb
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: 2ms
memory: 4116kb
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: 2ms
memory: 4104kb
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: 2ms
memory: 4112kb
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: 2ms
memory: 4152kb
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