QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#536089 | #4570. Deletive Editing | Lavine# | AC ✓ | 3ms | 3836kb | C++14 | 917b | 2024-08-28 18:25:09 | 2024-08-28 18:25:10 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std ;
void solve()
{
string s , t ;
cin >> s >> t ;
int n = s.size() ;
int m = t.size() ;
vector<int> vis(n , 0) ;
for(int i = m - 1 , j = n - 1 ; i >= 0 ; i --)
{
while(j > 0 and s[j] != t[i]) j -= 1 ;
if(s[j] != t[i])
{
cout << "NO\n" ;
return ;
}
vis[j] = 1 ;
j -= 1 ;
}
vector<int> lst(26 , 0) ;
for(int i = 0 ; i < n ; i ++)
{
if(vis[i] == 1) lst[s[i] - 'A'] = 1 ;
else
{
if(lst[s[i] - 'A'] == 1)
{
cout << "NO\n" ;
return ;
}
}
}
cout << "YES\n" ;
return ;
}
int main()
{
std::ios::sync_with_stdio(false) , cin.tie(0) ;
int T ;
cin >> T ;
while (T --) solve() ;
return 0 ;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
input:
6 DETERMINED TRME DETERMINED TERM PSEUDOPSEUDOHYPOPARATHYROIDISM PEPA DEINSTITUTIONALIZATION DONATION CONTEST CODE SOLUTION SOLUTION
output:
YES NO NO YES NO YES
result:
ok 6 token(s): yes count is 3, no count is 3
Test #2:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
10 GK GK F F H D ZQ QZ C C FN NF S S C C EM C XO C
output:
YES YES NO NO YES NO YES YES NO NO
result:
ok 10 token(s): yes count is 5, no count is 5
Test #3:
score: 0
Accepted
time: 0ms
memory: 3600kb
input:
100 RV MV Y G H G E E XJE DE Z Z N N YK S JBH D GZA N H EM F F EUO NJX EMK KE UI I W W KKN KT OUD O MU M G G OZO OO I W YEW E CYX D WHF FW X Z K S Y UBO WK WK K K S UF X S N RFR ER E KYR KJR WZ Z BEQ QE T T EIU IU VCN RC DI RED JAG H NFB B XRC E AQG AGQ VF R V W PQ PQ FH V VM V N Q OBA OB AKM AM B B...
output:
NO NO NO YES NO YES YES NO NO NO NO YES NO NO YES YES NO YES YES YES YES NO YES NO NO NO NO NO YES YES NO NO NO YES NO YES NO YES YES NO NO NO YES NO NO NO NO YES NO YES NO YES YES YES NO NO YES YES YES YES NO YES YES YES NO YES NO NO NO NO NO YES NO YES NO NO NO YES YES NO NO NO NO YES YES NO YES N...
result:
ok 100 token(s): yes count is 41, no count is 59
Test #4:
score: 0
Accepted
time: 1ms
memory: 3608kb
input:
1000 WTTPIRAWY ATRTW UMKVTEEEJS MKVTEEEJ KCCRX CKX IUROWOKK IUOKK KXKR KK FXYENTFAW FXYTFW NMZZQ ZM HT P BZHQ BE RZISOXUP RZISXUP SBW BW PLZMGZEJR KWI SXNRRATW SRRATW HCNJMKRC PXLDTKYOO NCXPFRIND XIX CSHTIPQW I MDU MDU QWUIZVGTM QZUWVT RB R VPWV C XGKBE GEB OWN OWN ECKBUCM ECCBUK CDRTH RC YB UHU IOZ...
output:
NO YES NO YES YES YES NO NO NO YES YES NO YES NO NO YES YES NO YES NO NO YES NO NO NO YES NO NO NO NO YES NO YES NO YES YES NO NO NO YES YES NO YES NO YES NO NO YES YES NO NO NO YES YES YES NO NO NO YES NO YES NO NO YES NO YES YES YES NO YES NO YES YES YES YES NO YES YES YES YES NO YES NO NO NO NO Y...
result:
ok 1000 token(s): yes count is 477, no count is 523
Test #5:
score: 0
Accepted
time: 2ms
memory: 3836kb
input:
10000 LGMWACMZMTKCPDXYI LACZTKCPDYI PPNCTHYLBTITAHGOHP PGNYLBIGOHP KGNJBIT KBIG IROQORQIVRUCOAFCZFL OORQVRCOAFCZFL FXVJSQ FJSQ GFWANPDGY FGY WURSFXPTQC FGETNVCOSSPIG OFVKWXFLOZ FKVXFZ JEBQREJVUOIBNJPZEGLB BRUOLNJZEBB XPVKSPPRPQPMXGFJPFU PVPPRPPMXPFU FFXGUMIQCTPDUWXKSFL FXMIQCDUWXKSF UZUB D NCZIKCVKL...
output:
YES NO NO YES YES YES NO NO NO YES YES NO NO YES NO YES NO NO NO YES NO YES NO YES NO YES YES YES NO YES NO NO NO YES YES YES NO YES YES YES NO NO NO NO NO YES YES YES YES NO YES NO NO YES YES YES YES YES YES YES NO NO NO NO YES NO YES YES YES YES YES NO YES NO YES NO NO NO YES YES YES YES NO NO NO ...
result:
ok 10000 token(s): yes count is 4997, no count is 5003
Test #6:
score: 0
Accepted
time: 3ms
memory: 3596kb
input:
10000 XLYUXOVLLY UOVLLY YQRJIDKBHELNYTYR QRJIBHELNQYR ZQFNALAZDPXWNGEBKDNO REDAZCUIECYRFTNWGRPHGNNRB KJWFLVSOQBPGCKGFILPOSDZE JWFOQBPCGFPOSJE MQQZIPFKAHKPWZCXP MIFKKPXP VCDIQAXXBHKGQFITKCMBSHUY DQXXBDQCMBUY KWTDYCFHBETQL YYKNCMFWVIBLRBODFUWOLWNEISBY ZVMHIDXBCI ZTCEWUDXJVFXHHWLYYTMKOIMFO SOEZHBB OZH ...
output:
YES NO NO NO YES NO NO NO YES YES YES YES YES NO NO YES YES YES YES YES YES YES YES NO YES YES YES NO YES NO YES YES NO NO YES YES YES YES NO NO NO NO YES YES NO YES YES NO YES NO YES NO YES YES NO NO YES NO NO YES YES YES NO NO NO NO YES NO YES NO NO YES NO YES YES YES YES YES YES NO NO YES YES NO ...
result:
ok 10000 token(s): yes count is 4968, no count is 5032
Test #7:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
10000 NYBGKG GBN YLUNUKNVWGRBDPZZYWDBZXJV TZLHSYUNG WUJAXZETUPWJPHJVZODIETLWRSQQK TUPWPHJVZETLWRSQQ EDHMXWQJCEMOAMQLAPDJEGUZF MWQCEMMQEGUZ UWBBZPIOPWSULNQENA ZPIOPNQENA IZGIHZZCIFLFBHDHAEZVBCKYP GHZIFHHAZBKY TRES TERS GEPBDQUVYWRRXGJBRLYOUROZDVQJJ GEPRGBRROZDQJJ QLRLMKCPTRJMIEOLQIIKLRSG LKRJMOQKLR R...
output:
NO NO YES YES YES YES NO YES NO YES YES YES NO YES NO NO YES NO YES YES YES NO NO NO NO NO YES YES YES YES NO YES NO YES YES YES NO YES NO YES NO NO NO NO NO NO YES NO NO NO YES YES NO NO NO YES YES NO YES YES YES YES YES NO NO YES NO NO YES NO YES YES NO YES NO YES NO NO NO YES YES NO NO NO NO NO Y...
result:
ok 10000 token(s): yes count is 4933, no count is 5067
Test #8:
score: 0
Accepted
time: 3ms
memory: 3600kb
input:
10000 CMBRXXFZMZQBUCNHHTAOZFLZRF CCXFMQUXNAFZRF ZMZRQQDKXLKXEDSSJNJZLQW ZMZRQQDKXDNZLQX TMOZBC MNZC EHSYLISIGKWODGDWRGKDEJOLEFF LEWDDWRKDKJOLE UXX DSAWUSPWBWQHSWFXKKQKNUWFDM NJMZBOLCMWGVD NZOCWRD GJJSFIGBGYRKPIDVRAFVBSDTUZWRL SBKPDFBSDTZWL NQCRPCDGNFUKTSIPESFRAXSW QPGNUKPJSFSW RXZVJJXUTOIKY XJXOKQ Y...
output:
NO NO NO NO NO NO YES NO NO YES YES NO NO YES YES NO NO NO NO NO NO YES YES NO NO YES NO NO NO YES YES NO YES YES NO YES NO NO YES YES NO NO YES YES NO NO YES NO NO NO YES NO YES NO NO YES YES NO YES YES YES YES NO YES NO NO NO NO NO YES YES YES YES NO YES YES YES YES YES NO NO NO YES YES NO NO NO Y...
result:
ok 10000 token(s): yes count is 4969, no count is 5031
Test #9:
score: 0
Accepted
time: 3ms
memory: 3616kb
input:
10000 PYECMQLGYAZYZOZUYQXCULTILY PEMLGYAYOZYQULTILY EDCHFAANG AQBEEHUXYCPCYS SWRVM BKMFSIRVNUQEIDNFYZZVAR IVBCCUUVLV BUUVV EVUNJKKEVWKJWUFIDQLSMSJBB IDHFQROCAGDLTFAHCOAYXH HQCXJJEPQHLOWEW QHCJEPQHLOWEW OFSI SF CUSOKQOPQXPDFXEI CSPXPXE FZTISGLIHRCQUESNH SLYCJJPATEQDEWSYDCFYUGIX AXFISJDYAZM SJDYP TQTF...
output:
YES NO NO YES NO NO NO YES NO NO YES YES NO YES NO NO YES NO YES YES YES YES YES YES NO NO YES NO YES YES NO NO YES YES YES NO NO YES NO NO YES NO NO YES NO YES YES YES NO YES NO NO NO YES YES YES YES YES YES YES NO YES YES NO YES YES NO YES NO YES NO YES YES YES YES YES NO YES NO YES NO NO NO YES N...
result:
ok 10000 token(s): yes count is 5019, no count is 4981
Test #10:
score: 0
Accepted
time: 3ms
memory: 3604kb
input:
10000 FKFNZHSMLCFYFYLIPL KCYP CQICJWK QC BNOMAJUUCRTUJFKLDRKP BNAJUUJK UJFUAQAHTWUGUIHCICBH FATWUIIBH ENFJFH EBF LEWAZTEHHSWHIABTIIRRJ LWZRSWHABTRJ OHHHEZDTVOWJRMWYPOE OHHDTVOWYOE EQOCIJIGEVVHZELMUCGTQUD JCDWOYNGDMMYZTEQMXQ ATDQUGZTSLF TQD FWN JBBYMK UOGQSFUOMHLGYDZDNXWQTDEKUPFPMS WSFUHDZDNXWQTDKUFP...
output:
YES YES YES YES NO NO YES NO NO NO NO YES NO YES YES YES NO NO YES NO NO NO YES YES NO YES YES NO YES NO NO YES YES NO YES NO YES NO YES NO YES YES NO NO YES NO NO NO YES YES NO YES NO YES NO NO YES YES YES YES NO NO YES NO YES YES NO YES NO YES YES YES NO NO YES NO YES YES NO NO YES YES NO YES NO N...
result:
ok 10000 token(s): yes count is 5018, no count is 4982
Test #11:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
10000 UWIAMAWTZCNWKK IMZC UGNSWAVREBAWZLHWSAQKLBURLFCU SRALSAQKLBURLFU NFSTWDODZTOTLQTKUBRORJ FWODOLTUOR VKSGSQ KQ VBNWELQQLWWSCQPNLWBOXUYIYZNK NWNLQQLWWCQNLWBOXYZEK OJBIRRWGFLD OJBIRWFD SAESPJKEWKBQVCZHQDQVM ASWBVCZQDQVM AEP EP XYJDZYRLZMQ ZYLZ BACLZKDIBCOODF AKIOF CTSOD CST ENDSFCWEVNNZCVBFAZXLITG...
output:
YES YES YES YES NO YES YES YES YES YES NO YES NO YES NO NO YES NO YES YES NO NO YES NO YES YES NO NO YES NO YES NO NO YES YES NO NO YES YES NO YES YES YES YES NO YES YES NO YES YES NO NO NO NO NO NO NO YES NO YES YES YES YES NO NO NO YES NO YES NO YES YES NO NO NO NO YES YES YES NO YES NO NO NO YES ...
result:
ok 10000 token(s): yes count is 5031, no count is 4969
Test #12:
score: 0
Accepted
time: 3ms
memory: 3628kb
input:
10000 KIJLZQ IQJ DDMEBEASIP BDDAP JRCILG JC BHMKWLSKPVAZOXQBUVUK HKWLKVXBUVUK VEDQNIG ERTHODYMFZEPFJARTOEWKAQIIHBGUJ ZWEMVQCPZBBFNPJUU WEBBFPJU IFWJQSSIEZSXSBIMZYP FWQSSSSBIMZP LJGWTXSVQKIDACGGR WTVQIDAG CMYBUOSMFJTLQPIFNY CMUOMQLTPIF HSPXRBWPBEFUT OJODRSIVNJUFHPMKHUZENCAA GWZYJVCP WGYV GWYVRWUZUGGC...
output:
NO NO YES YES NO YES YES YES NO NO NO YES NO YES NO NO NO NO YES NO YES YES NO NO YES NO YES YES NO NO NO NO NO NO NO YES YES NO YES NO NO NO NO YES NO YES NO YES YES NO NO NO NO NO NO NO YES YES NO YES NO NO YES NO YES NO YES YES YES YES YES YES NO YES YES NO YES NO YES YES NO YES YES NO YES YES NO...
result:
ok 10000 token(s): yes count is 4933, no count is 5067
Test #13:
score: 0
Accepted
time: 3ms
memory: 3752kb
input:
10000 ZXKVPH ZXKPH UBTFHNMBVRAVHTUZXPFDTWONEA FHBRHTUZPFTNA ALBTYI FUAILZGPCXADSEGZPJLYDHLBMCLZGT SYQHUWJATVDEYVYZEY PSSZYTPASBQUSINPPOUMZIQ MNMFLGNVWUNUIADHTSFICMVSDAD LNNDHTICMAU LNYLGIE JYWBJZ FHQJJDQTQVPFQMNDMICMSQYRJYTAZL LZUELMJIR KVURYBMFKFPEQQWIC KVMKFPQEWC TURXFCGNQNDUSXZQVBSBNO TXFGUSXQSBN...
output:
YES YES NO NO NO NO NO NO YES YES NO NO YES NO NO NO NO NO YES YES YES YES NO NO NO NO NO YES YES YES NO NO YES NO YES YES YES YES NO NO NO NO NO NO YES YES NO YES NO YES NO YES YES NO YES NO NO YES NO YES YES NO YES NO YES NO YES YES NO YES NO YES NO YES YES NO NO NO NO YES NO NO YES YES YES YES YE...
result:
ok 10000 token(s): yes count is 5037, no count is 4963
Test #14:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
10000 OJNGCAMNMEIRAQFNDYJNWQGUKP AAFDJWQG ROCVXAQ ROCQ EYLQSUYATBQDODXAIPBEKJMAHPZH YUYTBDODBEPKH PMELAHTFMIJYT FAEMIT LPLHH LLHH VNFEEYZWLWCNQ VNEEYJWLWCN GPGEXVAIEYF PGI XKWQPPSBGKXYXVMRRCBYHQXQXDLXJ XPPSBGXYXVMRBYHQXQXDXJ EXPIUHR EXIUR SNYKUZGLB NK KSGHFFNNQMIMOLBLBRJOSC KMNQMIHOLBLBOSC WXMBSLEIZ...
output:
YES YES NO NO YES NO YES YES YES YES NO YES NO YES YES YES NO NO NO NO YES YES YES NO YES NO YES NO YES YES NO YES NO YES YES NO NO YES YES YES NO NO NO NO YES YES YES YES YES NO YES NO NO NO YES YES NO YES YES NO NO NO NO NO NO NO YES YES YES YES YES NO NO NO NO NO NO NO NO NO YES NO YES NO NO NO N...
result:
ok 10000 token(s): yes count is 4941, no count is 5059
Test #15:
score: 0
Accepted
time: 3ms
memory: 3788kb
input:
10000 RWENOKYVTQWDNZFPQURXMH NOKYVTWNZQUMH OHFBMEOICVK OHFMOICV MJNOBFMXZMSLKIWONYPUVLI JNBZMLINVLI ZBXRAEFJMCOUZH ZRXFMUZ XBGSLRDZ R WTGGCMYZXNQLPV WGGMXNQLOV DLDKSMCAMCJUIBNBLWBFNPRTMABZVB DULWMV GVMGPLSURBTHX SVGPLGUH UNXZFXEIYFYKQDQKHWIOI UZFEFYHW DYTIYYOHL IQY MOKCVHONDNGIOXPCZMJHVDEFZEROL OOOX...
output:
YES YES YES NO YES NO YES NO YES NO YES NO YES NO YES NO YES YES YES NO NO NO YES YES YES NO NO YES NO YES NO NO NO YES NO YES NO NO NO YES YES NO YES YES NO NO YES NO YES YES YES NO NO NO YES YES YES YES YES NO YES NO YES NO NO YES YES YES YES YES YES YES NO NO NO NO YES YES NO NO NO YES NO YES YES...
result:
ok 10000 token(s): yes count is 4983, no count is 5017
Test #16:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
10000 KXCYKHAAIOVWYYYYXLVRJFRLFCZCQN CAAWOYYXLJFRLFCZC FFWHIHMTNNWNPACZWGAJVRSGYKMQXQ FFWTWNZWGJSGYM RKCJOQGDFGRMPFVIUXCQOQGFHGZPKH RJGFGRPFVUCOQGFGZP JEUICYMKGHFZLEUTCBXFDRWAFSBIMJ UCMHLEUCBXFDRWAFBM IGUJOSTUNHKJZSLZZYLJVCRCWUKZLN JOTJZSZZYLJRCKZL VMAWLIUGMFWRPAFQJHXWLNGLICOEJN AFAFJWNIOJN MDQAROQP...
output:
NO YES YES YES YES YES NO NO NO NO NO NO NO YES YES NO NO YES YES NO NO NO NO YES YES NO YES NO YES YES NO NO NO YES YES NO YES NO NO YES NO NO YES NO NO YES NO YES NO NO NO YES YES YES NO NO NO YES NO NO YES NO YES NO NO NO NO NO YES YES NO YES YES NO YES NO YES NO NO YES YES YES YES YES NO YES YES...
result:
ok 10000 token(s): yes count is 5035, no count is 4965