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

fail
Posted by Charm 5 Feb 2011 21:26
В чём ошибка не пойму.?  не проходит 1 тест

var i,j,k,m,s,n:integer;
a,b:array[1..100000] of integer;
begin
  read(n);
  k:=0;
  for i:=1 to n do read(a[i]);
  read(m);
  for i:=1 to m do read(b[i]);

  for i:=1 to n do begin
  for j:=1 to m do begin
  if a[i]+b[j]=10000 then k:=1;
  end;
  end;
if k=1 then write('yes');
if k=0 then write('no');
end.

Edited by author 05.02.2011 21:26

Edited by author 05.02.2011 21:30
Re: fail
Posted by Andrew Suhani 24 Mar 2011 01:21
Try to use capital letters for the answer: YES and NO
Re: fail
Posted by ilya_romanenko 3 Jun 2011 22:40
Исправь "yes" и "no" на "YES" and "NO".
Однако после этого будет ТЛЕ на 4 тесте. Используй быструю сортировку и бинарный поиск. Удачи!
Re: fail
Posted by AterLux 4 Jun 2011 01:28
Sorting not needed because input given in sorted order.
Actually you even not need to binary-search, just line scan of both arrays. Think what way summ changed if you pick next item in array.
Re: fail
Posted by John Mac 6 Jul 2011 16:59
IMHO sortirovka zdes ninado
Re: fail
Posted by qwe24 15 Nov 2013 12:04
0.0125