我的代码,,,, var q,gongxu,last:array[1..400] of longint; machine,time:array[1..20,1..20] of longint; used:array[1..20,1..10000] of boolean; i,j,k,l,m,n,ans:longint; sss:boolean;procedure getdata; var i,j:longint; begin readln(m,n); for i:=1 to m*n do read(q[i]); for i:=1 to n do begin for j:=1 to m do read(machine[i,j]); end; for i:=1 to n do begin for j:=1 to m do read(time[i,j]); end; end;begin assign(input,'jsp.in');reset(input); assign(output,'jsp.out');rewrite(output); getdata; for i:=1 to m*n do begin l:=0; sss:=true; inc(gongxu[q[i]]); j:=last[q[i]]; while sss do begin inc(j); if used[machine[q[i],gongxu[q[i]]],j] then l:=0 else inc(l); if l=time[q[i],gongxu[q[i]]] then break; end; last[q[i]]:=j; for k:=j-l+1 to j do used[machine[q[i],gongxu[q[i]]],k]:=true; if j>ans then ans:=j; end; writeln(ans); close(input); close(output); end.