QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#854031 | #9726. AUS | ucup-team1134# | AC ✓ | 2ms | 3868kb | C++23 | 2.3kb | 2025-01-11 21:04:04 | 2025-01-11 21:04:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int>>
#define vll vector<pair<ll,ll>>
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define vvii vector<vector<pair<int,int>>>
#define vvll vector<vector<pair<ll,ll>>>
#define vst vector<string>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define mkunique(x) sort(all(x));(x).erase(unique(all(x)),(x).end())
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=15<<26;
struct UF{
int n;
vector<int> par,size,edge;
void init(int n_){
n=n_;
par.assign(n,-1);
size.assign(n,1);
edge.assign(n,0);
for(int i=0;i<n;i++){
par[i]=i;
}
}
int root(int a){
if(par[a]==a) return a;
else return par[a]=root(par[a]);
}
void unite(int a,int b){
edge[root(a)]++;
if(root(a)!=root(b)){
size[root(a)]+=size[root(b)];
edge[root(a)]+=edge[root(b)];
par[root(b)]=root(a);
}
}
bool check(int a,int b){
return root(a)==root(b);
}
};
int main(){
std::ifstream in("text.txt");
std::cin.rdbuf(in.rdbuf());
cin.tie(0);
ios::sync_with_stdio(false);
int Q;cin>>Q;
while(Q--){
UF uf;uf.init(26);
vector<string> S(3);
for(int i=0;i<3;i++){
cin>>S[i];
}
if(si(S[0])!=si(S[1])){
cout<<"NO\n";
continue;
}
if(si(S[0])!=si(S[2])){
cout<<"YES\n";
continue;
}
int N=si(S[0]);
for(int i=0;i<N;i++){
uf.unite(S[0][i]-'a',S[1][i]-'a');
}
bool ok=false;
for(int i=0;i<N;i++){
if(!uf.check(S[0][i]-'a',S[2][i]-'a')) ok=true;
}
if(ok) cout<<"YES\n";
else cout<<"NO\n";
}
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3640kb
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: 3644kb
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: 3580kb
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: 3588kb
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: 3808kb
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: 3576kb
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: 3868kb
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: 3608kb
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: 3632kb
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: 3632kb
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: 1ms
memory: 3572kb
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: 3608kb
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: 3868kb
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: 3840kb
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: 3524kb
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: 3676kb
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: 3576kb
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: 3844kb
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: 3808kb
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: 3540kb
input:
10 vtcitouunbkogxpjlzmjltxctgzuqtvciuniftojtetbknmzxpovlugrrtrokxsghwwnkwjkzaviicxdgvznyqgbfqhxbeatpzyfdtnbedlilzktzoewjjrauoshjukrznupshwjosddidpsegykvstxlwgtrnjtgahbcnmsoqyhgaxwrxgpqrurvibkrszsrufodntpdrmppdtzwobagblypaejcwatpmepukoiacbzedlzssawrtrjlbkhomomqqkpnykyxphwuijpzmajswkojthcgfruzhfljbahj...
output:
NO NO NO NO NO NO NO NO NO NO
result:
ok 10 lines
Test #21:
score: 0
Accepted
time: 1ms
memory: 3648kb
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: 3580kb
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