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!!
понедельник, 30 августа 2010 г.
воскресенье, 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!))
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?
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?
пятница, 18 июня 2010 г.
понедельник, 14 июня 2010 г.
CodeChef A Very Easy Problem!
It took me a half an hour to solve it... with recursion.
In the end i failed with Wrong Answer, just forgotten to see the format of output. My attention again against me :(.
Conclusion: I have solved A Very Ease Problem! using recursion with 2 submissions.
(It's very interesting why submission is only in PURE TEXT and C#2, but now it's not a problem of a coder :) )
CodeChef The Way to a Friends House Is Never Too Long problem
Brilliant! I used sort function from algorithms which is quick sort implementation, my Microsft C++ compiler compiled it well, but on codechef g++ 4.301 compiler failed to comile. I was abbused, no marks that i did something unusual. So I rewrote using list.sort(). It works!
One more situation, when microsoft compiler understands coder:)
воскресенье, 13 июня 2010 г.
Patric2
Attention. If you want to see my code and critisize, you are always welcome to topcoder arena and codechef.com. My coder nick is Patric2. Don't ask about the history of this name)
Подписаться на:
Сообщения (Atom)