QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#746485 | #9726. AUS | icesmoke | WA | 0ms | 3864kb | C++20 | 985b | 2024-11-14 14:47:38 | 2024-11-14 14:47:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 5;
void solve()
{
string s[3];
char v[26] = { 0 };
for (int i = 0; i < 3; i++) {
cin >> s[i];
}
if (s[0].size() != s[1].size()) {
cout << "NO\n";
return;
}
if (s[0].size() != s[2].size()) {
cout << "YES\n";
return;
}
int n = s[0].size();
for (int i = 0; i < n; i++) {
int c1 = s[0][i] - 'a';
int c2 = s[1][i] - 'a';
v[c1] |= (1 << c2) | (1 << c1);
v[c2] |= (1 << c2) | (1 << c1);
}
int cnt = 0;
for (int i = 0; i < n; i++) {
int c1 = s[0][i] - 'a';
int c3 = s[2][i] - 'a';
cnt += v[c1] == v[c3];
}
cout << (cnt == n ? "NO" : "YES") << '\n';
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
int T = 1;
cin >> T;
while (T--) {
solve();
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3552kb
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: 3864kb
input:
10 ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...
output:
YES YES NO YES YES YES YES YES YES YES
result:
wrong answer 1st lines differ - expected: 'NO', found: 'YES'