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

WHAT? TIME LIMIT EXCEEDED. PLEASE HELP!
Posted by mNT 23 Jul 2018 12:30
type
a = array[1..50000] of integer;
b = array[1..50000] of integer;


  Var c,d,i,k,g: integer;
  Var n: a; Var p: b;

  begin
  d:= 0;
  read(c);
  for i:= 1 to c do read(n[i]);
  read(k);
  for i:= 1 to k do read(p[i]);

  for i:=1 to c do
  for g:=1 to k do
  begin
  if (n[i] + p[g] = 10000) then
  begin
  writeln('YES');
  exit;
  end
  else if (i = c) and (g = k) and (n[i] + p[g] <> 10000) then
  begin
  writeln('NO');
  exit;
  end;
  end;
  end.