Комментарии
На adamaxCodeforces FAQ, 14 месяцев назад
+6
Nope, I'm too lazy to maintain both versions :)
На adamaxCodeforces FAQ, 14 месяцев назад
0
Thanks for the contribution everyone. Sorry for the delay, I don't receive e-mails about new comments for some reason.
I don't understand your interpretation of dfs_low, but it seems to be different from, for example, wikipedia. dfs_low[i] is the minimum of dfs_num[k] where k is a vertex accessible from i by a path consisting of dfs-tree edges and possibly one backward edge at the end. Since the edge 2->1 is not in the dfs-tree, dfs_low[2] = 2.
I'm not sure I understood you right. There's no need in additional loops as you describe. It's a standard DFS.
If you process the nodes in this order, then for example when you run dfs(2), the vertex 1 won't be visited again and dfs_low[2] = 2.
На nevidomyCodeforces Beta Round #53 [Analysis], 16 месяцев назад
+4
The sum of Manhattan distances over all cells: = = .

Now we need to subtract the sum of Manhattan distances with occupied cells. Suppose (x, y) is one of occupied cells, then . Since there are at most max(n, m) occupied cells, we can just sum over all (x, y).

Finally, the pairs of occupied cells were subtracted twice and we need to add them back. It's O(max(n2, m2)) as well.

