QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#746485#9726. AUSicesmokeWA 0ms3864kbC++20985b2024-11-14 14:47:382024-11-14 14:47:38

Judging History

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

  • [2024-11-14 14:47:38]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3864kb
  • [2024-11-14 14:47:38]
  • 提交

answer

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

#define int long long

const int N = 1e6 + 5;

void solve()
{
    string s[3];
    char v[26] = { 0 };
    for (int i = 0; i < 3; i++) {
        cin >> s[i];
    }
    if (s[0].size() != s[1].size()) {
        cout << "NO\n";
        return;
    }
    if (s[0].size() != s[2].size()) {
        cout << "YES\n";
        return;
    }
    int n = s[0].size();
    for (int i = 0; i < n; i++) {
        int c1 = s[0][i] - 'a';
        int c2 = s[1][i] - 'a';
        v[c1] |= (1 << c2) | (1 << c1);
        v[c2] |= (1 << c2) | (1 << c1);
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        int c1 = s[0][i] - 'a';
        int c3 = s[2][i] - 'a';
        cnt += v[c1] == v[c3];
    }
    cout << (cnt == n ? "NO" : "YES") << '\n';
}

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.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: 3552kb

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

input:

10
ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES

result:

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