Comments
On PetrPower towers problem, 20 hours ago
0

I saw a similar problem at the IFMO’s Internet Olympiad (russian statements, problem G). Unfortunately, jury’s solution and tests are incorrect.

On piloopCodeforces Round #119, 7 days ago
+48

Awesome and interesting problems, thank you very much!

If so, it looks strange, because such problems usually doesn’t require any skills except very basic school physics.

Could you tell about these tests? What is it like? Contests, yes/no tests or something else?

What is Physics problem? IOI’s olympiad in informatics, isn’t it?

On TintinHow can I implement it O(n)?, 11 days ago
0

Look: you have an array: 1 2 3 4 5. It has the following prefixes: "“, ”1“, ”1 2", and so on. You calculate sum of numbers in each such prefix and get 0, 1, 1+2=3, 1+2+3=6, 10 and 15 (let’s call it s[]). Then, to calculate, for example, sum from 2 to 4, you just calculate s[4] - s[1]=9. Elements before 2 were reduced.

This idea can help you solving this problem: you run down left border of a substring and then you can calc amount of required substrings in O(1) for each left border.

On TintinHow can I implement it O(n)?, 11 days ago
+1

Try this idea: calculate sums in all prefixes (from empty to the whole sequence) and then sum of elements in a some substring is difference of two numbers. Hope this helps. If not, I can give you detailed solution.

On Aksenov239Codeforces Round #118, 13 days ago
+11

Just good brute-force.

This opportunity was a present from admins in the first days of new year.

On Aksenov239Codeforces Round #118, 13 days ago
+2

May be no, because not so many people have solved E in Div2.

On Aksenov239Codeforces Round #118, 13 days ago
+3

Probably it won’t be.

On Aksenov239Codeforces Round #118, 13 days ago
+7

There are problems with Div1C/Div2E — jury’s solution is incorrect. This problem is under investigation and round can be unrated.

But sometimes they are so sloooooow. std::sync_with_stdio(0); treats it.

-1

Knapsack problem is NP and it’s not solvable using greedy algorithms. May be there are some special restrictions?

On Burunduk1VK Cup 2012 Round 3, 6 weeks ago
+17

Approximate meaning: 1)I enter Codeforces 2)Here I need to get in Top-300 2)Here I need to get in Top-50 4)When will be the round which I can fail?

On Burunduk1VK Cup 2012 Round 3, 6 weeks ago
+3

No. You not only edges corresponding to works, but also you need edges from t to t + 1.

On Burunduk1VK Cup 2012 Round 3, 6 weeks ago
+39

MinCostFlow. Vertex is a time, and work is a edge with capacity=1 and cost=-C. We need to find minimal cost flow not greater than K. V~1000, E~1000 and you even don’t need Dijkstra’s algorithm with potentials.

On GeraldCroc Champ 2012 — Round 1, 6 weeks ago
+7

There is one unofficial participant above Petr

with trip expenses covered by the organizing committee.

It’s a training, not even a contest (created with Codeforces::Gyms). And yes, it’ll be unrated.

Floyd’s algorithms gets TLE with TL=1s and V=500.

+1

No, because you didn’t qualify to Round 1.

+48

I think that Wild-card Round 2 will be some kind of marathon with challenging problem.

It’s usable anywhere with Microsoft Visual C++ — on your local machine and so on.

I see. Mike added that penalty is usual — 50 points per resubmission/wrong solution and you cannot be awarded less than 30% of points for correctly solved problem. So, for a solved 1000-points problem you’ll always get at least 300 points no matter of penalties.

As MikeMirzayanov answered above, there is penalty for resubmissions and errors on pretests, except failure on first test (even if there are more than one example test) — it’s ignored, as usual.

Not for qualifications. But problems are usually opened to everyone and you can submit solutions after contest’s end.

It’s UTC time. You can click on it to see what time will it be in your timezone.

Nohow. Stack size is a user limit under GNU/Linux and doesn’t depend on compiler. You can use ulimit -s to change/view it.

The only thing to add is that it’s MS Visual C++-specific and won’t work with GCC. In GCC you should specify -Wl,--stack=256000000 command line option to set stack size (in bytes).

+2

What’s source of the problem? It looks like test question.

