|
0
Dear meeeep, Edit: In your example, 50 goods are transferred from cities 0 and 1 to 2. Then there will be 100 goods in each city — my code covers this sample case. But I have made an example, which will break my code: Here, 3 goods will be transferred to 2-nd city: 2 from 0-th, and 1 from 1-st. A better way is to move 1 unit of good from 0-th to 1-st city, and then move 2 goods from cities 0 and 1 to city 2, that is 4 goods in total. I supposed that there should be only direct transfers, that the same goods couldn't be transferred from city 1 to city 3 via city 2. Hope to read the description more thoroughly and do better next time. |
|
0
Problem E. Goods transportation — Why is this O(n*n) approach incorrect? 0.1. i goes from n-1 to 0: 1.1. trans = min(prods[i], sells[i]); // Sell as much as possible at the current i-th city. ans += trans; sells[i] -= trans; 1.2. j goes from i-1 down to 0: trans = min(sells[i], c, prods[j]); // Transfer as much as possible from the j-th city. ans += trans; prods[j] -= trans; sells[i] -= trans; 1.3. Output the ans. |
|
0
You are right. I was thinking of writing about this in a separate post tomorrow, but you were the first to bring it up! Consider a connected graph on 4 vertices: a,b,s,t. Edges: as, at, bs, bt. Using edges as, bs implies that either at or bt must be used. Thus the citation "or with both of them (only if we have in the graph an edge {s, t})" is not (!) valid meaning that the example above does not have an edge between s and t, yet both s and t must be used. I wonder whether this situation is covered in the system tests? |
|
0
First, let's notice that problem is Div2F, not E. I guess it was meant, that at the end the graph is restored(!) by getting back s, t, and all the deleted edges if any. After step 2, vertices s and t will belong to the two spanning trees. Assume s and t in the same component; otherwise we are done. These two spanning trees should be linked to the remaining components as well as to each other either directly or indirectly. |
|
0
To see someone's submissions, go to user's profile Dabagh, and click the SUBMISSIONS menu item. |
|
0
If you insert an extra border of water(`.'), presenting an ocean, around 4 sides of the area, there will be no runtime errors as "i" can go from 0 to n+1, and j from 0 to m+1. First of all, visit the (0,0) which is the ocean, then proceed with the main area. http://mirror.codeforces.com/contest/723/submission/21156099 |
|
0
I spent some time on solving C, then decided to solve D first, and then returned back to C. What do you do if you do not have full understanding of a problem? |
|
0
Here is a good article, explaining segment tree, at codeforces |
|
+8
Visit clist.by |
|
0
hacking is open... |
|
0
Each problem e.g. http://mirror.codeforces.com/contest/704/problem/D usually has a tag attached (flows in this case), but it is not possible to filter by the tag from the problem's page. To apply the filter, one may go to http://mirror.codeforces.com/problemset, and click the tag e.g. http://mirror.codeforces.com/problemset/tags/flows Q1. I wonder is there a better way to filter by a tag? Q2. I wanted to solve at least one problem per each tag — is there a list of all tags? |
|
0
It looks like the issue is the same — please see my comment above http://mirror.codeforces.com/blog/entry/46450?#comment-309097 |
|
0
Event 3 is processed incorrectly: the fact that there are some unread application x events (byApp(x) > 0) does not imply that those events are among the first t events. E.g. given 3 4 1 1 2 1 1 1 3 1, your code will delete the second addition event "1 1" whereas it should not have. |
|
0
Consider this example, where the last monster (5, 0) is unreachable: 2 3 1 0 3 0 2 0 4 0 5 0 |
|
+5
Your code finds some interval, not necessarily the shortest one. Consider an example: 8 abcaabbc Your code will first move l from 0 to 4, leaving r=7, and then stop on "abbc" getting 4 whereas the returned value should be 3 (the first three letters "abc"). |
|
0
In problem B, "d contains no trailing zeros" could basically mean that d can have leading 0s. For example, 0.0001e1 should be printed as 0.001; 0.01e2 as 1; 0.01e5 as 1000; and 1.02e5 as 102000. |
|
+4
As for me, it makes me a better coder because almost every contest I learn something new, polish my skills, encounter interesting problems that raise beyond my current job level. Also, when I look at the code of the world best programmers, I see that still there so are many things I have to put to my pocket. |