<html> <head> <title>XIX >1;0A=0 >;V<?V040 7 V=D>@<0B8:8. (%<5;L=8FL:0 >1;0ABL).</title> </head> <body bgcolor="ff8000" text="navy"> <h2> <center><hr> XIX >1;0A=0 >;V<?V040 7 V=D>@<0B8:8. (%<5;L=8FL:0 >1;0ABL).<br>  BC@. 4 AVG=O 2005 @>:C. <br></center></h2><hr> <p> 040G0 1.  @> <V:@>18 .<p> V4><>, I> 2 >4=><C :C1VG=><C <5B@V ?>2VB@O ?@8<VI5==O :;0AC 4> ?>G0B:C 70=OBL <VAB8BLAO 2600 <V:@>1V2.  >4=>3> <V:@>10 G5@57 :>6=V 30 E28;8= ?@8 t = +30C CB2>@NTBLAO 420. @8 t = +20C @>7?>4V; <V:@>1V2 A?>2V;L=NTBLAO C 2 @078, 0 ?@8 t = +10C  C 20 @07V2. 1 T< :;0AC S <<sup>3</sup>, C :;0AV ?5@51C20NBL m CG=V2. >B@V1=> >1G8A;8B8 :V;L:VABL <V:@>1V2, I> ?@8?040NBL =0 >4=>3> CG=O G5@57 k 3>48= ?VA;O ?>G0B:C 70=OBL (1d" kd" 7) ?@8 B5<?5@0BC@V t (t <>65 <0B8 7=0G5==O 10, 20, 30).<br><br> "5E=VG=V 28<>38: 7 :;02V0BC@8 22>4OBLAO (AB0=40@B=89 2EV4=89 ?>BV:) S, m, k, t O: G>B8@8 G8A;0, I> @>74V;5=V ?@>?CA:><. 0 5:@0= 282>48BLAO (AB0=40@B=89 28EV4=89 ?>BV:) T48=5 G8A;>  :V;L:VABL 10:B5@V9, I> ?@8?040NBL =0 >4=>3> CG=O.<br> <br> @8:;048 2EV4=8E B0 28EV4=8E 40=8E:<br> EV4=V 40=V:<br> 120 10 4 30<br> 120 15 2 20<br> 100 20 5 10<br> 8EV4=V 40=V:<br> 7987200<br> 105300<br> 21930<br><hr><p> 040G0 2.  09<5=H5 G8A;> <p> 0?8A0B8 =09<5=H5 G8A;>, AC<0 F8D@ O:>3> 4>@V2=NT 7040=><C G8A;C N (0<N<100000).<br> EV4=V 40=V: 7 AB0=40@B=>3> 2EV4=>3> ?>B>:C 22>48BLAO T48=5 G8A;> N.<br> 8EV4=V 40=V: 2825AB8 C AB0=40@B=89 28EV4=89 ?>BV: =09<5=H5 G8A;>, <br> AC<0 F8D@ O:>3> 4>@V2=NT N.<br><br> @8:;04 1: <br> EV4=89 ?>BV: <br> 6 <br> 8EV4=89 ?>BV: <br> 6 <br><br> @8:;04 2:<br> EV4=89 ?>BV:<br> 10<br> 8EV4=89 ?>BV:<br> 19<br><hr> <p> 040G0 3.  V4 >@>7 C 70<:C <p> !B0@>402=V9 70<>: <0T D>@<C :204@0B0 V <VAB8BL NxN :V<=0B. # :>6=V9 :V<=0BV @>7AB02;5=V A:@8=L:8 7 7>;>B8<8 <>=5B0<8. V4 >@>7 7=0E>48BLAO C 25@E=V9 ;V2V9 :V<=0BV V <@VT, 7V1@02H8 O:><>30 1V;LH5 <>=5B, 4>1@0B8AO 4> ?@02>W =86=L>W :V<=0B8, 45 9>3> G5:0T G0@V2=0 !=V3C@>G:0.  :>6=>W :V<=0B8 2V= <>65 ?5@59B8 4> ACAV4=L>W 2=87C 01> ACAV4=L>W ?@02>@CG. V4 >@>7 B0:>6 E>G5 70?0< OB0B8 <0@H@CB, O:89 2V= ?@>945. >?><>6VBL V4C >@>7C.<br> <br> $>@<0B 2EV4=8E 40=8E:  ?5@H><C @O4:C D09;0 SANTA.CLS 7=0E>48BLAO >4=5 G8A;> N (1<=N<=30).  :>6=><C i-<C 7 =0ABC?=8E N @O4:V2 7=0E>48BLAO N G8A5;, I> 287=0G0NBL :V;L:VABL <>=5B C :V<=0BV (i,j).<br> <br> @8:;04 22545==O:<br> 5<br> 7 1 4 9 3<br> 3 8 4 2 1<br> 8 1 6 7 7<br> 2 7 4 4 5<br> 4 5 2 6 5<br> <br> $>@<0B 28EV4=8E 40=8E: 0H0 ?@>3@0<0 ?>28==0 282>48B8 C ?5@H89 @O4>: D09;0 SNOW.MDN >4=5 FV;5 G8A;>  :V;L:VABL <>=5B, O:C 240;>AO 7V1@0B8 V4C >@>7C. # 4@C3><C @O4:C  <0@H@CB  =><5@8 :V<=0B, C O:8E ?>1C202 V4 >@>7, ?>G8=0NG8 7 :V<=0B8 (1,1), V 70:V=GCNG8 (N,N). <br> <br> @8:;04 282545==O:<br> 52<br> (1,1) (2,1) (2,2) (2,3) (3,3) (3,4) (3,5) (4,5) (5,5)<br><hr><p> <h2> <center> XIX >1;0A=0 >;V<?V040 7 V=D>@<0B8:8. (%<5;L=8FL:0 >1;0ABL).<br>  BC@. 5 AVG=O 2005 @>:C. <br></center></h2> <hr><p> 040G0 4. "V4 >@>7 V :><?'NB5@=V EC;V30=8"<p> 0 ?>HB>2C A:@8=L:C V40 >@>70 =04E>4OBL 70<>2;5==O =0 ?>40@C=:8 C 283;O4V B5:AB>2>3> D09;C. >HB>20 ?@>3@0<0 ?@0FNT B0:, I> 28EV4=89 B5:AB A?>G0B:C :>4CTBLAO, 0 ?>BV< ?5@5A8;0TBLAO ?0@0;5;L=> 7 >@83V=0;><. 0 :><?'NB5@V V40 >@>70 ?@>3@0<0 @>7:>4>2CT D09; B0 ?>@V2=NT 7 >@83V=0;><. /: 702648, :><?'NB5@=V EC;V30=8, ?5@54 >28< @>:>< E>GCBL 70O28B8 ?@> A515, "70?CAB82H8" 2 <5@56C =>289 :><?'NB5@=89 2V@CA.  CAVTW :V;L:>ABV =04VA;0=8E ;8ABV2 =5?>H:>465=8<8 4V9H;8 ;8H5 420 ;8AB8->@83V=0;8 B0 70:>4>20=V ;8AB8 7 70<>2;5==O<8.<br> >?><>6VBL V4C >@>7C @>7:>4C20B8 B0 ?@>G8B0B8 @5HBC ;8ABV2.<br> <br> "5E=VG=V C<>28:<br> # D09;V SURPRISE.ORI 7=0E>48BLAO >@83V=0; ;8AB0, C D09;V SURPRISE.KOD 70:>4>20=89 B5:AB.<br> 0H0 ?@>3@0<0 ?>28==0 ?@>G8B0B8 40=V 7 D09;C SURPRISE.KOD V 2825AB8 >@83V=0; ;8AB0 C D09; SURPRISE.ORI<br><hr><p> 040G0 5.  825@=CB0 ?0< OBL <p> VA;O 020@VW 2 3V?5@?@>AB>@>2><C AB@81:C 7>@5;VB "$-"" AB02 475@:0;L=> 2V418B8<  ;V25 ?><V=O;>AO 7 ?@028<. !5@F5 C 2AVE 0AB@>=02BV2 AB0;> ?@02>@CG, 0 =0720 :>@01;O ?5@5B2>@8;0AL 2 ""$". "0:>6 2825@=CB>N 28O28;0AL V ?0< OBL :><? NB5@0, I> :5@CT @CE>< :>@01;O. ;O 28:>=0==O =0ABC?=>3> 3V?5@?@>AB>@>2>3> AB@81:0 ?>B@V1=> 28?@028B8 42V9:>25 ?@54AB02;5==O ?@>3@0<8 2 ?0< OBV :><? NB5@0. ;O FL>3> =5>1EV4=> ?><V=OB8 <VAFO<8 1VB8 2 16-1VB=8E A;>20E (28:>=0B8 475@:0;L=5 2V4>1@065==O): 0-9 1VB ?>28=5= AB0B8 15-<, 1  14, 2  13 V B.4. <br> <br> @8:;04 2V4>1@065==O: 0110001011101101 1011011101000110<br> <br> $>@<0B 2EV4=8E 40=8E: # ?5@H><C @O4:C D09;0 FAETON.DAT 70?8A0=5 >4=5 FV;5 G8A;> N (0<N<32768)  @>7<V@ ?@>3@0<8 C 16-1VB=8E A;>20E. # :>6=><C 7 =0ABC?=8E N @O4:V2 70?8A0=5 >4=5 G8A;> 2V4 0 4> 65535  45AOB:>25 ?@54AB02;5==O A;V2 ?@>3@0<8.<br> <br> $>@<0B 28EV4=8E 40=8E: # 28EV4=89 D09; NOTEAF.REZ 70?8A0B8 N @O4:V2, ?> >4=><C G8A;C 2 @O4:C  45AOB:>25 ?@54AB02;5==O A;V2 ?@>3@0<8 ?VA;O 475@:0;L=>3> 2V4>1@065==O.<br> <br> @8:;04 D09;0 FAETON.DAT:<br> 3 <br> 1 <br> 0 <br> 32767<br><br> @8:;04 D09;0 NOTEAF.REZ:<br> 32768<br> 0<br> 65534<br> <hr><p> 040G0 6. 092V440;5=VHV <VAB0 <p>  :@0W=V ;V<?VW T N <VAB. 5O:V <VAB0 7 T4=0=V 4>@>30<8, O:V <0NBL ?52=C 4>268=C V ?> O:8E <>6=0 @CE0B8AL 2 >18420 1>:8. A>1;82VABL :@0W=8 ?>;O30T C B><C, I> 7 4>2V;L=>3> <VAB0 <>6=0 ?@>WE0B8 C 1C4L-O:5 V=H5. @V< B>3> <V6 1C4L-O:8<8 42><0 <VAB0<8 VA=CT T48=89 H;OE, O:89 =5 ?@>E>48BL 42VGV G5@57 >4=5 <VAB>. 0=4@V2=8:8 7402=0 E>BV;8 27=0B8, <V6 O:8<8 42><0 <VAB0<8 ;V<?VW =091V;LH0 2V4AB0=L.<br> <br> $>@<0B 2EV4=8E 40=8E:  ?5@H><C @O4:C D09;C cities.dat 7=0E>48BLAO G8A;> N (2<=N<=1000).  =0ABC?=8E @O4:0E ?> B@8 G8A;0 - i, j, s. 1<=i<=n, 1<=j<=n, 1<=s<=1000. (>268=0 ?@O<>W 4>@>38 <V6 <VAB0<8 i B0 j 4>@V2=NT s). <br> <br> $>@<0B 28EV4=8E 40=8E:  D09; cities.sol ?>B@V1=> 2825AB8 2V4AB0=L <V6 42><0 =092V440;5=VH8<8 >4=5 2V4 >4=>3> <VAB0<8. <br> <br> @8:;04 2EV4=8E V 28EV4=8E 40=8E.<br> cities.dat<br> 5<br> 1 2 10<br> 3 2 2<br> 2 4 5<br> 3 5 2<br> <br> cities.sol<br> 15<br><hr> </body> </html>