QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263865#6825. Expenditure Reductionvp_account#WA 244ms17836kbC++14860b2023-11-25 09:15:432023-11-25 09:15:44

Judging History

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

  • [2023-11-25 09:15:44]
  • 评测
  • 测评结果:WA
  • 用时:244ms
  • 内存:17836kb
  • [2023-11-25 09:15:43]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
constexpr int M=1e5+5;
int n,m,T,id[255],pos[M][36];
char s[M],t[M];
int read(){
	int x=0,f=1;char ch=getchar();
	while (!isdigit(ch)) {if (ch=='-') f=-1;ch=getchar();}
	while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
	return x*f;
}
int main(){ T=read();
	iota(id+'a',id+'z'+1,0);
	iota(id+'0',id+'9'+1,26);
	while (T--){
		scanf("%s%s",s+1,t+1);
		n=strlen(s+1);m=strlen(t+1);
		for (int i=0;i<36;i++) 
		for (int i=n;i;i--){
			memcpy(pos[i],pos[i+1],sizeof(pos[i]));
			pos[i][id[s[i]]]=i;
		} int ans=1<<30,l,r;
		for (int i=1;i<=n;i++){
			int x=i-1;
			for (int j=1;j<=m;j++)
				if (!pos[x+1][id[t[j]]])
					{x=-1;break;}
				else x=pos[x+1][id[t[j]]];
			if (!~x) break;
			if (x-i+1<=ans) l=i,r=x;
		}
		for (int i=l;i<=r;i++) putchar(s[i]);
		puts("");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3688kb

input:

4
114514 15
shanghaicpc ac
aaabbbaaabbbccc abc
howdeliciousandfreshitis oishii

output:

145
aic
abbbc
owdeliciousandfreshiti

result:

ok T=4 (4 test cases)

Test #2:

score: 0
Accepted
time: 119ms
memory: 3392kb

input:

10000
9fk811aek6newrfy7hvdsln282g1dcpa829bum5x1lpfdq9qd6 9f8ek6newyvdn282ca29b5x1ld9q
vg36oa5ncf4spe59gyplp1mi1or1hji2q0lcpubvxglbjjdyjm 365f4spe59glpm1oh2qpuvxjm
h604exipq7eg5gvy1n06mugqlxqyqd5kao0u12rsrfs2m4lpez h60e70muglxyd5k0u1le
33kmdcvnzvmkyjylt2kvck8fiy32jabu0rcnbhogqrnfi3hj6j 3mdcnzkyjlvk8f...

output:

9fk811aek6newrfy7hvdsln282g1dcpa829bum5x1lpfdq9q
36oa5ncf4spe59gyplp1mi1or1hji2q0lcpubvxglbjjdyjm
h604exipq7eg5gvy1n06mugqlxqyqd5kao0u12rsrfs2m4lpe
3kmdcvnzvmkyjylt2kvck8fiy32jabu0rcnbhogqrnfi3hj6
2f2ukqz1k3vbbs1x9o746i69vw675te94myxgqf0hesz0d6x4
12eqrshrg591ze2wjqpdcplm7ugkb9fo8v0xyk4r5ts4ikz86
akz...

result:

ok T=10000 (10000 test cases)

Test #3:

score: 0
Accepted
time: 119ms
memory: 3464kb

input:

10000
6cysrabtpdhyfa680e7we7y2iyzszuknxcecsiumsumvpafaia thyfa8e7yzsknxccmmvafaa
rq6siapzyeqi5lzp7ilxyrdps65lsqcsg8mggea0imxu7yenjs rqiazy5lp7lypcs8gge0ixyens
9u6kjiebgugm7sw7bbs172rh5z5s3vrghq81yy2q5pnh5oem5w 6kieusw7bbs7rz53vg1yqpnh5e5
ggjmpuw3a23s3pjhuh3v7x6nw9b573r6jxpoaz9txh11hc9ikz gjm23s3pu36...

output:

tpdhyfa680e7we7y2iyzszuknxcecsiumsumvpafaia
rq6siapzyeqi5lzp7ilxyrdps65lsqcsg8mggea0imxu7yenjs
6kjiebgugm7sw7bbs172rh5z5s3vrghq81yy2q5pnh5oem5
gjmpuw3a23s3pjhuh3v7x6nw9b573r6jxpoaz9txh11hc9ik
cerj5uygs85eklvmpjoihdrwlemdkantywth7lvlvbj9mscu9
goe9iw7n8xu52ywzi4dy1umik9f30wa7hn8wye3nb3jj2c
co2vv5xffek...

result:

ok T=10000 (10000 test cases)

Test #4:

score: 0
Accepted
time: 119ms
memory: 3388kb

input:

10000
svla166dvrllf9ze28r00vhp38maebj7l0r9wraw9q4bn0wu5b va66drll280vhp8ae7l09r4bu5
4cg2youkigm85sgxmd4ebg1bjeuv8klks8h4c7p0prasz2ucmk 4c2yokid4b1juvs4c0raz2um
54lpldj9yg0dl6yj3z821qzdfwqegrtr6a66wph0cxgezh8qkw 5l9yd6yj1zfwrr66cxgez8qw
1rlxhnkocrpz7yym42nrvdvyn458ioy7wivdhhxyvr5q56ib3t rxhkocyym4rvd...

output:

vla166dvrllf9ze28r00vhp38maebj7l0r9wraw9q4bn0wu5
4cg2youkigm85sgxmd4ebg1bjeuv8klks8h4c7p0prasz2ucm
54lpldj9yg0dl6yj3z821qzdfwqegrtr6a66wph0cxgezh8qkw
rlxhnkocrpz7yym42nrvdvyn458ioy7wivdhhxyvr5q56ib
gdew5j34ja8iddldwrvzgpayaf0bwj9noby27tglxci0uq4ed
61fr8e7hxmtrszb7tmqgvskg6bn68azbjpuj9bycsoe8jjzuix
s...

result:

ok T=10000 (10000 test cases)

Test #5:

score: 0
Accepted
time: 115ms
memory: 3384kb

input:

10000
fv2mwmg9hmqrmwwtmoohy44w4hct7f7vqgm6gqxzg1f6m41knn wg9mrmmhy4c7qmgz641kn
iqx3ry9cplusrblrx0x50tzgxxoorfxhmzb2b3tx9dptwujyiv q3csrbx5tzgf2btdtwyiv
24s5jwn9bswkac5c18i3xbki8b60h56w77f4ur2o42ornbk8iq 2s5jbsa3bb60hw7f4r42ornk8i
sre8m6anb8wgkhdbncj211d60vpf2wfqsob4mjmds7doqwslaf mnwgkhbncj110vp2qob...

output:

wmg9hmqrmwwtmoohy44w4hct7f7vqgm6gqxzg1f6m41kn
qx3ry9cplusrblrx0x50tzgxxoorfxhmzb2b3tx9dptwujyiv
24s5jwn9bswkac5c18i3xbki8b60h56w77f4ur2o42ornbk8i
m6anb8wgkhdbncj211d60vpf2wfqsob4mjmds7doqwslaf
qj7e0yxrut3s8ahbi4bwjrk1kdaezbe0j8wvvt4i2or0mp
jx6gjajme9l995wjvdld5tzo0wbwqsduob4wg9pwvgjub6pqb
vz1xhkdpwf...

result:

ok T=10000 (10000 test cases)

Test #6:

score: 0
Accepted
time: 116ms
memory: 3512kb

input:

10000
81dlg0rmlp9a2l31r4uk2f6d853fc8t39sejyioagsh0us7ew7 mp92ruk2f6d83fc39jigshuew
3861lu9p95ljn5qpk942tjitzepd0gzdjsdgu0msljrman9211 6u95ln5qp94tized0zjsduslra1
r8gmbt2g8swb8w83pfzw6hncq7akoh4swn2fmpg28jakkyh9g9 r8bgs8w83pfzw6ck4s2mp2aky9g9
eymebzo1z1icb0phl3af9m7zi1pf9cd1n9qvd4ugtl8fxnstn1 eymzo1z...

output:

mlp9a2l31r4uk2f6d853fc8t39sejyioagsh0us7ew
61lu9p95ljn5qpk942tjitzepd0gzdjsdgu0msljrman921
r8gmbt2g8swb8w83pfzw6hncq7akoh4swn2fmpg28jakkyh9g9
eymebzo1z1icb0phl3af9m7zi1pf9cd1n9qvd4ugtl8fxnst
j7pvu828hq16o69ixnshvy34aykon2qeqfhjyx8odazekvrz9n
b4qrjct4ywk1ag9klvli5dlajmpszjpy3sby18uglsrrlc86qd
xcdgkrj...

result:

ok T=10000 (10000 test cases)

Test #7:

score: 0
Accepted
time: 119ms
memory: 3404kb

input:

10000
btz0nhud6lz2nd7t7urspfqaso32w0lo71cux6eq6k8pswc0dx zhuz2d7trfas320l716q6kscd
t4h2gigi5201u4b34ivmixdigtne7k13vzklf04akxuuq76k7k t42gig52143vtnk1vzk04kqk
bu7nwwtd9o035tjzsm0kf8243bh4m2s8j5cds7v19wwwa8m78k u7wwt9o35tjzsmk23mjds9k
85p2obgf0tnacu251i6axptekaq2njjuwuknmr4xkiep3kso3a p2nac16aptek2jj...

output:

z0nhud6lz2nd7t7urspfqaso32w0lo71cux6eq6k8pswc0d
t4h2gigi5201u4b34ivmixdigtne7k13vzklf04akxuuq76k
u7nwwtd9o035tjzsm0kf8243bh4m2s8j5cds7v19wwwa8m78k
p2obgf0tnacu251i6axptekaq2njjuwuknmr4xkiep3kso3a
8hzmvrhblm09rmbixno48i3ost2c4yysvp74ep1c6po6ciybev
yjeruif6xanypl9nekkrrbgeqd6gtoz3mzls0rp31y1oq7u0f
b77...

result:

ok T=10000 (10000 test cases)

Test #8:

score: 0
Accepted
time: 119ms
memory: 3476kb

input:

10000
v1e3mt9il34t4wc3hmaae3u8p32vxzcp4yl76fruo5k4bnpali ve3t9l3t4cmaae83vzcpfuo5al
vker5kk4iffrke60k1p47j04rthhurr8n2pwwe85wjknoculqy ker5kifre6p7jrhnpwwjknuy
czrw3ayajdofgbkd8tto919ov8g93iq015r27696os0xjutnk5 waadgbkd8tto9199i1r276osxjn5
4zxg00fpbgjwr2zxrp42q0ecrc6ng1f3fuqdp0bz1roqsnxc79 zxg0fgj2r...

output:

v1e3mt9il34t4wc3hmaae3u8p32vxzcp4yl76fruo5k4bnpal
ker5kk4iffrke60k1p47j04rthhurr8n2pwwe85wjknoculqy
w3ayajdofgbkd8tto919ov8g93iq015r27696os0xjutnk5
zxg00fpbgjwr2zxrp42q0ecrc6ng1f3fuqdp0bz1roqsnxc
yijtcj7mtcbrtq2stidvtab9482j5car3ubhzu4efu3pvl
sugmncs8pek99gdivqze4vwofnjpjdaakkethdgkh9sqnh9
1kzd5ksxk...

result:

ok T=10000 (10000 test cases)

Test #9:

score: 0
Accepted
time: 111ms
memory: 3392kb

input:

10000
b6zb0tqa6l4ghc5smhnz173f7tuj017tj11ntj9d1ikn26tsid zql4csmhn13f01jd1k2ti
be6ce19orr3iqn0nbd1002kruwbbmvnsyu18tstt5cebg3hvul b6iqn002kruwbbmutebghv
hnxb53lm4jo4ed0qulke4d5oyg2zs4tot698kl9nnsa13g7qej hb53lm4edqul4d5oyzs4tokl9n1qj
bat0tusriw6ei3dnzsmopysqr9sfmaw6poywj8gw62q0jkhpgx aw6i3nsmpqr9smw...

output:

zb0tqa6l4ghc5smhnz173f7tuj017tj11ntj9d1ikn26tsi
be6ce19orr3iqn0nbd1002kruwbbmvnsyu18tstt5cebg3hv
hnxb53lm4jo4ed0qulke4d5oyg2zs4tot698kl9nnsa13g7qej
at0tusriw6ei3dnzsmopysqr9sfmaw6poywj8gw62q0jkhpgx
bvtexqm4mnkhf3r71pszdjzixgh48w0w414v1wfjl4
pndgjf0pxob3ooofypk1kejm9f4siiqf0f2b0a3pwj3l4ep
z4whk85yn91...

result:

ok T=10000 (10000 test cases)

Test #10:

score: 0
Accepted
time: 115ms
memory: 3568kb

input:

10000
hv0le8qb6yl9154rtuy15lgmik17i130r7a32f0fz6k00v0lad v0leqlrtulmk71302f0fza
ngffpf1uqkw1bajzlf30zk3089s7owka7vbth4dqj84odm5we7 fp1qbaz309s7owkvbth4qj84odm5e7
ke33ah582jutnvdd4bem4esq177kuieec72qwg61n8235gt17s k3h58udmes17kc2wg6n835gt1s
ryg4nds8q1p611ntw7vhe5oghppout2q4dm6r8pal7esrg81x0 ynsq161tw...

output:

v0le8qb6yl9154rtuy15lgmik17i130r7a32f0fz6k00v0la
fpf1uqkw1bajzlf30zk3089s7owka7vbth4dqj84odm5we7
ke33ah582jutnvdd4bem4esq177kuieec72qwg61n8235gt17s
yg4nds8q1p611ntw7vhe5oghppout2q4dm6r8pal7esrg81x0
t8etwcgg51ujdp1qr3lf5a6mhj883vnqf3iszvb4mx461f3l
4vhx9hwnm2id332ecph1o8994wfpf2j5xaoki4fhb0glsph5d
oej...

result:

ok T=10000 (10000 test cases)

Test #11:

score: 0
Accepted
time: 119ms
memory: 3384kb

input:

10000
mvjr9wrjjuidw84p0o0mmi9khovk24f8om0vbvpe9i8efr2h50 mwjji40omhok480bpif2h50
57pnyfekpxw1mqwd6bvu9tssyrqxgbr3y2myl2o0ceiwrx8014 5pnyfkmw69syrqr3y2yl0cer801
bboqu5tg08yn0idu5fxhao8qmlqunhz752snuy5ndb1wf85cvo bboqugy0i5fxhqhz72ndb1f8o
rc8yreps56y3tdynea756plcqc0njh8y8frnfg5rxqu8p1jmkh rcrs5yne76lc...

output:

mvjr9wrjjuidw84p0o0mmi9khovk24f8om0vbvpe9i8efr2h50
57pnyfekpxw1mqwd6bvu9tssyrqxgbr3y2myl2o0ceiwrx801
bboqu5tg08yn0idu5fxhao8qmlqunhz752snuy5ndb1wf85cvo
rc8yreps56y3tdynea756plcqc0njh8y8frnfg5rxqu8p1jmkh
g07g36dm1t7klkumyb729xm7uv5pn36ee4dz9k05xyp59ck
ebc8gurlppi85luptlg0h0no3q5k8kvbl5bivfp6ur38jib3
...

result:

ok T=10000 (10000 test cases)

Test #12:

score: -100
Wrong Answer
time: 244ms
memory: 17836kb

input:

5
qypxgjbizdkyhvw7qp90lcd4eezlqobnqsvp5y0titdnovtjxfh4n9pig5rm0dt5k86daey4a8q4nid0jcs3j4k294fgywoa4ucm8mt8zjuqwzmzqrluelnc4bb2mf1g77riftb96i2hxu5nl2tv7nwnsj65qpvfugm9lkm0glwolsw4milch4nmm5dv11bj46e6ekrpmqgwqondwqqec0x71gnkf05jzml87vbqj23paosppeuq9q5ggxu5gwc45vj2lj1hfzzlzjncarv92purs4bwd4sgl9hwcn9n8m...

output:

yl2nnjbvin4aaiuf2sppp2sq75lrfkyukd3kevth0au0lesplpsldhjxh7z3jcoztieq2czrt2q7wlqx54fuu3640cobiueygo4qdmonohf4tiiuu2o8y7xhq6avwsfit8zf83evbnfbmbk6xi3dkz0tldct3u2ccf2vpyvs34xvvu1bt22yhxebjvws1na5qy25pknnw0jpq32nbgl7mjuwdsqssj9dpihh9cmb0smnqx6ty21z81yaa0pajfhkwv7x4e7z3pryjqwa387fj31ojob48v7zdss2czh2bkif...

result:

wrong answer Jury has a shorter answer (test case 1)