|
|
вернуться в форумhow to prevent Time limit exceeded? Please proof read my program... var n,m,i,j,count:longint; teach:array [1..15000] of int64; stud:array[1..1000000] of int64; begin readln(n); for i:=1 to n do begin readln(teach[i]); end; readln(m); for i:=1 to m do begin readln(stud[i]); if (stud[i]>=teach[1]) and (stud[i]<=teach[n]) then begin for j:=1 to n do begin if stud[i]=teach[j] then begin count:=count+1; break; end; if stud[i]<teach[j] then break; end; end; end; writeln(count); end. Please tell me how to prevent time limit exceeded Re: how to prevent Time limit exceeded? Please proof read my program... Use binary search |
|
|