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 1088. Ilya Murometz

who can tell me why I got 'Wrong Answer'?
Posted by qwt 2 Feb 2002 18:51
var
  d,e,f,ep,dp,h:longint;
  t,i,j,k:longint;
  way:Array[0..30] of 0..1;
begin
  readln(d,e,f,dp,ep,h);
  fillchar(way,sizeof(way),0);
  t:=0;
  for i:=f-1 downto d do begin
    if dp<=t+1 shl i then way[i+1]:=0 else way[i+1]:=1;
    inc(t,way[i+1]*(1 shl i));
  end;
  t:=0;
  for i:=f-1 downto e do begin
    if ep<=t+1 shl i then j:=0 else j:=1;
    if j<>way[i+1] then break;
    inc(t,j*(1 shl i));
  end;
  k:=(f-e)+(f-d)-2*(f-i-1);
  if k<=h then writeln('YES') else writeln('NO');
end.