QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#655559 | #4237. Word Ladder | chuchu# | AC ✓ | 218ms | 3988kb | C++14 | 670b | 2024-10-19 08:24:49 | 2024-10-19 08:24:50 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(32);
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
string s = string(10, 'a');
vector<string> ans;
ans.push_back(s);
for(int i = 0; i < n - 1; i++){
for(int k = 0; k < 10; k++){
string t = s;
int v = ((t[k] - 'a') + 1 + (rng() % 25)) % 26;
t[k] = (char)('a' + v);
int ok = 1;
for(int j = 0; j < i; j++){
int cnt = 0;
for(int l = 0; l < 10; l++) if(ans[j][l] != t[l]) cnt++;
if(cnt == 1){
ok = 0;
break;
}
}
if(ok){
ans.push_back(t);
s = t;
break;
}
}
}
for(string x : ans) cout << x << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3604kb
input:
5
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa
result:
ok good solution
Test #2:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
3
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa
result:
ok good solution
Test #3:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
4
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa
result:
ok good solution
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
6
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa
result:
ok good solution
Test #5:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
7
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa
result:
ok good solution
Test #6:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
8
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa
result:
ok good solution
Test #7:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
9
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa
result:
ok good solution
Test #8:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
10
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa
result:
ok good solution
Test #9:
score: 0
Accepted
time: 0ms
memory: 3860kb
input:
64
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #10:
score: 0
Accepted
time: 0ms
memory: 3520kb
input:
51
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #11:
score: 0
Accepted
time: 1ms
memory: 3652kb
input:
97
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #12:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
100
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #13:
score: 0
Accepted
time: 9ms
memory: 3924kb
input:
1000
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #14:
score: 0
Accepted
time: 9ms
memory: 3852kb
input:
1001
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #15:
score: 0
Accepted
time: 6ms
memory: 3700kb
input:
1024
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #16:
score: 0
Accepted
time: 9ms
memory: 3888kb
input:
1025
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #17:
score: 0
Accepted
time: 218ms
memory: 3704kb
input:
5000
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #18:
score: 0
Accepted
time: 216ms
memory: 3704kb
input:
4999
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #19:
score: 0
Accepted
time: 151ms
memory: 3760kb
input:
4096
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #20:
score: 0
Accepted
time: 147ms
memory: 3708kb
input:
4097
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #21:
score: 0
Accepted
time: 147ms
memory: 3988kb
input:
4098
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution
Test #22:
score: 0
Accepted
time: 123ms
memory: 3960kb
input:
3751
output:
aaaaaaaaaa laaaaaaaaa loaaaaaaaa koaaaaaaaa kozaaaaaaa bozaaaaaaa bwzaaaaaaa zwzaaaaaaa zgzaaaaaaa tgzaaaaaaa tkzaaaaaaa jkzaaaaaaa jzzaaaaaaa gzzaaaaaaa gnzaaaaaaa anzaaaaaaa ahzaaaaaaa ahiaaaaaaa dhiaaaaaaa dyiaaaaaaa gyiaaaaaaa gwiaaaaaaa pwiaaaaaaa pbiaaaaaaa pbgaaaaaaa nbgaaaaaaa nygaaaaaaa nyd...
result:
ok good solution