And don't forget that the order of cells matters, so for example the sums in the second paragraph above need to be multiplied by 2.
На nevidomyCodeforces Beta Round #53 [Analysis], 16 месяцев назад
+1
На nevidomyCodeforces Beta Round #53, 16 месяцев назад
0
The Russian version seemed hard to understand to me as well. I probably spent more time reading the statement rather than coding the solution.
На timontiSolutions to Contest, 16 месяцев назад
0
A simple link to the tag search would suffice (and be in line with the whole Web 2.0 idea of the site), but tags need to be kept consistent for that. (And they need to actually work, e.g. this doesn't find anything.)
На MaxBuzzGCC: deoptimize using -O2, 16 месяцев назад
+5
I disassembled the code of string::operator==. Turns out that in case of -O2 it uses the assembler instruction repz cmpsb, while in other cases it calls the system function memcmp. I found the description of this issue here. Quote:
"in the -O0 case, GCC relies on the implementation
of memcmp supplied with the C library. In the -O2 case, GCC instead uses its built-in implementation of memcmp. The built-in function uses the special IA-32 instruction repz cmpsb, which is known to be slow on modern hardware."
Apparently switching off builtins (-fno-builtin) should fix the issue as well.

And Bugzilla link.
На MaxBuzzGCC: deoptimize using -O2, 16 месяцев назад
+8
Here are my results for N=200. (gcc 4.4.3, Ubuntu 32bit).

g++  0.899s
g++ -O2 4.733s
g++ -Os 0.413s
g++ -O2 -fno-tree-ter 0.390s

One would think that the optimization ftree-ter is broken. However it seems that it's enabled at -Os as well. In fact, the only difference in optimizations between -O2 and -Os is -finline-functions at my system. I tried turning it on, but to no effect.

Here's the relevant part of the man page:
-ftree-ter
Perform temporary expression replacement during the SSA->normal phase.  Single
use/single def temporaries are replaced at their use location with their
defining expression.  This results in non-GIMPLE code, but gives the expanders
much more complex trees to work on resulting in better RTL generation.  This is
enabled by default at -O and higher.
На nevidomyCodeforces Beta Round #53, 16 месяцев назад
+3
Very nice problem D...
Kudos to the author.
На ReiRound 51, B, 16 месяцев назад
+5
Read the problem statement carefully. The operations are:

1 1 1 1

+
2 1 1

+
3 1

*
3
На cauchykFacebook Hacker Cup 1A, 16 месяцев назад
0
I had the same line of reasoning. Would love to know the solution…
На yaroCodeforces Beta Round #51, 16 месяцев назад
0
http://codeforces.com/blog/entry/1112
На cauchykFacebook Hacker Cup 1A, 16 месяцев назад
0
> k - is the length of each part
But the parts may have different lengths.

>
Also in transition we should be careful with the equal numbers (I used set).
Can you explain the details? For example, how do you make sure that in the sequence (1,3,2,1,3,2) the subsequence (1,3,2) is counted only once?
На RADCodeforces Beta Round #52 (Div. 2), 16 месяцев назад
+5
OK, I figured it out. Apparently test files have Windows line endings but the input in the custom test has Unix line endings.
На RADCodeforces Beta Round #52 (Div. 2), 16 месяцев назад
0
Yes, and my program worked correctly for the first sample when I ran the custom test. It didn't pass the pretests though. Then I added handling extra whitespace and it passed.
На RADCodeforces Beta Round #52 (Div. 2), 16 месяцев назад
0
I think in tests for problem A there is extra whitespace. Can you check the first pretest?
На MikeMirzayanovCodeforces Testing Round #1, 16 месяцев назад
0
Everything you need is here. The only 'non-standard' thing is that RMQ in the problem is circular, but since any 'wrapping' segment can be divided into two 'unwrapping' ones, this is not really an issue.
На MikeMirzayanovCormen Medal Laureates 2010, 16 месяцев назад
+1
Is this award displayed somewhere on the site? I was expecting to see medals or badges in laureates' profiles.
На yaroRound 51, D, 16 месяцев назад
0
I didn't use either of these optimizations but avoided the 'strictly less' flag (so, the number of states is only 2 times less, while with these optimizations it's 48*5 = 240 times less). Still got AC…
На yeputonsЕще один баг GCC (#323), 16 месяцев назад
+10
Just to clarify: these are not bugs. 1<<42 is undefined behaviour, and the other one is also well-known.
На yeputonsЕще один баг GCC (#323), 16 месяцев назад
+5
-ffloat-store compiler flag solves the floating-point problem for me. The other one I don't have.

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i486 --with-tune=generic --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu
Thread model: posix
gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
На JKeeJ1e30lightly about the contests, 16 месяцев назад
-1
> let's talk about gay-on team
So… how many people on your team are gay?
+11
I thought 2011 is the year of white rabbit, not red :)
На adamaxCodeforces FAQ, 17 месяцев назад
0
Yep, now it seems to happen more frequently :)
На stgatilovCodeforces #47 problem solutions, 17 месяцев назад
0
Great analysis!
In problem E to find integer roots I just iterated over all possible roots x and for each of them over all possible coefficients c (they must be divisible by x). Knowing x and c, we can find the second root and coefficient b and check the conditions. The time is .
На MikeMirzayanovCodeforces Beta Round #44 (Div. 2), 17 месяцев назад
0
Look at the time that question was asked. Mike meant that during the contest the test cases are not available.
На adamaxCodeforces FAQ, 17 месяцев назад
0
I don't think so. Can you show the code?
На NerevarWCS Online Olympiad Results, 17 месяцев назад
+5
Wow, the tests are now available? It's very nice!
На n_boolDistance between 2 points in c++, 17 месяцев назад
+2
По-моему, дело не в карме самой по себе, а в засилии школоты*. Я даже в русский интерфейс перестал заходить из-за этого, тем более все равно сайт меня все время разлогинивает и сбрасывает обратно на английский. А если начинать делать ограничения в зависимости от кармы, не превратится ли CF в хабру с его жополизством, смехуечками и перепостами с реддита и фишек?
По поводу модерации: можно, например, отдельные посты удалять и делать предупреждение пользователю. Каждый у себя в профиле (и только у себя) сможет видеть, сколько у него предупреждений. По достижении определенного количества красная карточка =) Но понятно, что сейчас рук у администрации на все не хватит.


*Disclaimer для незнакомых с терминологией.
"Lara found a guidance note which said that to get hold of the treasures one has to choose some non-zero number"

