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

Discussion of Problem 1042. Central Heating

Why WA6?
Posted by Neizvestnii 19 Jun 2007 14:22
Please help!!!
Give me Test#6 please!!!
I have WA6 too.......
Posted by BAron 19 Jun 2007 14:25
Please anybody help me........
This is my code:
const maxn=2510;


var n,i,j:longint;
sol,a:array[0..maxn,0..maxn] of longint;
lines:array[0..maxn] of longint;


function aor(a:longint):boolean;
begin
  if a<>0 then result:=true else result:=false;
end;

procedure ReadInput;
var i,j:longint;
begin
  readln(n);
  for i:=1 to n do
  begin
    while true do
    begin
      read(j);
      if j=-1 then
      begin
        readln;
        break;
      end;
      a[j,i]:=1;
    end;
    a[i,0]:=1;
  end;
end;

procedure Solve;
var i,j,k,ok:longint;
begin
  for i:=1 to n-1 do
  begin
    ok:=1;
    for j:=1 to n do
      if (not(aor(Lines[j]))) and (aor(A[j][i])) then
      begin
        ok:=0;
        break;
      end;
    Lines[j]:=1;
    for k:=0 to n do
    begin
      if k=i then sol[i,k]:=0 else sol[i,k]:=a[j,k];
    end;
    for k:=1 to n do
    begin
      if (not(aor(Lines[k]))) and (aor(A[k][i])) then
      begin
        a[k,i]:=0;
        for j:=0 to n do
          a[k,j]:=a[k,j] xor sol[i,j];
      end;
    end;
  end;
  sol[n,0]:=a[n,0];

  for i:=n downto 0 do
    for j:=i-1 downto 0 do
      if aor(sol[j,i]) then
      begin
        sol[j,i]:=0;
        sol[j,0]:=sol[j,0] xor sol[i,0];
      end;
  for i:=1 to n do
    if aor(sol[i,0]) then write(i,' ');
end;


begin
  {$IFNDEF ONLINE_JUDGE}
    reset(input,'input.txt');
    rewrite(output,'output.txt');
  {$ENDIF}

  ReadInput;

  Solve;

  {$IFNDEF ONLINE_JUDGE}
    close(output);
  {$ENDIF}
end.

Edited by author 24.06.2007 19:25
Re: I have WA6 too.......
Posted by AlexF [USTU Frogs] 30 Aug 2007 17:51
Big thanks to Alias (Alexander Prudaev) for his help in finding my stupid bug!))
Re: I have WA6 too.......
Posted by BAron 8 Sep 2007 18:09
AlexF [USTU Frogs] please say, why i get wa#6. Incorrect algo or program?
Re: I have WA6 too.......
Posted by BAron 12 Oct 2007 21:13
Anybody say me, why I have WA#6?
Re: I have WA6 too.......
Posted by AlexF [USTU Frogs] 12 Oct 2007 21:17
By bug were in Gauss) Just incorrect place of "}". This problem is just Gauss)Nothing special.
GL)