QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#741447 | #9726. AUS | walili# | WA | 0ms | 3524kb | C++20 | 1.1kb | 2024-11-13 14:23:33 | 2024-11-13 14:23:37 |
Judging History
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'