What if I refuse to take the treasure? And how do you imagine getting a negative number of coins?
Why is negative result allowed in task E? It doesn't make sense. It's also sad that the solution using iostream doesn't pass the TL, because usually at CF it's OK to use iostream and some of us got used to it:)
But overall, the problems are very nice, thanks!
На MikeMirzayanovOctober Schedule, 18 месяцев назад
+5
Is there a schedule for December already?
На RADCodeforces Beta Round #42 (Div. 2, Codeforces format), 18 месяцев назад
0
If you participate 'out of competition', then when you enter the contest you appear in room number 1 instead of the room you were assigned to. (It's a bug.) To move into your room, select it from listbox in top right corner, it's marked with a star.
На RADCodeforces Beta Round #42 (Div. 2, Codeforces format), 18 месяцев назад
0
Ah, yeah, sorry
На RADCodeforces Beta Round #42 (Div. 2, Codeforces format), 18 месяцев назад
0
Try 1 2 and 1 4
На Alex_KPRСортировка статей, 18 месяцев назад
0
Напишу тоже сюда, что ли.
В английском интерфейсе темы в прямом эфире всплывают вверх даже если новые комментарии в них только на русском.
На daftcoderChanges in rating graph (in profile), 18 месяцев назад
-3
Ну так или иначе это баг
На daftcoderChanges in rating graph (in profile), 18 месяцев назад
0
> у некоторых участников вместо месяца  написано время

Подтверждаю, у некоторых написан просто месяц, у некоторых месяц и число, у некоторых время. Это, думаю, не зависит от браузера.
Seems that two of the problemsetters of this round are Fefer and RAD
I don't see what's wrong with your solution either.
На cerealguyCodeforces beta round #41, 18 месяцев назад
+5
The idea is to assign some numbers ai to vertices and the lengths ai + aj to edges. Then the condition about hamiltonian cycles will be fulfilled. To ensure the condition about different lengths, just choose the numbers ai one by one so that it was always true that ai + aj ≠ ai' + aj'. In other words, when you choose a new number, it mustn't be equal to ai + aj - ak and ai - aj - ak, for any already chosen ai, aj and ak. It turns out that if n ≤ 20, this process never needs numbers more than 500, so all edges have lengths less than 1000.
На simp1etonHaving Problems Understanding Solution, 18 месяцев назад
0
I haven't found the algorithm, just some observations and I don't even remember them :)
На MikeMirzayanovCodeforces Beta Round #40 (Div. 2), 18 месяцев назад
0
Это потому что порядковый номер Codeforces BR#40 — 41
На simp1etonHaving Problems Understanding Solution, 18 месяцев назад
0
I don't know… During the contest I came to some conclusions similar to the proof in the paper, so in principle it's possible to obtain it independently. It's only 1 page long, after all.
На simp1etonHaving Problems Understanding Solution, 18 месяцев назад
0
It's based on a theorem from this paper
На MikeMirzayanovCodeforces Beta Round #40 (Div. 2), 18 месяцев назад
0
It's a new Russian currency. One bourle = 100 pokeikas  ≈  0.032 laddors.
A quick search suggests that you can use the __debug__ variable. (Note that according to this, the programs are executed with -O switch.)
На MikeMirzayanovCodeforces Beta Round #40 (Div. 2), 18 месяцев назад
+3
Мы проводим новое ребро i<->i+2, откуда следует что нет вершины j (может, даже не из цикла), соединенной с этими обеими вершинами?
Here's my solution to I, maybe it'll be useful for someone.
First note that Gray code is 'circular': the last element differs from the first one in one digit. So, we can start enumerating subsets from any position in Gray code.
Now we'll enumerate partitions recursively. Fix the minimal element x and iterate over the (Gray code of the) subset of elements which are in the same subset with x. If M is the subset of all other elements, call our procedure recursively for M. We'll obtain a 'good' sequence of partitions. Unfortunately, if M1 and M2 are two consequent values of M, the sequences of partitions for them could not 'glue together': the last partition obtained from M1 can be very different from the first partition obtained from M2. But we can always apply a circular shift to the second sequence so that it glued together with the first one. I don't know what's the complexity of this but it passed the tests.
На MikeMirzayanovCodeforces Beta Round #40 (Div. 2), 18 месяцев назад
0
Не все так просто, при такой замене мог появиться треугольник.
На yeputonsЕще баг Codeforces (их уже два), 18 месяцев назад
0
Ага, у меня обе ссылки работают, а первое сообщение вообще много где выскакивает.
На SeyauaCodeforces Beta Round #39, 18 месяцев назад
+5
When you register for the competition you are asked to read this
Сервис->Шаблоны?
> опубликованы некоторые разборы. Скоро появятся и остальные, не беспокойтесь:
Как насчет разбора H? O:-)
И да, разборы не переведены на английский. Могу помочь с этим, если нужно.
На SeyauaCodeforces Beta Round #39, 18 месяцев назад
+18
m и n не совпадают по четности
На Han_kspPHP Ruby Python, 19 месяцев назад
+7
Don't use dollar signs, they are interpreted as TeX formulas ;)
If you want to show code samples, you can use, for instance, pastebin.com

