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

Обсуждение задачи 1438. Time Limit Exceeded

Test 12. Is it correct?
Послано Burunduk1 4 июн 2006 22:15
There are two labels in one string!
I tried to prove it but failed (+)
Послано Dmitry 'Diman_YES' Kovalioff 4 июн 2006 23:23
For each string S of input I used the following checking procedure:

   n:=0;
   for p1:=1 to length(S) do inc(n,ord(S[p1]=':'));
   if n>1 then halt(1);

But my program is still AC. It means that there is no string with two or more ':' inside.

Could you explain what does "two labels in one string" mean? You might give an example of such incorrect string.
Re: I tried to prove it but failed (+)
Послано Burunduk1 4 июн 2006 23:30
S = Str, ff = 0;
lmn:
sscanf(S, "%s", Lab);
if (Lab[(len = strlen(Lab)) - 1] == ':')
{
if (ff) while (1);
Low(Lab);
Lab[len - 1] = 0;
if ((i = GetObj(Lab)) == -1)
AddObj(Lab, ComN);
else
ObjVal[i] = ComN;
S += len;
ff = 1;
goto lmn;
}

Gets TLE 12, but without "if (ff) while (1);" it gets AC.

PS: without "goto lmn;" it gets WA 12.

Edited by author 04.06.2006 23:42
Re: I tried to prove it but failed (+)
Послано Vladimir Yakovlev (USU) 4 июн 2006 23:44
Your code reads one label twice!
sscanf(S, "%s", Lab) skips spaces in the beginning of line, but S+=len doesn't skip.
Re: I tried to prove it but failed (+)
Послано Ivankov Dmitry 4 июн 2006 23:48
"S += len" is wrong ;)
Re: I tried to prove it but failed (+)
Послано Burunduk1 4 июн 2006 23:49
Thank you :)

PS: I repeat this bug again and again :(
Re: Test 12. Is it correct?
Послано Fyodor Menshikov 24 дек 2008 22:50
Test 12: labels after the last command. Like this:

   a = 1
label: