|
|
back to boardWhy Wa 12? program Ural1190; var h:array[1..5000]of longint; a,can,n,l,m:longint; w:char; begin readln(n); fillchar(h,sizeof(h),0); l:=maxlongint; for a:=1 to n do begin w:='a'; while w<>' ' do read(w); read(m); if m=1 then readln(h[a]) else h[a]:=-1; end; l:=1; can:=0; for a:=1 to n do begin if h[a]=-1 then inc(l); if h[a]<>-1 then begin can:=can+h[a]*l; l:=1; end; end; if can>10000 then begin writeln('NO'); halt; end; can:=0; l:=1; for a:=n downto 1 do begin if h[a]=-1 then inc(l); if h[a]<>-1 then begin can:=can+h[a]*l; l:=1; end; end; if l>1 then can:=can+10000; if can<10000 then begin writeln('NO'); halt; end; writeln('YES'); end. Edited by author 07.02.2009 08:15 Edited by author 07.02.2009 08:15 |
|
|