QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#51307 | #4237. Word Ladder | Amalgadon# | AC ✓ | 90ms | 7172kb | C++17 | 959b | 2022-10-01 17:21:01 | 2022-10-01 17:21:29 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
map<string,bool> mp[11];
bool check(string s)
{
for(int i=0;i<10;++i)
{
string t="";
for(int j=0;j<10;++j) if(i!=j) t+=s[j];
if(mp[i].count(t)) return false;
}
return true;
}
void store(string s)
{
for(int i=0;i<10;++i)
{
string t="";
for(int j=0;j<10;++j) if(i!=j) t+=s[j];
mp[i][t]=true;
}
}
int main()
{
int n; scanf("%d",&n);
string s="aaaaaaaaaa";
while(n--)
{
cout<<s<<endl;
string t=s;
bool f=true;
for(int i=0;f&&i<10;++i)
{
for(char c='a';f&&c<='z';++c) if(c!=t[i])
{
t[i]=c;
if(check(t))
{
f=false;
break;
}
t[i]=s[i];
}
}
store(s);
s=t;
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3764kb
input:
5
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa
result:
ok good solution
Test #2:
score: 0
Accepted
time: 2ms
memory: 3600kb
input:
3
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa
result:
ok good solution
Test #3:
score: 0
Accepted
time: 2ms
memory: 3676kb
input:
4
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa
result:
ok good solution
Test #4:
score: 0
Accepted
time: 2ms
memory: 3752kb
input:
6
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa
result:
ok good solution
Test #5:
score: 0
Accepted
time: 2ms
memory: 3764kb
input:
7
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa
result:
ok good solution
Test #6:
score: 0
Accepted
time: 2ms
memory: 3620kb
input:
8
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
9
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa
result:
ok good solution
Test #8:
score: 0
Accepted
time: 1ms
memory: 3684kb
input:
10
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa
result:
ok good solution
Test #9:
score: 0
Accepted
time: 4ms
memory: 3648kb
input:
64
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 3ms
memory: 3652kb
input:
51
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #11:
score: 0
Accepted
time: 4ms
memory: 3664kb
input:
97
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
100
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 15ms
memory: 4368kb
input:
1000
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 14ms
memory: 4468kb
input:
1001
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 13ms
memory: 4464kb
input:
1024
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 17ms
memory: 4396kb
input:
1025
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 90ms
memory: 7132kb
input:
5000
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 56ms
memory: 7172kb
input:
4999
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 38ms
memory: 6612kb
input:
4096
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 52ms
memory: 6496kb
input:
4097
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 61ms
memory: 6552kb
input:
4098
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 79ms
memory: 6308kb
input:
3751
output:
aaaaaaaaaa baaaaaaaaa bbaaaaaaaa cbaaaaaaaa ccaaaaaaaa dcaaaaaaaa ddaaaaaaaa edaaaaaaaa eeaaaaaaaa feaaaaaaaa ffaaaaaaaa gfaaaaaaaa ggaaaaaaaa hgaaaaaaaa hhaaaaaaaa ihaaaaaaaa iiaaaaaaaa jiaaaaaaaa jjaaaaaaaa kjaaaaaaaa kkaaaaaaaa lkaaaaaaaa llaaaaaaaa mlaaaaaaaa mmaaaaaaaa nmaaaaaaaa nnaaaaaaaa ona...
result:
ok good solution