QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#801125#9726. AUSProaesWA 1ms3840kbC++11778b2024-12-06 18:29:572024-12-06 18:29:58

Judging History

你现在查看的是最新测评结果

  • [2024-12-06 18:29:58]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3840kb
  • [2024-12-06 18:29:57]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define For(i,a,b) for(int i=(a);i<=(b);i++)
const int N=1005;
char s1[N],s2[N],s3[N];
int bcj[26];
int ask(int x){return bcj[x]?bcj[x]=ask(bcj[x]):x;}
void Main()
{
    scanf("%s",s1);
    scanf("%s",s2);
    scanf("%s",s3);
    int n=strlen(s1),n2=strlen(s2),n3=strlen(s3);
    if(n2!=n){printf("NO\n"); return;}
    if(n3!=n){printf("YES\n"); return;}
    fill(bcj,bcj+26,0);
    For(i,0,n-1)
    {
        int x=ask(s1[i]-'a'),y=ask(s2[i]-'a');
        if(x!=y)bcj[x]=y;
    }
    For(i,0,n-1)
        if(ask(s1[i]-'a')!=ask(s3[i]-'a'))
        {
            printf("YES\n");
            return;
        }
    printf("NO\n");
}
int main()
{
    int t;
    scanf("%d",&t);
    while(t--)Main();
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3840kb

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: 3780kb

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: 3836kb

input:

100
dntfvviytogwqljvoksaovstrqwpovkncxvmytnvcaoikctmgukaxlivmwahenydtswyowpdvggeeyzykdiojltpxuzzwphdqfsh
anbbtriynochhmrtsmjifvatlfsmwiimvxbmyoavcmfiioxatckaxcikmwazenjmdleyjwndvggqkazikdeofaqpbuzkupshfhgh
anbflviytfylqlpvvmjaovajllwpoukmvwemgtivvaonkoxagukaxriyuvmypnymtdqyocpdvcgqkazykrihjbipxquzup...

output:

YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO...

result:

wrong answer 6th lines differ - expected: 'NO', found: 'YES'