Didn't notice a post from cgy4ever.

Topcoder SRM 718 will happen in ~4 hours.

Before contest

Codeforces Round #602 (Div. 1, based on Technocup 2020 Elimination Round 3)

36:45:15

Register now »

Codeforces Round #602 (Div. 1, based on Technocup 2020 Elimination Round 3)

36:45:15

Register now »

*has extra registration

Before contest

Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3)

36:45:15

Register now »

Codeforces Round #602 (Div. 2, based on Technocup 2020 Elimination Round 3)

36:45:15

Register now »

*has extra registration

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

1 | tourist | 3532 |

2 | Radewoosh | 3434 |

3 | wxhtxdy | 3425 |

4 | Benq | 3368 |

5 | ecnerwala | 3301 |

6 | mnbvmar | 3280 |

7 | LHiC | 3276 |

8 | maroonrk | 3199 |

9 | yutaka1999 | 3190 |

10 | TLE | 3145 |

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

1 | Errichto | 192 |

2 | Radewoosh | 178 |

3 | tourist | 173 |

4 | antontrygubO_o | 167 |

4 | Vovuh | 167 |

4 | PikMike | 167 |

7 | rng_58 | 160 |

8 | majk | 157 |

9 | Um_nik | 152 |

9 | farmersrice | 152 |

Didn't notice a post from cgy4ever.

Topcoder SRM 718 will happen in ~4 hours.

↑

↓

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/22/2019 22:19:45 (h1).

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)