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 1196. History Exam

WA on 4 test HELR PLZ!!
Posted by watson 10 Aug 2008 19:04
this is my code what's wrong
program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils;
var
 n,i,r,l,m,sch:longint;

 a,b:array[1..10000001]of longint;
begin
reset(input,'input.txt');
rewrite(output,'output.txt');
sch:=0;
 read(n);
 r:=n;
l:=1;
 for i:=1 to n do
   read(a[i]);
 read(m);
 for i:=1 to m do
   read(b[i]);
 for i:=1 to m do
   begin
     while r-l>1 do
       begin
         m:=(l+r div 2);
         if a[m]<b[i] then l:=m+1 else
           r:=m
       end;
      if (a[l]=b[i])or(a[r]=b[i])or(a[l+1]=b[i])  then inc(sch);

    end;
    write(sch);
end.
Re: WA on 4 test HELR PLZ!!
Posted by Max Pilgrim 17 Mar 2009 13:58
yasha it's because you have bad arms!!!!
it is your main problem!!!!