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 1190. Bar of Chocolate

Please where is a mistake? WA at time 0.26
Posted by Илья Гофман (Ilya Gofman) 26 Mar 2002 19:57
program abc;
var  i,kol,p,sum,j,a,dop:longint;
     c:integer;
     s:string;
     ans,pr:boolean;
     mass:array[1..5000] of integer;
begin
     readln(kol);
     for i:=1 to kol do
     begin
          readln(s);
          p:=pos(' ',s);
          delete(s,1,p);
          val(s,mass[i],c);
          if c>0 then
          begin
               p:=pos(' ',s);
               delete(s,1,p);
               val(s,a,c);
               mass[i]:=a;
          end;
     end;
     {end}
     sum:=0;
     for i:=1 to kol do
     begin
          if mass[i]>0 then
          begin
               j:=i-1;
               while mass[j]=0 do
               begin
                    mass[j]:=mass[i];
                    j:=j-1;
               end;
          end;
     end;
     for i:=1 to kol do
        sum:=sum+mass[i];
     if sum>10000 then
     writeln('NO') else
     writeln('YES');
end.
- this is the program text. all my tests work properly. please,
help!!
Here it is
Posted by WAZZAP 30 Mar 2002 17:01

3
b 1 33
c 1 34
d 0

YES

should be NO, because of descending order.
it is stilll WA
Posted by Илья Гофман (Ilya Gofman) 19 Apr 2002 20:32
>
> 3
> b 1 33
> c 1 34
> d 0
>
> YES
>
> should be NO, because of descending order.
This is an invalid test. The trick is that if the max sum of all the components is less than 10000, it's a lie.
Posted by Maigo Akisame (maigoakisame@yahoo.com.cn) 15 Jul 2004 14:21