QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#746209 | #9726. AUS | the_fool# | WA | 1ms | 3780kb | C++20 | 1.0kb | 2024-11-14 13:51:09 | 2024-11-14 13:51:18 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void solve() {
string a, b, c;
cin >> a >> b >> c;
if (a.size() != b.size()) {
cout << "NO\n";
return;
}
if (b == c) {
cout << "NO\n";
return;
}
if (a.size() != c.size()) {
cout << "YES\n";
return;
}
int n = a.size();
set<int> p[26];
for (int i = 0; i < n; i++) {
char x = a[i], y = b[i];
p[x - 'a'].emplace(y - 'a');
p[y - 'a'].emplace(x - 'a');
}
for (int i = 0; i < n ;i++) {
int x = a[i] - 'a', y = c[i] - 'a';
if (x == y) continue;
if (p[x].contains(y)) {
continue;
}
cout << "YES\n";
return;
}
cout << "NO\n";
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1;
cin >> t;
while (t--) {
solve();
}
}
/*
4
abab
cdcd
abce
abab
cdcd
abcd
abab
cdcd
abc
x
yz
def
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3756kb
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: 1ms
memory: 3780kb
input:
10 ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...
output:
YES YES NO YES YES YES YES YES YES YES
result:
wrong answer 1st lines differ - expected: 'NO', found: 'YES'