|
|
back to boardCommon BoardPlease, help me with problem 1124! Be more detailed about what kind of help you need(-) > Re: Be more detailed about what kind of help you need(+) My program: Program t1124; Var M,N,i,j,k,a :integer; c :array[1..500]of integer; begin a:=0; fillchar(c,sizeof(c),0); read(m,n); for i:=1 to m do for j:=1 to n do begin read(k); if k<>i then begin a:=a+1; c[i]:=c[i]+1; end; end; j:=0; for i:=1 to m do if c[i] mod 2=1 then j:=j+1; if j>0 then a:=a+(j div 2)-1; writeln(a); end. It get WA. The wrong test: 4 1 2 2 2 1 1 3 4 4 4 3 3 Rigth answer:9 My program's answer:8. How i can find in program code a such kind of tests? Count the number of connected components in the graph...(-) |
|
|