QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#768414#9726. AUSTauLee01#WA 1ms3872kbC++23964b2024-11-21 10:18:172024-11-21 10:18:17

Judging History

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

  • [2024-11-21 10:18:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3872kb
  • [2024-11-21 10:18:17]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define inf 0x3f3f3f3f3f3f3f3f

const int maxn = 1e5 + 10;
const int mod = 1e9 + 7;

void solve()
{
    string s1, s2, s3;
    cin >> s1 >> s2 >> s3;
    map<int, int> mp;
    if (s1.size() != s2.size())
    {
        cout << "NO" << endl;
        return;
    }
    if (s1.size() != s3.size())
    {
        cout << "YES" << endl;
        return;
    }
    int n = s1.size();
    int cnt = 1;
    for (int i = 0; i < n; i++)
    {
        mp[s1[i]] = mp[s2[i]] = ++cnt;
    }
    for (int i = 0; i < n; i++)
    {
        if (!mp[s3[i]] || mp[s3[i]] != mp[s1[i]])
        {
            cout << "YES" << endl;
            return;
        }
    }
    cout << "NO" << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
        solve();
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3556kb

input:

4
abab
cdcd
abce
abab
cdcd
abcd
abab
cdcd
abc
x
yz
def

output:

YES
NO
YES
NO

result:

ok 4 lines

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 3872kb

input:

10
ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES

result:

wrong answer 1st lines differ - expected: 'NO', found: 'YES'