QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#784761 | #9726. AUS | Lonelyper | WA | 0ms | 3684kb | C++17 | 1.3kb | 2024-11-26 15:54:00 | 2024-11-26 15:54:22 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int>PII;
#define endl '\n'
#define x first
#define y second
const int N = 2e5 + 10;
const LL INF = 1e18, mod = 1e9 + 7;
mt19937_64 rng(chrono::system_clock::now().time_since_epoch().count());
string s1, s2, s3;
void Lonelyper(){
cin >> s1 >> s2 >> s3;
map<char, char> mp;
vector<int> vis(27);
if(s1.size() != s2.size() || s2 == s3){
cout << "NO" << endl;
return;
}
int n = s1.size();
for(int i = 0; i < n; i ++){
if(vis[s1[i] - 'a'] && mp[s1[i]] != s2[i]){
cout << "NO" << endl;
return;
}
vis[s1[i] - 'a'] = 1;
mp[s1[i]] = s2[i];
s1[i] = mp[s1[i]];
}
n = s3.size();
for(int i = 0; i < n; i ++){
if(vis[s3[i] - 'a']){
s3[i] = mp[s3[i]];
}
}
// cout << mp['a'] << ' ' << mp['b'] << endl;
// cout << s1 << endl << s2 << endl << s3 << endl;
if(s1 == s2 && s1 != s3) cout << "YES" << endl;
else cout << "NO" << endl;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while(t --) {
Lonelyper();
}
return 0;
}
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: 0
Accepted
time: 0ms
memory: 3684kb
input:
10 ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
100 dntfvviytogwqljvoksaovstrqwpovkncxvmytnvcaoikctmgukaxlivmwahenydtswyowpdvggeeyzykdiojltpxuzzwphdqfsh anbbtriynochhmrtsmjifvatlfsmwiimvxbmyoavcmfiioxatckaxcikmwazenjmdleyjwndvggqkazikdeofaqpbuzkupshfhgh anbflviytfylqlpvvmjaovajllwpoukmvwemgtivvaonkoxagukaxriyuvmypnymtdqyocpdvcgqkazykrihjbipxquzup...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO
result:
wrong answer 1st lines differ - expected: 'YES', found: 'NO'