QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#784836 | #9726. AUS | Lonelyper | WA | 1ms | 3612kb | C++17 | 1.5kb | 2024-11-26 16:05:08 | 2024-11-26 16:05:12 |
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(s1[i] == s2[i]) continue;
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 = s2.size();
for(int i = 0; i < n; i ++){
if(s1[i] == s2[i]) continue;
if(vis[s2[i] - 'a']){
s2[i] = mp[s2[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;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3584kb
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: 3612kb
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: 1ms
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'