(or tag <pre>)
На DeamonКлассификация задач, 19 месяцев назад
+1
Немного есть тут
By the way, when you registered for the contest it was written that it would be rated for everyone.
Обратный отсчет справа отстает на 3 часа.
На vepifanovCodeforces Beta Round #37 (Tutorial), 19 месяцев назад
0
Well, my solution doesn't need any memory at all. Process the lengths of the words in increasing order and try to find lexicographically smallest word at each step. Suppose s is the last word written out, and its length is k. Then all strings that have length k and are lexicographically not larger than s, are 'bad' (each of them has a prefix that is already written out). So, to find out the k-prefix of the next word we need to increase s by 1 (as a binary number). Obviously, if s consists of 1's it's impossible, since we will get a word of length k+1. Now we need to find lexicographically smallest encoding of the next word. To do that, just add zeros to the increased value of s.
На HernanFar Manager as IDE, 19 месяцев назад
+3
А язык, который используется в Delphi, — это разве не Object Pascal? В последний раз, когда я его видел, это было так, да и википедия подтверждает.
Зачем мыслить 'объектно' в спортивном программировании? И в каком месте C++ более 'объектный', чем Object Pascal?
Теорема Кирхгофа же
upd: а, тоже подумал про матрицу смежности
На NerevarCodeforces Beta Round #36 (Problem C Tutorial), 19 месяцев назад
-6
It's not true here that Ri ≤ rj
На NerevarCodeforces Beta Round #36 (Problem C Tutorial), 19 месяцев назад
-6
It'll give a negative result here, so at least it should be pointed out that we must take a maximum of zero and Δij.
На caustiqueВопрос по С++. Макросы, 19 месяцев назад
0
Кстати, вокруг n скобочки лучше бы поставить :D

    int c = 3;
    REP(i, c>0 ? c : c+1)
        cout << i << endl;
На NerevarCodeforces Beta Round #36 (Problem C Tutorial), 19 месяцев назад
-6
Maybe I'm missing something, but where does this case belong to? (i-th bowl is the higher one)



It seems that it's case 2, but the formula will give a wrong answer.
На caustiqueВопрос по С++. Макросы, 19 месяцев назад
0
Например, такая штука не скомпилируется:

#define all(v) v.begin(), v.end()
vector<int> x;
vector<int>* p = &x;
sort(all(*p));

Во втором случае, конечно, скобочки не нужны, но их все равно ставят во всех макросах во избежание досадных неприятностей типа такого:

#define sqr(n) n*n
cout << sqr(3+3)
На ant.ermilovВариации основных функций, 19 месяцев назад
+5
Если уж занудствовать, то со строгой математической точки зрения НОД в произвольном евклидовом кольце определен с точностью до умножения на обратимый элемент.
На begoonЗадача "Фотограф-зануда", 19 месяцев назад
0
Нет, в первом случае смысл a[i][t] такой же, как во втором. Откуда берется такая формула, хз)
На begoonЗадача "Фотограф-зануда", 19 месяцев назад
0
А нас и не интересует случай, когда первым стоит студент с номером больше 2.
Кстати, во втором варианте видимо опечатка, должно быть a[i][1] = a[i-1][1] + a[i-1][2]
На begoonЗадача "Фотограф-зануда", 19 месяцев назад
0
Во втором варианте t — номер студента, который сидит слева.
Это какой-то очень старый gcc. В новых операция битового сдвига знаковая (пруфлинк), поэтому с отрицательными числами countSimple не работает.
Время работы countSimple должно оказаться равным . Можно посмотреть на gcc --version?
На ant.ermilovВариации основных функций, 19 месяцев назад
0
По скорости, в смысле? Ну в этом ничего удивительного, вряд ли разработчики gcc придумали принципиально новый алгоритм вычисления нода)
> Все проводимые соревнования будут открыты для неофициального участия студентам и другим пользователям Codeforces, кто не участвует в официальном зачете.

