QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#741447#9726. AUSwalili#WA 0ms3524kbC++201.1kb2024-11-13 14:23:332024-11-13 14:23:37

Judging History

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

  • [2024-11-13 14:23:37]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3524kb
  • [2024-11-13 14:23:33]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'
const ll inf= 1e17;
const ll mod = 998244353;
void oper(ll testcase) {
    string a, b, c;
    cin >> a >> b >> c;
    if (a.length() != b.length())
    {
        cout << "NO\n";
        return;
    }
    vector<int> groups(26);
    for (int i = 0; i < 26; ++i)
        groups[i] = i;
    for (int i = 0; i < (int)a.length(); ++i)
    {
        int x = 0, y = 0;
        x = a[i] - 'a';
        y = b[i] - 'a';
        if (x > y)
            swap(x, y); // x <= y
        groups[y] = groups[x];
    }
    for (int i = 0; i < 26; ++i)
        groups[i] = groups[groups[i]];
    if (a.length() != c.length())
    {
        cout << "YES\n";
        return;
    }
    for (int i = 0; i < (int)a.length(); ++i)
        if (groups[a[i] - 'a'] != groups[c[i] - 'a'])
        {
            cout << "YES\n";
            return;
        }
    cout << "NO\n";
}

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    ll ttt = 1;
    cin >> ttt;
    for (ll i = 1; i <= ttt; i++) {
        oper(i);
    }
}

詳細信息

Test #1:

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

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: 3488kb

input:

10
ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...

output:

NO
NO
NO
NO
NO
NO
NO
NO
YES
NO

result:

wrong answer 9th lines differ - expected: 'NO', found: 'YES'