|
|
вернуться в форумWA2 why wa2??? program ural; var n,m,i,k,j,r,p:byte; a:array[1..100]of byte; b:array[1..100,1..100]of byte; d:array[1..100]of integer; z,t:integer; label 1; begin readln(n,m); for i:=1 to m do begin read(k); for j:=1 to k do read(a[j]); for j:=1 to k do for r:=1 to k do if j<>r then begin b[a[j],a[r]]:=1; b[a[r],a[j]]:=1; end; end; readln(m); for i:=1 to m do begin readln(d[i],a[i],p); if p=1 then d[i]:=101 else d[i]:=d[i] div 4; end; for i:=1 to n do for j:=1 to n-1 do if i<>j then for r:=j+1 to n do if r<>i then if(b[j,i]>0)and(b[i,r]>0)then begin t:=b[j,i]+b[i,r]; if(b[j,r]=0)or(t<b[j,r])then begin b[j,r]:=t; b[r,j]:=t; end; end; z:=255; for i:=1 to n do begin t:=0; for j:=1 to m do if a[j]<>i then if(b[a[j],i]>0)and(b[a[j],i]<=d[j])then begin if d[i]<>101 then inc(t,b[a[j],i]); end else goto 1; if t<z then begin k:=i; z:=t; end; 1: end; if z=255 then writeln(0) else writeln(k,' ',z*4); end. Re: WA2 I can only say, that answer to the test 2 is 4 12. Program like this: begin write('4 12'); end. gives WA#4. Re: WA2 I don't know, what is your WA2, but my WA2 is people who spend his money, when they have month ticket. Try this: 4 3 2 1 2 2 2 3 2 3 4 3 27 1 1 15 4 0 45 4 0 Answer is 4 0. I hope, it helps. Sorry for my bad english. Re: WA2 Послано holzs 2 ноя 2010 23:02 You are right Thnx a lot Edited by author 02.11.2010 23:03 |
|
|