Для участия вне зачета регистрироваться не нужно?
На AlexErofeevTCO2010 Semifinal 1, 19 месяцев назад
0
Прямо сейчас тут идет прямая трансляция финала
На adamaxCodeforces FAQ, 19 месяцев назад
0
fixed, спасибо.
На AbrackadabraCodeforces Beta Round #34 (Div. 2) Разбор, 19 месяцев назад
+1
Может быть 2 столкновения одновременно в разных точках, в условии это не запрещено.
На AbrackadabraCodeforces Beta Round #34 (Div. 2) Разбор, 19 месяцев назад
0
Мы говорим вот про этот случай:
екоторые не учитывали, что может быть несколько столкновений в один момент"

Ты учитываешь :)
На AbrackadabraCodeforces Beta Round #34 (Div. 2) Разбор, 19 месяцев назад
0
Нет, дело не в этом. Если столкновения происходят в абсолютно одинаковое время, то это не поможет.
Те решения, которые проходят, похоже, сортируют точки по координате (их порядок в процессе не меняется) и потом сравнивают скорости соседних. Тогда все работает.
На AbrackadabraCodeforces Beta Round #34 (Div. 2) Разбор, 19 месяцев назад
+3
Если столкновения происходят одновременно, то после того как мы перемотаем время, второе уже не произойдет, как и первое, разве не так?
На AbrackadabraCodeforces Beta Round #34 (Div. 2) Разбор, 19 месяцев назад
0
В задаче E некоторые не учитывали, что может быть несколько столкновений в один момент. Правда, какие-то решения почему-то проходят и так, см. например 140641
На e-maxxCodeforces Beta Round #34 (Div. 2), 19 месяцев назад
+4
BR: В начале контеста меня автоматически перебросило в комнату 1 (а должно было в 100). И еще если по задаче были неудачные попытки (взломанные или не прошедшие претесты), то во время тестирования она отображается как "Не пройдено"
На MikeMirzayanovOctober Schedule, 19 месяцев назад
+11
За мкадом пределами твоего часового пояса тоже живут люди.
На ant.ermilovВариации основных функций, 19 месяцев назад
+10
Я пишу abs(__gcd(a, b))
=)
На homo_sapiensDebug в Arena, 19 месяцев назад
0
Ну можно оставить только FileEdit тогда, он же ничего не генерит.

Кстати, сгенеренный код можно изменить в настройках и оставить только шаблон главного метода, если тесты действительно не нужны.
На homo_sapiensDebug в Arena, 19 месяцев назад
+3
> говорят даже можно как-то объединить арену и Visual Studio

http://www.topcoder.com/contest/classes/ExampleBuilder/ExampleBuilder.html
На xakliКто пишет на Free Pascal?, 19 месяцев назад
0
И что? Когда отправляешь на паскале, протокол тестирования отсутствует что ли?
На FORHAD-SUST-BDProblem Set Analysis Of CodeForces, 19 месяцев назад
0
Why are you writing 'codeforce' everywhere? It's 'codeforces'!
На xakliКто пишет на Free Pascal?, 19 месяцев назад
0
> даже и не знаю в чем ошибка

???
На HolkinPVCodeforces Beta Round #33 (Codeforces format), 19 месяцев назад
0
Replace 200 with something larger. The minimum path length may be upto 100*25
На xakliКто пишет на Free Pascal?, 19 месяцев назад
+8
> даже и не знаю в чем ошибка

На HolkinPVCodeforces Beta Round #33 (Codeforces format), 19 месяцев назад
0
А свою задачу заблокировал перед этим?
На HolkinPVCodeforces Beta Round #33 (Codeforces format), 19 месяцев назад
0
Нашел классную багу, отмотайте в этом комментарии историю назад и смотрите что происходит с ответом на него
На HolkinPVCodeforces Beta Round #33 (Codeforces format), 19 месяцев назад
0
Вероятность попадания юзеров в одну комнату не зависит от того, один и тот же это человек или нет =)
Хотя возможно, он зарегил 20 ботов abc, abcd, abcde и т.д. =)
На HolkinPVCodeforces Beta Round #33 (Codeforces format), 19 месяцев назад
+4
"разрешено заменить символ Ai на символ Bi в любой из строк"
"В следующих n строках заданы два символа Ai и Bi, (...), означающие, что разрешено заменить символ Ai на символ Bi"

Где здесь неоднозначность?