.

: CM 2:; := end ; procedure (. ,. , ,); integer ; label ;

integer array . , , ; begin integer .; go to start;

: : =0-1; : = +1; start: : = ];:=0[-1-1]; if >0 then begin

epl:

if q(yPOBEHb]=-1 then go to aal; aa2: ]:=0;

: ]: =[];

4: 10}:= [];

5: []:=0;

: 0[010]]: = ;

aal: if abs(q[yPOBEHb]) = 1 (>5 <9) then

begin : = -1; qyPOBEHb]:=-1; 01]:= if []=0 then

5 else []-1; if 0[]=2 then begin : = +1; q[yPOBEHb]: = 1 end end else

[]:=abs (qiyPOBEHb]);

:

: =yPOBEHb+l; := ]: = 0[0-1]; : ( , , . :[], ); []: = ]; q[yPOBEHb]:=0+1]; [0]:=0[+2] end else begin

0[-]: = abs(qfyPOBEHb]); {]:=0;

4 4

[0]:=10]; ]:=0;

0[010]]:=-: HOMEPfyPOBEHb]:=0[+2]; q[yPOBEHb]:=+3];

0]:=0[+4]; : = +3; go to end



end ; procedure ( , ); integer ;

Integer array , . ; begin [ K[yPOBEHb]]: = abs(q[yPOBEHb]); (]: = 0; 4: {0]:=10]; (]:=0;

0[010]]: = [] end ; :

!1( . , , , , ); :

for i: = l step 1 until 65 do

:= 4EPHbIX[i]:=0; for {:= 1 step 1 until 5 do c[i]: = 0; :

input (n); 0]:=; for i: = l step 1 until n do begin input (j,k);

[]:=]; {1]:= end i;

« :

input(); ]: = ; - "

for i: = l step 1 until n do begin input (j,k);

4EPHbIX{k]:=j; 4EPHblX[i]:=k end i;

outputCT, ", /); ; «: [1]: = 0; : == 001]: = 1;

( , . ,

; 1],0); 0{0]:=0[1]; [0]:=0[2]; for 1:=3 step 1 until do begin : = true; ( I, , .

, ,1 ); for 41 : = 00[1]+2 step 1 until 00[2] do begin

0(1,0 ,0 ,

, ,1 ); for 2: = 12]+2 step 1 until .

00[3] do begin nAT:=false; 0(2,0 , , , , 2 ); :: = 004];

( ,0 ,0 ,, );



go to 2 ; : for 42: = 00]+2 step 1 until

do

begin

0(2,0 , , , , 42 ); : :=4;

XOA(CCOif qTyPOBEHb]=-1 then 2+2 else 2+1],0 , , ); go to 2 ; 42 : : =4 end 42;

0:0:=3;

XOA(CCOK[if qjyPOBEHb]=-1 then 2+2 else 2+1],0 , , ); : 50CJ:;

go to 41 ; 2 : :=3 end 2;

0:0:=2;

XOflA(CnHCOK[if qiyPOBEHb]=-1 then 1+2 else 1+1], . . ): : 50CJ:;

go to 1 ; 41 : :=2 end 41; : = 0012]; if then :

begin ( , , 4,,1); :

go to 1 end;

output(7/,PEEHE,7); goto ; MATl: output/. ,/); : 4 ; : go to ; 1 : : = 1 end 1;

output (7,* 4,7); go to ;

: output(, 4*./) : end





0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 [32] 33 34 35 36 37 38 39 40 41 42 43

0.0035