QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#847995 | #4237. Word Ladder | mon_de2738# | AC ✓ | 3ms | 5908kb | C++14 | 1.5kb | 2025-01-08 14:28:32 | 2025-01-08 14:28:32 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull=unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
#define endl '\n'
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define sz(v) ((int)(v).size())
#define all(v) v.begin(), v.end()
using tpl=tuple<int,int,int>;
using namespace std;
char arr[60][2];
int n;
vector <string> v,temp;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=0;i<25;i++)
{
arr[2*i][0]='a'+i;
arr[2*i][1]='a'+i;
arr[2*i+1][0]='a'+i;
arr[2*i+1][1]='a'+i+1;
}
v.push_back("");
while(v.size()<n)
{
for(int i=0;i+3<50;i+=4)
{
string tempp;
for(int j=0;j<v.size();j++)
{
tempp=v[j];
temp.push_back(tempp.append(arr[i],2));
}
tempp=v[v.size()-1];
temp.push_back(tempp.append(arr[i+1],2));
for(int j=0;j<v.size();j++)
{
tempp=v[v.size()-1-j];
temp.push_back(tempp.append(arr[i+2],2));
}
tempp=v[0];
temp.push_back(tempp.append(arr[i+3],2));
}
v.clear();
for(int i=0;i<temp.size();i++)
v.push_back(temp[i]);
temp.clear();
}
for(int i=0;i<n;i++)
cout<<v[i]<<'\n';
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
input:
5
output:
aa ab bb bc cc
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
3
output:
aa ab bb
result:
ok good solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3800kb
input:
4
output:
aa ab bb bc
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
6
output:
aa ab bb bc cc cd
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
7
output:
aa ab bb bc cc cd dd
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3608kb
input:
8
output:
aa ab bb bc cc cd dd de
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3780kb
input:
9
output:
aa ab bb bc cc cd dd de ee
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
10
output:
aa ab bb bc cc cd dd de ee ef
result:
ok good solution
Test #9:
score: 0
Accepted
time: 1ms
memory: 3624kb
input:
64
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
51
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb
result:
ok good solution
Test #11:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
97
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
100
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
1000
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 1ms
memory: 3644kb
input:
1001
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
1024
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 1ms
memory: 3904kb
input:
1025
output:
aaaa abaa bbaa bcaa ccaa cdaa ddaa deaa eeaa efaa ffaa fgaa ggaa ghaa hhaa hiaa iiaa ijaa jjaa jkaa kkaa klaa llaa lmaa mmaa mnaa nnaa noaa ooaa opaa ppaa pqaa qqaa qraa rraa rsaa ssaa staa ttaa tuaa uuaa uvaa vvaa vwaa wwaa wxaa xxaa xyaa xyab xybb xxbb wxbb wwbb vwbb vvbb uvbb uubb tubb ttbb stbb ...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 0ms
memory: 5800kb
input:
5000
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 3ms
memory: 5908kb
input:
4999
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 0ms
memory: 5784kb
input:
4096
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 3ms
memory: 5900kb
input:
4097
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 3ms
memory: 5796kb
input:
4098
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 3ms
memory: 5832kb
input:
3751
output:
aaaaaa abaaaa bbaaaa bcaaaa ccaaaa cdaaaa ddaaaa deaaaa eeaaaa efaaaa ffaaaa fgaaaa ggaaaa ghaaaa hhaaaa hiaaaa iiaaaa ijaaaa jjaaaa jkaaaa kkaaaa klaaaa llaaaa lmaaaa mmaaaa mnaaaa nnaaaa noaaaa ooaaaa opaaaa ppaaaa pqaaaa qqaaaa qraaaa rraaaa rsaaaa ssaaaa staaaa ttaaaa tuaaaa uuaaaa uvaaaa vvaaaa...
result:
ok good solution