|
|
back to boardCommon BoardWhy do I get "restricted function" (code included) Hereґs my code: Type parbol= ^arbol; arbol= record dato: word; izq,der: parbol; end; Var a,act,ant,temp: parbol; i,n: integer; d: array [1..3000] of word; Procedure imprime(z: parbol); begin if z^.der <> NIL then imprime(z^.der); if z^.izq <> NIL then imprime(z^.izq); write(z^.dato,' '); end; Begin New(a); readln(input,n); for i:= 1 to n do read(input,d[i]); a^.dato:= d[n]; a^.izq:= NIL; a^.der:= NIL; for i:= n-1 downto 1 do begin act:= a; Repeat ant:= act; if act^.dato > d[i] then act:= act^.izq else act:= act^.der; until (act = NIL); New(temp); temp^.dato:= d[i]; temp^.der:= NIL; temp^.izq:= NIL; if ant^.dato > d[i] then ant^.izq:= temp else ant^.der:= temp; end; imprime(a); Dispose(a); End. Re: Why do I get "restricted function" (code included) Hi Dear i dont found any error on your program but because Ueal`s pascal compiler is delphi (as i know), i might it works with linked list, so bad. So i recommend you to write this solution with Array (not linked^ list!)... And Also please tell me what is number of the problem, you are writing for? And also, Because of Judge machine errors (as you see too many waiting at online status), it might that judge machine mistakes not you! some days ago i submit a problem and got WA, and the next day morning when i submit that solution (without any change), i got AC! They was all i could do for you... Sincerely Aidin_n7 Re: Why do I get "restricted function" (code included) Hi! Thanks a lor for your help. The problem I'm solving is: 1136 Parliament. |
|
|