ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1087. Время забирать камни

Can someone help. please... I think my algorithm is right but... may be it is not!!!
Послано Vladimir Milenov Vasilev 17 янв 2002 20:41
Here is my program. I used dynamic but got wrong answer...I don't
know why???? If someone can give me some test...

program The_time;
var used : array[1..10000] of boolean;
    a:array[0..10000] of byte;
    st : array[1..50] of integer;
    n,k,i,j : integer;
    bool:boolean;
Begin
readln(n,k);
for i:=1 to k do read(st[i]);
a[0]:=1;
for i:=1 to n do a[i]:=0;
for i:=1 to n do
 Begin
  bool:=false;
  for j:=1 to k do
  if i>=st[j]
  then if a[i-st[j]]=2
       then
        Begin
         a[i]:=1;
         break;
        End
       else if a[i-st[j]]=1
            then if bool=false
                 then bool:=true;
  if(bool)and(a[i]=0) then a[i]:=2;
 End;
writeln(a[n]);
End.
A little change of your program
Послано Andrey Popyk (popyk@ief.tup.km.ua) 18 янв 2002 17:43
program The_time;
var used : array[1..10000] of boolean;
    a:array[0..10000] of byte;
    st : array[1..50] of integer;
    n,k,i,j : integer;
    bool:boolean;
Begin
readln(n,k);
for i:=1 to k do read(st[i]);
a[0]:=1;
for i:=1 to n do a[i]:=0;
for i:=1 to n do
 Begin
  bool:=false;
  for j:=1 to k do
  if i>=st[j]
  then if a[i-st[j]]=2
       then
        Begin
         a[i]:=1;
         break;
        End;
  if a[i]=0 then a[i]:=2; {See here!}
 End;
writeln(a[n]);
End.
Thanks...I got accepted!!!!
Послано Vladimir Milenov Vasilev 18 янв 2002 19:22
> Thank you very much, i got accepted now!!!Although I can't find
what was wrong with my program, but I'll will try to find. If I can
help with something, just ask me...
Re: A little change of your program
Послано Alex[LSD] 26 сен 2002 12:26
Ok I got AC too. great! thanks!

Not I d really love to know what difference that makes, for example
how the hack could the first player win in that test case?..
Thank you very much! I got AC!!!!! ^_^
Послано Марина 17 май 2004 22:20
Thanks. :)))