For example: if your age is 23 years and 8 months (by the moment of registration), you can compete. If your age is at least 24 years, you cannot.

On NickolasSurprise Language Round #5, 3 months ago
0

“Note that numeric variables are read into strings and then converted into numbers — this is explained by the compiler specifics which reads numbers in different ways depending on whether they are read from cosole or from file redirected to the program input stream.”

Sorry, I’ve mixed it with Kyiv. These DST laws’ changes confuse me.

“in 7 hours” means “after 7 hours”. It’s 18:0019:00 Minsk time and 20:00 Moscow time.

If you use GCC, you can add -D__USE_MINGW_ANSI_STDIO=0 parameter to compilation command line and %lf will work quite OK.

%f is for float only. %lf is for double. It’s both for scanf and printf.

On GlebsHPCodeforces Round #107, 3 months ago
+1

Yes, it does.

On GlebsHPCodeforces Round #107, 3 months ago
+13

Because '\b' is a char too. It doesn’t have any special meaning outside terminal.

You can run gcc -E — it runs preprocessor and outputs preprocessed source.

What’s your problem? You don’t want to click twice, or I misunderstand you?

+8

In fact, when you work with floats/doubles (in spite of compiler), you should remember that any number (including integers) can be stored like X+-EPS. So, pow(3, 3) can be 26.9999999999999. If you cast it to int, it becomes 26, not 27. It’s better to use something like (int)(pow(3, 3) + 1e-9) here. There is a very good article on TopCoder about floating point arithmetics.

You can try MSVC++ compiler instead of GCC. GCC’s optimizer can give very strange results with floating point numbers, and they think that it’s well-known not bug

+1
Give a link to your submission (click on the '#' near it). Codeforces uses AJAX and dynamic pages, so the link you gave just takes me to the 'Status' page.
It will be unrated.
On zetagAverage, 4 months ago
+1
What is limitation for n?
You have incorrect formula for probability of element's selection.
Correct one is , if we select m elements of n, because each element can be selected equiprobably.
I have the following idea: d[n][m1][m2][k] is answer for the problem "what is probability, if n numbers remained, we need to select m1 of them, lotteryholder should select m2 of them and we win if at least k numbers will be selected".
For the first number we have four states, and each of them have fixed probability. So, we have four transitions to different states and solution in O(nm2k)
On SakalyaTernary search algorithm, 4 months ago
+22

Never do any searches (binary/ternary/etc) using r-l>EPS. This can result in infinite loop. You can read more about floating point numbers here.
It's better to limit this loop by iterations. 300 iterations should be more than enough.


P.S. f() can be not convex. Ternary search finds local minimum and maximum. So, it works on any function, that is monotonic both beyond and after some point. For example, it works on such function:


On MarioYCIs atan2 (C++) slow?, 5 months ago
+3
You can extend your 'point' struct and precalculate angles for points before sorting them. Now you have calls of atan2, and after precalculation you'll have only O(n2).

You can use macros. For example:
#define debug_var(x) debug(#x ": ", x)
So
debug_var(2+2);
will be compiled to
debug("2+2" ": ", 2+2);
On coder_1340FLOW and MATCHING at IOI, 5 months ago
+16
Thank you very much.
This solution has the same idea that mine (split into small groups and avoid big arithmetic).
Marvelous. I thought that it's impossible to improve in ints/long longs.
On coder_1340FLOW and MATCHING at IOI, 5 months ago
0
Wow, cool.
Can you tell about it?
On EndagorionCodeforces Beta Round #99, 5 months ago
0
Ratings have been updated already.
On coder_1340FLOW and MATCHING at IOI, 5 months ago
0

Excluded: Real and complex numbers, general conics (parabolas,
hyperbolas, ellipses), trigonometric functions

You can read syllabus here. As I know, it's the most recent version.

On coder_1340FLOW and MATCHING at IOI, 5 months ago
+3
As I know, different flow problems are excluded by syllabus. Even bipartite graphs are excluded.
By the other hand, big numbers arithmetic is excluded too, but one problem from IOI2011 cannot be solved without it.
On NewFolderDvorak VS QWERTY, 5 months ago
+6
My opinion is that QWERTY is much more popular than Dvorak, and it will be very hard to get a keyboard with Dvorak's layout if you need a one on a onsite competition.
On AkramjonI need help..., 6 months ago
+1
Integer can be negative.
On AkramjonI need help..., 6 months ago
+1
Read the problem's statement once more. It'll help
I can see an algorithmic bug in your code.
You can double-click on your submission ID and it will show you test, expected answer and your program's output.
If you still sure that something is going wrong, you'd better to give a link to submission. Like this: [[ submission : 123456 ]], or just click '#' near your submission
On vidudayaSolution has been Hacked, 6 months ago
+3
You'd better to read competition rules. It means that someone found test on which your solution works wrong. You cannot see this test, but it is added to your pretests.

On denchipa little joke, 6 months ago
+8
Labels on the first picture are:

Neurologist
...
Neurologist Korotkevich Gennady Vasilyevich
Traumatologist ...

In which form do you have this number? Is there any limitations on modulo?


On codeuppUser is disabled, 6 months ago
+3
I think you'd better ask MikeMirzayanov. Looks like your acc has broken one of Codeforces' rules, but I can't see any such thing.
On aropanCodeforces Beta Round #92, 6 months ago
+34
Russian. This word doesn't mean anything, it's interjection.
There is a very popular Soviet cartoon named "Tryam! Hello!" :)
On wituaCodeforces Beta Round #91, 7 months ago
0
I haven't heard anything about such plugin.
You're welcome to implement and share it :)
On wituaCodeforces Beta Round #91, 7 months ago
+7
Unfortunatelly, no.
May be your blog is a such place, but if care about your "contribution" you'd better to ask Google first :)
What IDE/OS do you use?
On wituaCodeforces Beta Round #91, 7 months ago
+4
If you use IDEA for Java, plugin from Egor can help you
May be you should try to enter date in the DD.MM.YYYY format?
I think that this buggy GCC optimizer is guilty. If you change your for with iterators to
for (int i = 0; i < a[u].size(); i++)
it'll work.

You forgot to initialize a[] before reading edges.

Never mind.


Can you tell us a little bit more about it?
On syco_3About Contribution., 7 months ago
+23
I think it's because not oblivious tradition on Codeforces of personlal blog usage.
Here it's more like a forum, where you can ask (of cause, you need to try to find answer yourself first) and get some answers, and not like a personal blog where you can post everything you want.
To do that, just save your post in drafts.

I see you have post with rating -6. Well, it's quite enough. May be you have comments with negative rating too.

Just try don't worry and ignore it - it's rather strange system yet.
Also you can do something like this:
  1. Let there is at least one 'bridge' edge in our graph (which does not lie on any non-self-intersected cycle). Have a look at its ends - vertexes A and B. There is exactly one path from A to B. Obliviously, we cannot choose orientation for this edge.
  2. Now we don't have any bridges in our graph. Let's run DFS and prove that if we choose 'from root to leaves' orientation for all tree edges and reverse orientation for the remaining ones, everything will be OK. First, it's oblivious that it's possible to reach any vertex from root (let it will be X). Then, let's prove that from each vertex A we can reach vertex B (parent of A in DFS' tree). In this case we can reach root by induction and our graph became strong-connected. So, we want to reach B from A. Let's remove edge from A to B from our graph. Because this edge wasn't a bridge, we have second path from A to B. Obliviously, we have some reverse edge from A's subtree to some of A's parents (we don't have cross-tree edges because it's DFS' tree). So, let's go to this edge's start, use it and then go down the tree. Ta-da :)
On pistonecodeforces t-shirts , 7 months ago
+4
Sure, thank you
On pistonecodeforces t-shirts , 7 months ago
+5

RiaD-WaW said: T-shirts in sport programmers world are impossible to buy. T-shirt is usually prize or  souvenir (you need to switch your language to Russian to see this comment).

On pistonecodeforces t-shirts , 7 months ago
-3
Double post
On codeKNIGHTOut of Comments!!, 7 months ago
0
What browser/OS do you use? I think this information can help admins
On codeKNIGHTFriend Request!!!, 9 months ago
0
'Friends' on Codeforces is like your own private bookmarks - you can add anyone to this list without asking permission.
On SammarizeCodeforces Beta Round 79, 9 months ago
+5
There is O(m*log(m)) algorithm.
The main idea is:
  1. If n is small, we can use DP - just calculate answer for each point
  2. Then, we understood that we are interested only in points, which are end point of some bus and our start point
  3. The last thing is to recalculate DP faster, than O(m). We have two types of events - some bus' segment is started/finished. Sort them and be happy

Yes, it can give different results. There're several problems here:
  1. Overflow. If a = b = c = d = e = 109, a· b· c· d· e is really larger than maximal value of int. So, result is undefined
  2. Rounding together with negative numbers. For example, 3/2/-1=1/-1=-1, but 3/(2·(-1))=3/(-2)=-2. UPD: it isn't correct in C/C++ (maybe Java), but correct in Python, because in C/C++ 3/(-2)=-1. Thanks to VladBelous
On MichaelYandex.Algorithm Finals, 10 months ago
+8
Intrigue...
We'll know results after the award ceremony.

I think you have a pretty big chances next year :)
On Manish-KumarWhy this happens?, 10 months ago
+1
You always need to use eps. All floating point numbers are saved with some error. In computer 0.333333333333333333 can be equal to 1.0 / 3.0. It's not really good idea to hope that this error is less than type's precision and we don't need eps.
On Manish-KumarWhy this happens?, 10 months ago
+5

