QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#817454#4570. Deletive EditingSGColinAC ✓2ms3832kbC++20759b2024-12-16 23:20:232024-12-16 23:20:24

Judging History

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

  • [2024-12-16 23:20:24]
  • 评测
  • 测评结果:AC
  • 用时:2ms
  • 内存:3832kb
  • [2024-12-16 23:20:23]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

inline int rd() {
	int x = 0;
	bool f = 0;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) f |= (c == '-');
	for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
	return f ? -x : x;
} 
int vis[200];
void solve(int k)
{
	string s1,s2;
	cin>>s1>>s2;
	int len1=s1.length();
	int len2=s2.length();
	int r=len1-1;
	bool bb=true;
	for(int i=len2-1;i>=0;i--){
		if(vis[s2[i]-'0']==k){
			puts("NO");
//			cout<<s2[i]<<endl;
			return;
		}
		while(r>=0&&s1[r]!=s2[i])vis[s1[r]-'0']=k,r--;
		if(i!=0)r--;
		if(r<0)bb=false;
	}
	if(bb)puts("YES");
	else puts("NO");
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++){
		solve(i); 
	}
}

详细

Test #1:

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

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

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

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

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

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: 2ms
memory: 3824kb

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: 2ms
memory: 3620kb

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: 2ms
memory: 3828kb

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: 2ms
memory: 3620kb

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: 2ms
memory: 3832kb

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: 2ms
memory: 3604kb

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: 2ms
memory: 3592kb

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: 2ms
memory: 3832kb

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: 2ms
memory: 3612kb

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: 0ms
memory: 3608kb

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

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