QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#332307 | #5312. Levenshtein Distance | MCdyc | WA | 0ms | 3612kb | C++20 | 1.1kb | 2024-02-19 13:44:27 | 2024-02-19 13:44:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
// #define int long long
int solve()
{
string p;
cin >> p;
set<string> ans;
string tmp;
string s;
cin >> s;
ans.insert(s);
int n = s.size();
for (int i = 0; i < n; i++)
{
for (int j = 0; j < p.size(); j++)
{
ans.insert(s.substr(0, i) + p.substr(j, 1) + s.substr(i));
}
}
for (int i = 0; i < p.size(); i++)
{
ans.insert(s + p.substr(i, 1));
}
for (int i = 0; i < n; i++)
{
ans.insert(s.substr(0, i) + s.substr(i + 1));
for (int j = 0; j < p.size(); j++)
{
if (tmp[i] == p[j])
{
continue;
}
ans.insert(s.substr(0, i) + p.substr(j, 1) + s.substr(i + 1));
}
}
ans.erase(s);
for (auto it : ans)
cout << it << "\n";
return 0;
}
signed main()
{
int test = 1;
// cin >> test;
while (test--)
{
solve();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3612kb
input:
4 aaa aabbaab
output:
4aa 4aaa a4a a4aa aa aa4 aa4a aaa4
result:
wrong output format Expected integer, but "4aa" found