Do you have -O2 enabled?
If yes, it's very common effect. Optimizer is guilty. This cout 'foribs' optimization of some code. It can change execution result, if you have arrays overflow or something like this.
Try to compile the first one without optimization and compare results.


On LichengImma Newcomer, 10 months ago
-4
Not end of string but end of line.
End of string char is '\0' and it's automatically appended to end of all strings in your program.
On dalexCodeforces Beta Round 76, 11 months ago
0
Yes, thank you.
On dalexCodeforces Beta Round 76, 11 months ago
+5

2
Select 7,8,10,11 and 6,9.
On sdryapkoIOI 2011, 11 months ago
+3
Use English please :)
Так сложилось))
On sdryapkoIOI 2011, 11 months ago
+32
Russian team:
Egor Suvorov CF: yeputons TC: yeputons
Aleksandr Timin CF: timinaleksandr TC: AlTimin
Pavel Kunyavskiy CF: kuniavski TC: kuniavski

Dmitry Egorov CF: Dmitry_Egorov TC: Dmitry_Egorov
On sdryapkoIOI 2011, 11 months ago
+13
For me - no, because it's about one year old only :)
On sdryapkoIOI 2011, 11 months ago
+38
Tourist is traveler
Yes, because in this case 'port' is a port of your proxy server, not TopCoder's.
If your proxy supports SOCKS (or smth), Arena will connect to port 5001. If you select 'HTTP Tunnel A/B", it'll use HTTP protocol (like any browser does) and 80-th port.
On yaroYandex.Algorithm 2011 - Round 2, 12 months ago
+69
Admins have a lot of fun already
You can run this code inside JVM:
// Get current size of heap in bytes
long heapSize = Runtime.getRuntime().totalMemory();

// Get maximum size of heap in bytes. The heap cannot grow beyond this size.
// Any attempt will result in an OutOfMemoryException.
long heapMaxSize = Runtime.getRuntime().maxMemory();

// Get amount of free memory within the heap in bytes. This size will increase
// after garbage collection and decrease as new objects are created.
long heapFreeSize = Runtime.getRuntime().freeMemory();

On ZLATKOQuick Questions, 12 months ago
+5

1)Nohow. It's impossible. All information you have is that your solution have been hacked and this test does not contain in pretests.
2)You need to lock any of solved problems first. To do this click on the lock near problem's name. After that you are unable to resend your solution even if it is hacked. But you can view others' solutions and try to hack its. To do this simply double-click on someone's score in the score table.


On ir5Codeforces Beta Round #71, 13 months ago
+2
How to solve the D problem?
On ir5Codeforces Beta Round #71, 13 months ago
+21
Oh my god. Two red writers. It'll be something.

Read the license. It's available through the 'FAQ' link in the main menu.
+10
Well, last contest problems C-E for Div.2 was A-C for Div.1
May be you are right, I think that problems are quiet harder that usual.