понедельник, 30 августа 2010 г.

LCA, T9 tasks

Crape, Fuck!!!
Submition on Yandex 2 tasks:
1) LCA task with some modifications: 1 fail submit is for difference Microsoft compiler and GCC. FUCK ALL!! Next submition was great, ALL is OK!!))
2) T9 task submitted with some errors 4 times:
a) the difference from compilers
b) shit, wrong answer detected, sort function worked bad(
c) again wrong answer, sort worked bad cause of redefenition of < operator for struct
d) Shit............ A programmer trap!!! I have defined an array for M char elements, cin.getline() reads till end.. and... no place for '\0' symbol. Rrrr...X_x
e) After correcting a,b,c,d system showed me ALL OK!!

воскресенье, 29 августа 2010 г.

LCA

Least common ancestor - the next problem that I try to solve.
I have to versions of program: Tarjan and O(log(N)) finding ancestor.
Soon will see how it's made (for correctness and quality).

Seee http://e-maxx.ru/algo/lca. When i saw first time there algorithms, I thought: "Man, they use recursion EVERYWHERE". It's suprising. Alexander Shen writes in his books that you must find the way to avoid recursions!!

So, for big cycles whill be stack overflow. Just think: function calls itself, it must remember point of stop, all framebufer and so on...

But on the other hand : recursion helps us. Thanks you. mrs. recursion!))

Faster?

I'm fucking back.
Just to pity to know that all of people that I know Use cout/cin in C++.
Big data has to be read in many tasks and I use exactly scanf/cout instead.
"Why is this so" you would ask. Just turn on you computer, test, test and test.
ohh, I know, that read and write functions even more FASTER! I saw how Tomas Chaika (great problems solver, works in Google ;) Yep, exactly in Google ) writes his own input output class using read, write. But it's so big! I mean a lot of additional lines... God, I might use Assembler to read/write MORE FASTER, but.. did you think it is good idea to ignore standart libraries stdio and iostream?