QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#785693#9726. AUSxyggzsf#WA 0ms3648kbC++141.6kb2024-11-26 18:50:042024-11-26 18:50:07

Judging History

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

  • [2024-11-26 18:50:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3648kb
  • [2024-11-26 18:50:04]
  • 提交

answer

#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
#define int    long long 
typedef pair<int, int>pii;
typedef pair<char, int>pci;
typedef pair<int, pii>piii;
const int mod = 998244353;
const int N = 5e5 + 100;
int ksm(int a, int b) { if (a == 0 && b == 0)return 1; int ans = 1; while (b) { if (b % 2)ans = (ans * a) % mod; a = (a * a) % mod; b >>= 1; }return ans; }
int sqrtt(int x) { int l = 0, r = 3e9; while (l < r) { int mid = (l + r + 1) >> 1; if (mid * mid == x)return mid; else if (mid * mid > x)r = mid - 1; else l = mid; }return l; }


void solve()
{
    string a, b, c; cin >> a >> b >> c;
    if (a.size() != b.size())cout << "NO" << endl;
    else
    {
        if (a.size() != c.size())
        {
            cout << "YES" << endl;
            return;
        }

        map<char, char>ct;

        for (int i = 0; i < a.size(); i++)
        {
            if (ct.count(a[i]))
            {
                if (ct[a[i]] != b[i])
                {
                    cout << "NO" << endl;
                    return;
                }
            }
            else
            {
                ct[a[i]] = b[i];
            }
        }


        for(int i=0;i<c.size();i++)
        {
            if (ct.count(c[i]))
            {
                c[i] = ct[c[i]];
           }
        }
        if (c == b)
        {
            cout << "NO" << endl;
            return;
        }
        cout << "YES" << endl;
    }
}

signed main()
{

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

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0ms
memory: 3524kb

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: 0ms
memory: 3648kb

input:

100
dntfvviytogwqljvoksaovstrqwpovkncxvmytnvcaoikctmgukaxlivmwahenydtswyowpdvggeeyzykdiojltpxuzzwphdqfsh
anbbtriynochhmrtsmjifvatlfsmwiimvxbmyoavcmfiioxatckaxcikmwazenjmdleyjwndvggqkazikdeofaqpbuzkupshfhgh
anbflviytfylqlpvvmjaovajllwpoukmvwemgtivvaonkoxagukaxriyuvmypnymtdqyocpdvcgqkazykrihjbipxquzup...

output:

YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
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
YES
NO
NO
...

result:

wrong answer 2nd lines differ - expected: 'YES', found: 'NO'