QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#738372 | #9726. AUS | HUY1# | WA | 2ms | 3816kb | C++20 | 900b | 2024-11-12 18:53:30 | 2024-11-12 18:53:32 |
Judging History
answer
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
#define endl '\n'
#define MAXN 200005
void solve()
{
string s1, s2, s3;
cin >> s1 >> s2 >> s3;
if (s1.size() != s2.size()) {
cout << "NO" << endl;
return;
}
if (s1.size() != s3.size()) {
cout << "YES" << endl;
return;
}
map<pair<char, char>, bool> mp;
for (int i = 0; i < s1.size(); i++) {
mp[{s1[i], s2[i]}] = 1;
mp[{s2[i], s1[i]}] = 1;
}
for (int i = 0; i < s1.size(); i++) {
if (s3[i] != s1[i] && s3[i] != s2[i] && !mp[{s2[i], s3[i]}] && !mp[{s3[i], s2[i]}]) {
cout << "YES" << endl;
return;
}
}
cout << "NO" << endl;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while (t--) {
solve();
}
return 0;
}
/*
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: 3548kb
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: 2ms
memory: 3816kb
input:
10 ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...
output:
YES YES NO YES YES YES YES YES YES YES
result:
wrong answer 1st lines differ - expected: 'NO', found: 'YES'