QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#737569#9726. AUSqianchen06#WA 1ms3864kbC++141.3kb2024-11-12 16:15:522024-11-12 16:15:53

Judging History

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

  • [2024-11-12 16:15:53]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3864kb
  • [2024-11-12 16:15:52]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve()
{
    string a, b, c;
    cin >> a >> b >> c;
    if (a.length() != b.length())
    {
        cout << "NO" << '\n';
        return;
    }
    map<char, char> mp;
    for (auto &x : a)
    {
        mp[x] = x;
    }
    assert(a.length() == b.length());
    for (int i = 0; i < a.length(); i++)
    {
        if (!mp.count(b[i]))
            mp[b[i]] = a[i];
        else
        {
            if (mp[b[i]] == a[i])
                continue;
            else
            {
                cout << "NO" << '\n';
                return;
            }
        }
    }
    if (a.length() != c.length())
    {
        cout << "YES" << '\n';
        return;
    }
    for (int i = 0; i < c.length(); i++)
    {
        if (mp.count(c[i]))
        {
            if (mp[c[i]] != a[i])
            {
                cout << "YES" << '\n';
                return;
            }
        }
        else
        {
            cout << "YES" << '\n';
            return;
        }
    }
    cout << "NO" << '\n';
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3548kb

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: 0
Accepted
time: 1ms
memory: 3864kb

input:

10
ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 10 lines

Test #3:

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

input:

100
dntfvviytogwqljvoksaovstrqwpovkncxvmytnvcaoikctmgukaxlivmwahenydtswyowpdvggeeyzykdiojltpxuzzwphdqfsh
anbbtriynochhmrtsmjifvatlfsmwiimvxbmyoavcmfiioxatckaxcikmwazenjmdleyjwndvggqkazikdeofaqpbuzkupshfhgh
anbflviytfylqlpvvmjaovajllwpoukmvwemgtivvaonkoxagukaxriyuvmypnymtdqyocpdvcgqkazykrihjbipxquzup...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

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