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 1021. Sacrament of the Sum

1021 wrong answer
Posted by GulfStream 8 Nov 2009 19:33
Somebody can respond why incorrectly? On turbo pascal all tests passes.


var a:array[1..1000] of integer;
    b:array[1..1000] of integer;
    i,j,n,m,r: integer; s1,s2,s: string;
begin
read(n);
for i:=1 to n do readln(a[i]);
for i:=1 to n-1 do if a[i]>a[i+1] then begin
r:=a[i]; a[i]:=a[i+1]; a[i+1]:=r; end;
read(m);
for j:=1 to m do readln(b[j]);
for j:=1 to m-1 do if a[j]<a[j+1] then begin
r:=a[j+1]; a[j+1]:=a[j]; a[j]:=r; end;
for i:=1 to n do for j:=1 to m do begin
if ((a[i]+b[j])=10000)and((a[i]+b[j])<>10000) then s:='yes' else
if (a[i]+b[j])=10000 then s1:='yes'
else if (a[i]+b[j])<>10000  then s2:='no'; end; if s='yes' then writeln(s)
else if s1='yes' then writeln(s1) else if s2='no' then writeln(s2); end.

Edited by author 08.11.2009 20:44
Re: 1021 wrong answer
Posted by Sergey Lazarev (MSU Tashkent) 8 Nov 2009 21:07
You should output capital letters ("YES", "NO").
Re: 1021 wrong answer
Posted by GulfStream 8 Nov 2009 21:23
Time limit exceeded
How to correct?=)
How time depends?




Edited by author 08.11.2009 21:27