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

Is there any hard test data for 1116? my program always got wronganswer
Posted by Zhou Yuan 16 Oct 2001 19:17
my program is very easy:
Const
    InFile    = '1116.in';
    Limit    = 3000;
    LimitLen    = 30001;
    nodomain    = 127;

Type
    Tline    = array[-LimitLen..LimitLen] of shortint;

Var
    A , B ,
    C    : Tline;

procedure init;
var
    N , i ,
    x , y , F ,
    t    : integer;
begin
    for i := -LimitLen to LimitLen do
      begin
          A[i] := nodomain;
          B[i] := nodomain;
      end;
{    assign(INPUT , InFile); ReSet(INPUT);}
      read(N);
      for i := 1 to N do
        begin
            read(x , y , F);
            for t := x to y - 1 do
              A[t] := F;
        end;
      readln;
      read(N);
      for i := 1 to N do
        begin
            read(x , y , F);
            for t := x to y - 1 do
              B[t] := F;
        end;
      readln;
{    Close(INPUT);}
end;

procedure work;
var
    i    : integer;
begin
    for i := -LimitLen to LimitLen do
      if A[i] = nodomain then
        C[i] := A[i]
      else
        if B[i] = nodomain then
          C[i] := A[i]
        else
          C[i] := nodomain;
end;

procedure out;
var
    result     : array[1..Limit , 1..3] of integer;
    all , i    : integer;
begin
    i := -Limit;
    all := 0;
    while i <= Limit do
      if C[i] = nodomain then
        inc(i)
      else
        begin
            inc(all);
            result[all , 1] := i;
            inc(i);
            while C[i] = C[i - 1] do
              inc(i);
            result[all , 2] := i;
            result[all , 3] := C[i - 1];
        end;
    write(all);
    for i := 1 to all do
      write(' ' , result[i , 1] , ' ' , result[i ,
2] , ' ' , result[i , 3]);
    writeln;
end;

Begin
    init;
    work;
    out;
End.