Didn't notice a post from cgy4ever.

Topcoder SRM 718 will happen in ~4 hours.

Today due to a power outage there may be disruptions in the work of Codeforces and Polygon. Please do not plan any important events during this time. If there are details or the exact time, we will definitely publish them. Estimated time of maintenance: from 3 Aug, 14:30 (UTC) to 3 Aug, 18:00 (UTC).
×

# | User | Rating |
---|---|---|

1 | tourist | 3819 |

2 | Benq | 3745 |

3 | ksun48 | 3560 |

4 | Radewoosh | 3511 |

5 | Um_nik | 3489 |

6 | peehs_moorhsum | 3460 |

7 | Petr | 3414 |

8 | Miracle03 | 3410 |

9 | maroonrk | 3400 |

10 | sunset | 3338 |

# | User | Contrib. |
---|---|---|

1 | 1-gon | 208 |

2 | awoo | 182 |

3 | Errichto | 180 |

4 | Um_nik | 179 |

5 | -is-this-fft- | 174 |

5 | maroonrk | 174 |

7 | Radewoosh | 172 |

7 | tourist | 172 |

9 | SecondThread | 170 |

10 | rng_58 | 166 |

Didn't notice a post from cgy4ever.

Topcoder SRM 718 will happen in ~4 hours.

↑

↓

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Aug/03/2021 17:33:47 (g1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

I was the author of this round. You can see some short explanations here:

div2RelativeHeightsWe can just simulate what's asked in the problem. Be careful about comparing arrays for equality.

codeInterleavingParenthesisDiv2Hint: This is a DP problem. What do we need to remember? How exactly are correct parenthesis sequences formed?

hint1First, let '(' denote +1, and ')' denote -1. Then, a sequence is correct if all prefixes have nonnegative sum, and the overall sequence has sum 0. Let's ignore the constraint about overall sum being 0 (we can easily check this before doing anything). So, correct sequence can be extended from a previous correct sequence as long as its prefix sum stays nonnegative. So, this helps us write a dp state dp[i][j][k] -> # ways to form a correct sequence given we've used i characters from the first sequence, j characters from the second sequence, and our current prefix sum is k. This is fast enough for this problem.

hint2We don't actually need to store the actual prefix sum, since it's uniquely determined by the first i characters of the first string and first j characters of the second string.

codeChainCityhint1Look at example 3.

hint2Example 3 suggests if we want to split our line into k parts such that the maximum length part is minimized.

hint3Let's try to reverse the problem and use binary search instead. Now, we can see that we can proceed greedily.

codediv1InterleavingParenthesisYou can look at the solution for the div2 version of this problem (it is almost exactly the same, but you just need to make the observation in hint2 also).

codeCircleCityhint1Think about what happens if this is a line. Also, see example 3.

hint2Read the solution for ChainCity in div2.

codeChallenge: Originally, I had proposed this with constraints n <= 200,000. You can try to solve this version.

PermutationSubsequencehint1When do we have f(arr, |arr|-1) = |arr|?

hint2Can we generalize this condition to when f(arr, |arr|-k) = (|arr| choose k)?

hint3Try to come up with a way to compute g(arr) in polynomial time. Then, this means we can run a brute force over all permutations. This might be a bit slow for n=12, so are there ways to prune?

codeWhy such a big size in d1-250? I got tle just because I used the map instead of an array...

Edit. I just checked that |si| <= 1000 would fit within time limit, yet the incorrect O(n^3) solutions would still tle. I really don't get a point in such a huge string size...

Edit2. Ok — my bad, looks like some O(n^3) solutions might have passed or maybe my test was too weak. Anyway sad that I failed that task. True story is that even though I had O(|s1|*|s2|) solution, I stored a third parameter in the map. After the contest I realized that I do not need this parameter and hence I can use an array, without changing logic...

CircleCity for

n≤ 200 000.Maybe it's quarterly true, though, I think you should return CircleCity to the problem of Zeptolab's (it means if you solve CircleCity you can solve Zeptolab's if the constraints are same, but not vice versa). Because CircleCity is "placing k teleporters" and after a few ideas it can return the problem of "for given cycle graph you can erase atmost k edges, what is the maximum length of component?". After that it is easy greedy + binary-search because

n≤ 2000, so maybe it is not a main part. And also, Lewin already solved this Zeptolab's problem.Any hints for 1000 pointer?

I could prove that for

f(P,k) =C(n,k) we must have difference between adjacent elements ofP≥n+ 1 -k. But it seems it is not a sufficient condition.Your condition is close, but you also need to consider nonadjacent elements. More specifically you need to look at this expression

spoiler`min(|i-j| + |a[i] - a[j]|)`

over distinct positions i,jIs this condition

Spoilermin(|i-j| + |a[i] — a[j]|) <= X sufficient for X > 1?

Otherwise, what would you do to compute g(arr)?

How to prove this?

jiry_2's color is red in yellow..., so mysterious! I think it's a bug, right? (His topcoder rating is 2808)