ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Common Board

Please, help me with problem 1124!
Posted by Nazarov Denis (nsc2001@rambler.ru) 11 Jan 2002 22:16
Be more detailed about what kind of help you need(-)
Posted by Michael_Rybak 12 Jan 2002 02:00
>
Re: Be more detailed about what kind of help you need(+)
Posted by Nazarov Denis (nsc2001@rambler.ru) 12 Jan 2002 14:06
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...(-)
Posted by Michael_Rybak 12 Jan 2002 22:57