I can't find mistakes. Please help! var m:array[1..10000]of string; m1:string; a,b,c,d,i,j,k:integer; begin readln(a); for i:=1 to a do readln(m[i]); readln(b); for i:=1 to b do begin c:=0; d:=100000000; readln(m1); for j:=1 to a do if((pos(m[j],m1)>0)) then begin c:=pos(m[j],m1); if(c<d)then d:=c; end; if(d<>100000000)then begin writeln(i,' ',d); exit; end; end; writeln('Passed'); end.
Your program correct, but algorithm you chosen is too slow.
You trying to compare 10000 words with up to 300000 lines (is every line contains one symbol with CR LF - total 900KB). Also Pos function have very simple realization and it can take up to n*m comparations (for example if haystack and needle both have same repeating simbol except last one)
Apply the GOOD JOB for College ACMers to Make Large Money and Become a Millionaire
Hello, We need large no. of dedicated and hard working ACMers. The payment is good so we need ACMers to be efficient. All you have to do to get the job is to sign up at our websites. The link of our websites are given below.
After the registration, a confirmation email will be sent to your specified email address. Please click on the link inside the confirmation email to activate your account and recieve ACM work instantly. For any other queries you can mail the administrator.