QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#332307#5312. Levenshtein DistanceMCdycWA 0ms3612kbC++201.1kb2024-02-19 13:44:272024-02-19 13:44:27

Judging History

你现在查看的是最新测评结果

  • [2024-02-19 13:44:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-02-19 13:44:27]
  • 提交

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