QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750209 | #9726. AUS | 552Hz# | AC ✓ | 2ms | 3836kb | C++17 | 1.4kb | 2024-11-15 13:25:23 | 2024-11-15 13:25:23 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define debug(x) cout<<#x<<": "<<x<<endl
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll=long long;
using ull=unsigned long long;
void solve(){
string a,b,c;
cin>>a>>b>>c;
if(a.size()!=b.size()){
cout<<"NO"<<endl;
return;
}
vector<int> f(26);
for(int i=0;i<26;i++)
f[i]=i;
auto get=[&](int x){
while(x!=f[x])
x=f[x]=f[f[x]];
return x;
};
auto merge=[&](int x,int y)->void{
x=get(x),y=get(y);
if(x==y)
return;
f[y]=x;
};
for(int i=0;i<a.size();i++){
if(a[i]!=b[i]){
int x=a[i]-'a',y=b[i]-'a';
merge(x,y);
}
}
if(c.size()!=a.size()){
cout<<"YES"<<endl;
return;
}
for(int i=0;i<a.size();i++){
int cur=a[i]-'a';
cur=get(cur);
a[i]='a'+cur;
}
for(int i=0;i<c.size();i++){
int cur=c[i]-'a';
cur=get(cur);
c[i]='a'+cur;
}
if(a==c)
cout<<"NO"<<endl;
else
cout<<"YES"<<endl;
}
signed main(){
ios::sync_with_stdio(0);
cout.tie(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
solve();
}
}
/*
贡献法
正难则反
数小状压
关系连边
拆位
广义单调性
最长转最短
*/
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3616kb
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: 1ms
memory: 3604kb
input:
10 ekkzjwextuoazxsosiiiditwrjiztfvxtzaztmdfhxroaqkjcdgsgiitkfglcrtgjquspjyjtodyhxetldbhvxampcvbinzgksxkunduhvbddakqswurshbnuazthfnxmsuyypznmxmatsnvpqovscnkkcjphtcmcsqteeikwggnugskjjwttvlrxmmrkyltxjhfiqicttcfumurdrmiqauruywgdomxxpbeunliyvsutrneexoyckjflhnmmaaovxubnptlemptxbhrflbnfcowktydgbugdxvkvegza...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #3:
score: 0
Accepted
time: 1ms
memory: 3628kb
input:
100 dntfvviytogwqljvoksaovstrqwpovkncxvmytnvcaoikctmgukaxlivmwahenydtswyowpdvggeeyzykdiojltpxuzzwphdqfsh anbbtriynochhmrtsmjifvatlfsmwiimvxbmyoavcmfiioxatckaxcikmwazenjmdleyjwndvggqkazikdeofaqpbuzkupshfhgh anbflviytfylqlpvvmjaovajllwpoukmvwemgtivvaonkoxagukaxriyuvmypnymtdqyocpdvcgqkazykrihjbipxquzup...
output:
YES YES NO NO NO NO NO NO NO YES NO NO YES NO NO 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 NO NO YES NO NO YES NO NO YES NO NO NO YES NO NO YES NO NO YES YES NO YES NO NO NO YES NO NO NO YES YES YES NO YES NO NO YES NO NO NO NO NO NO...
result:
ok 100 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
1000 armvnnqped esmswdspfz czwpnnqpfz tynubfwity tygubajvty tygrqagvty fzhbxdpubn jxqbvdpumd jbhbokpuld smlbevdsjj rmkbevzujj rmkbevdsfd hrojqfcpy qpojqjcpyu erojqfmnsu ywcdpimkgf xwtdexmegf pwgdpckkg miotgaeyif mnmigmlljc ynmtcapyip oziodvpjza ofikevppqr omikuppgza stgwxovhmv jtumxonqcp jogmvouqmv ...
output:
YES YES YES YES NO YES YES YES YES NO YES YES NO NO NO YES YES YES NO YES YES YES NO YES YES YES YES NO YES YES YES NO NO NO YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES ...
result:
ok 1000 lines
Test #5:
score: 0
Accepted
time: 2ms
memory: 3756kb
input:
10000 b e a o o l w z w r s r g i m n g g o u u p p p g g g z x x z z m a a z e j d e m e q a t p f p e z h u w u x x n e m e f f c r j r u o r f f f j e n w x m f h f i q w e e w s r m r r o o j l b b w x x z s x x g v s h j j h h d h j j c d t z v v q v n j j q m z w p p s d c l c c c l s a r a m ...
output:
YES YES NO NO YES NO NO NO NO NO YES YES YES NO YES NO YES NO YES NO YES NO YES NO YES YES NO YES YES YES YES YES YES YES NO YES NO YES NO YES NO YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES NO YES YES NO NO YES NO YES YES YES YES NO YES YES YES NO NO YES YES NO NO NO NO NO YES NO YES Y...
result:
ok 10000 lines
Test #6:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
100 atpbvcpxnfuhzsyasaobwqzwenbjgbgszmnpmiittrtugwqxfimiqyyeekluhbxxrzxmtuinkdokeodkzjjilkhnpxxlvehktgoj atpbvcpxnfuhzsyasaobwqzwenbjgbgszmnpmiittrtugwqxfimiqyyeekluhbxxrzxmtuinkdokeodkzjjilkhnpxxlvehktgoj atpbvcpxnfuhzsyasaobwqzwenbjgbgszmnpmiittrtugwqxfimiqyyeekluhbxxrzxmtuinkdokeodkzjjilkhnpxxlve...
output:
NO NO NO NO NO NO NO NO NO YES NO NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 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 YES 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:
ok 100 lines
Test #7:
score: 0
Accepted
time: 1ms
memory: 3556kb
input:
100 crrydsqzrsjajhukkyeflikzldygkbxqvjhxjwkbobnerynpmemlmhbbrbxmeswvnwaxwfvjbdrwvghhnhlziurhasjdmeodjqax crrbddqaryjajhukkyefliuipdygkbxqvjdxjlzbcpneruxhqemhpiabrbumrpuvnwaxzfvjyoqwvshqnciziuhhasjxyqodjqaw bkrbydqzryjawhukcycumikilqyhkxxqvjdxjlkrcpnecuxhmdmlmiabrbuzeswvnwaxzivjborwvshhnciziurhcsjxyq...
output:
YES NO YES NO YES YES NO NO NO NO YES NO NO NO NO YES YES NO YES YES NO YES NO YES NO NO YES YES YES NO NO NO YES YES YES YES NO NO NO YES NO NO NO YES YES YES YES YES NO NO YES YES NO NO YES NO YES NO NO NO NO YES YES NO YES YES NO YES YES YES YES YES YES NO NO YES NO YES NO NO NO NO NO NO NO NO NO...
result:
ok 100 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3664kb
input:
100 alpjxyhwojswxolmpzbdmaqlctirzdbooshfezqaymfoylmbpoyhcurxsoocrszygtwxypghxrfxgplnrfyzbsvysuvjydcgvkuc alurxwiwoqswfofdgzbeeycmomdrzlnooqhxmzqihzfkyatbjvyvcsrxsoohvtkdjawbysursrfbcdqtrftvbrwpzbvpjdcovrty alillwhsojuwfolmgvhpmycmomdkflbhwqmfeimabhfovlycpvgvaxujbkbovlkgjatpykuxcofxggqtdbyvfrwcsupmyd...
output:
NO NO NO YES YES NO NO NO YES NO NO NO NO YES YES YES YES YES YES NO YES YES YES NO YES YES NO YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES NO YES NO YES YES NO NO YES NO YES NO YES YES NO YES NO YES NO NO YES YES NO YES YES YES NO YES YES ...
result:
ok 100 lines
Test #9:
score: 0
Accepted
time: 1ms
memory: 3668kb
input:
100 jnotnsyfaondjpdtgtfvayhlsuwiivaaihgeqxpiboelufliodvkrlwvkkvkuduzemtkcvcmeevoafphkajnknfdkegqbmjxwnva czrtnttvxwkdbpslyvfvyhbouuufblihshsellwcfohhealiotngqlbvktcqhkozugcpcycmzqabafxhrahnayxecbgnymalivva czstxshfacbcspstgufqmyboelxibnhzibsevlcibqhhgykaorvcqfbikfdwhkwschygavcbaqvgmqgmzojnkrfdcroque...
output:
NO NO NO NO YES YES NO NO NO NO YES NO NO NO NO YES YES NO NO YES YES YES YES NO NO NO NO NO YES NO YES NO NO NO NO YES NO YES YES YES NO NO YES NO NO NO NO NO YES YES NO NO NO NO YES NO NO NO NO NO YES NO YES NO NO NO NO NO NO YES NO NO NO YES NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO ...
result:
ok 100 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
100 cqbmloxpykxngccrwjwtulanmpfcjhcdgqryvpomwvnwjsdficuqivxzszsoheaquaigwdbkgfexynblmvwzxrjigsknnnvrhjct cqbmloxpykxngccrwjwtulanmpfcjhcdgqryvpomwvnwjsdficuqivxzszsoheaquaigwdbkgfexynblmvwzxrjigsknnnvrhjct cqbmloxpykxngccrwjwtulanmpfcjhcdgqryvpomwvnwjsdficuqivxzszsoheaquaigwdbkgfexynblmvwzxrjigsknnn...
output:
NO NO NO NO NO NO NO NO NO NO NO NO YES YES YES YES NO NO NO YES NO YES NO NO YES YES NO YES YES NO YES NO NO NO YES NO NO NO NO YES NO NO NO NO YES YES YES YES NO NO YES NO NO YES NO NO YES NO NO NO NO YES YES YES NO NO NO YES YES YES NO YES YES NO NO NO NO YES NO YES NO NO YES YES NO NO NO NO YES ...
result:
ok 100 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
100 dxawxwjqawdgsbpkvlhaahekktmyqncuxmbvbygwqsfkloqxfgjldaoniuitzhvxoznrghrcixowexxjfhishfzmjvryyinvyxbp hxuzspvdavepcloaxpratlcntkkfihacamhhnrqcjoyglpvbqevlyfbhgynhwwjkmpeucbzvhqaokumrayiqnaqbvogmgmuwzglp coawiavqlztoktwpbweaywykvkfysnrcnschxhycqsfpvmbesajydfukcpnvzvxxmzepgwpvqijwemmmfrunafzohrgwwm...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES 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 YES NO NO NO NO NO NO YES NO NO NO NO NO YES N...
result:
ok 100 lines
Test #12:
score: 0
Accepted
time: 1ms
memory: 3564kb
input:
100 oizuhdqudplktctpzfguivswveavvktljnhcqrurjzqugflbijbygtworhonzotneqokmjoxftnaejlylrnpksnbnmfcewmcho yizcheqzjclwtcowzfauonswaeavvttjeoycqqudyzouxwaqivbggtwcrftbztsiedvkykoufwnaetcclrnpvknbnmhcywogpfam ypzuhceuthlwgydpefgcunswveevukzueoocjourjzqugxabhqzgetwosftbxtszopviyheofrnaergylrfpksnbnehcbzmf...
output:
NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO YES NO YES YES YES NO NO NO YES NO NO NO NO NO YES NO NO YES NO YES NO NO NO YES NO NO NO NO NO NO NO NO NO NO YES YES NO NO YES YES YES NO NO NO NO NO YES NO YES NO NO NO NO NO NO NO NO NO NO NO YES YES NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO NO ...
result:
ok 100 lines
Test #13:
score: 0
Accepted
time: 0ms
memory: 3536kb
input:
100 oawnwslkgpntkeeaadqfbwujsahkbwcutgebilyaguifbmfedrkrnpwpsukagnkbykvfzyafcnqetaxkpmtbpoxhnvkhpeveclmr oawnwslkgpntkeeaadqfbwujsahkbwcutgebilyaguifbmfedrkrnpwpsukagnkbykvfzyafcnqetaxkpmtbpoxhnvkhpeveclmr oawnwslkgpntkeeaadqfbwujsahkbwcutgebilyaguifbmfedrkrnpwpsukagnkbykvfzyafcnqetaxkpmtbpoxhnvkhpe...
output:
YES NO YES NO NO YES NO YES YES NO NO NO NO NO NO YES NO NO YES NO NO YES NO YES NO NO YES NO NO NO NO NO NO NO YES NO YES YES YES YES YES YES NO NO YES NO YES NO NO NO NO YES YES YES YES YES NO NO YES NO NO NO YES NO NO YES YES NO YES NO YES NO YES NO NO YES YES YES YES YES NO NO YES NO NO YES NO N...
result:
ok 100 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
10 btaymycabwliyairerpyrdhtimbhedqnrelqughpjqltbdtfxkztihrazttstdogpizjgxschnywtrttocanlskvsmpruofzdsxqhzetuldamjmhuccgxdwhyorwsnbqufffclccnndjonqawjsnypymebqjlajlotfnaobyiotvziwzjogmysokeiggullrnovitgubzbhgvcwpgpjwiexrzcrxgkijnbolmarlqthsbtnlmylxmwbsemkyxpftvzmtfbdhfbdpoqervvhslebmamrsmatogvxvsmebo...
output:
NO YES NO NO NO NO NO NO NO YES
result:
ok 10 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
10 dvkxoixlhhbopmeledkqhjqaaumarssxpapalefbcunqngjugxvwbpmtmokevterczwipyvryngbjbwlpfeystzyhuvthtlztwhldcvqjqbayrorywkfbtexrxadgtzktebcuibmhqvvaoysrghwrnrvjxsfbmeghwjivobkbxghygufklenvvzutujtwwuetgaefcilntlyfvpqvdrsjdizdqudajysuazwxxqicnvrkacdzoikllpsrojqrbkusvgaxazcphtuzcyzdixymmhmyqdvkwfhfxuyiezfu...
output:
NO YES NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #16:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
10 evpdmygntnitrpprqwiisiunjzbcanbjdxxqmolhvszvaeoqbvflfygqserbvcpwqadihburvnuvumyrmdbvxiuvavydcgscgsvlkjqivyhglowohnnvbaagvbzqgtoqraqsmencttzmftwqvflatgsmxovkxxdgmzkxuqtohacyerfzesvjnnsqqgttkshiuyfyyqftoxqqskzgcxetcwvrdpeujwuqjoperbvumjdebissfozoexslpmrcvaylbbcnkkqvghdkrmckwijixrivbyyasgfbjonlbryne...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
10 dybidgbtybbcdgkmueabawjhctxmdmqbwrcnofobmzrfixyycvldikbrnrcyrkvcogbhyfelgtznqlbxjtvhafakcwsgbgwotorvdrxufcjhdjwiiuvzicarwxanpyeodcsyyblcycuzheqnikengxapekuxgyytaudndwmothcjfxwnedtzqmkgjstjyjziuwdhapfesgkwcswqbwkahjishnueblpoxuizxifajtnyznsfqpokkvvttbhtoqmakjyebqngrbdppjsopjfthfjhvfcxycutnxzrduqms...
output:
YES NO NO YES YES NO NO NO NO NO
result:
ok 10 lines
Test #18:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
10 rizlwsyebjypkwrozcggafoscyegorrrekrdgwsxapxfadwbzufvnjigkkcfmatoerffagmfgsknyveeeagyixgiogwszkcwhtgwwimgkjutemwishazueogldynmcoqcbpmzrpzjtcqttjjpahztpirabrhqmjctgilfogxgmrmoawkqbdcjkfrstcgjhuncwzosfqeqyazqieidbyhdywtatibgzyhcrzwricxwbmrfichhvdbqdgoboxqpbqrkbcrpbvtjmlmggwmnhjeqxmmtifshqnasxgmufhlw...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #19:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
10 cymbusgwoepwnsleovgvtpfphirivromsanmimevhpnxitrgkacytydxvgnjnveymzbodftewddpjoadxoilzbpvchmqlnlsrxwdmniphaskcxuyencutcgpftutrpnnwzffixpamvwihizzrqblgyczvfitdvotwqlzkpjvbyyazynmnztbjpivjouatttzffljbhjrvfjpuliulfdtyfjcvwjajbgefesvvhkxavcthwdujkxxnqixxdicaoaetxmixnbdwudaccgabpmimfbkbrkufodlsdvsshlhs...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #20:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
10 vtcitouunbkogxpjlzmjltxctgzuqtvciuniftojtetbknmzxpovlugrrtrokxsghwwnkwjkzaviicxdgvznyqgbfqhxbeatpzyfdtnbedlilzktzoewjjrauoshjukrznupshwjosddidpsegykvstxlwgtrnjtgahbcnmsoqyhgaxwrxgpqrurvibkrszsrufodntpdrmppdtzwobagblypaejcwatpmepukoiacbzedlzssawrtrjlbkhomomqqkpnykyxphwuijpzmajswkojthcgfruzhfljbahj...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #21:
score: 0
Accepted
time: 0ms
memory: 3620kb
input:
100 lgzqwbzsvhkqllylanyzsbpgbgujovkaludefobeztfbwvbpdptygqepmaygzpovsmgudyrzcrfskmkbwgnkazxshvpwaponnmyhjwtunoheimnaeoowatrcukludgt hqycwjzcuueyulelalyhsbvgblbobicmzuhvhohlxefwmibytdtstkjpbkoxpxzzzhwhhyuzfrkuoixcwfmkozwfeqhwifggoahqsrttrkwysmpfwcztwepkuklbjun siylzupsvneylpaffnaedbsgbwpjbvckysbehoqh...
output:
YES YES NO YES NO YES NO YES NO YES YES NO NO YES YES YES YES NO NO YES NO YES YES NO NO YES YES NO NO YES YES NO NO NO YES NO NO NO NO YES NO NO NO YES YES YES YES NO YES NO NO NO NO NO YES NO YES YES NO NO YES NO YES NO YES NO YES NO YES NO NO NO YES YES YES YES YES NO NO NO NO NO YES YES NO YES N...
result:
ok 100 lines
Test #22:
score: 0
Accepted
time: 0ms
memory: 3672kb
input:
100 guzxrsudjzfdejrrvbsrzzgixqiyrpsxrjxqugfeaacslgfetciaihhsvohoumdwdlbhxmkfsofbppactjqswypjrjfympqngssafublleysrdpbiekjbyagzfsfrclrfbceypmcpdpth tlwwxweouputifdfkewleheyhrdhfdar jsgtgrccbhbvfpkzvjxwbaapvkjquzqvdsrkrlldfogvtafsoxuasyeoefcamcnnkcpmupeddvnrseyecmho rtdysdevelfzjrnnczg hdiaqgweatmrycrk...
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 YES NO NO NO YES 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:
ok 100 lines
Extra Test:
score: 0
Extra Test Passed