Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

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

1 | tourist | 3438 |

2 | moejy0viiiiiv | 3288 |

3 | W4yneb0t | 3218 |

4 | LHiC | 3196 |

5 | TakanashiRikka | 3178 |

6 | Petr | 3163 |

7 | Um_nik | 3150 |

8 | izrak | 3109 |

9 | ershov.stanislav | 3105 |

10 | mnbvmar | 3018 |

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

1 | rng_58 | 179 |

2 | csacademy | 171 |

2 | tourist | 171 |

4 | Petr | 162 |

5 | Swistakk | 158 |

6 | Errichto | 156 |

7 | Zlobober | 152 |

7 | matthew99 | 152 |

9 | zscoder | 139 |

10 | Endagorion | 138 |

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial of Educational Codeforces Round 28

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Sep/20/2017 21:13:38 (p1).

Desktop version, switch to mobile version.

User lists

Name |
---|

Is the round rated?

Another nice idea for solving D can be — link .

Can someone tell me why I get wrong answer here in problem D?

http://codeforces.com/contest/846/submission/30118738

Sorry, the size of the array wasn't enough.

Can someone explain

more explicitly?BSuppose you know how many tasks you are solving completely, say

i. This costs youitimes the sum of costs over all subtasks, and gives youi*(k+1)points.For the remaining time, you are not solving complete tasks. How can you do separate subtasks most efficiently? They all give 1 point, so greedily keep solving the lowest time cost one until you have not enough time left.

So try every possible number for

iand take the maximum.Why not solve maximum number of tasks completely and then solve the remaining tasks greedily till we run out of time? I tried doing this, but didn't work.

For example input: 10 2 10 1 9

In this case you can solve 10 times subtask 1 (10 points) which is better than doing maximum number of tasks completely; that would be solving a single task completely (2 + 1 = 3 points).

Thank you!

Please elaborate the logic for Problem A.

can someone please explain problem C !

Problem C can be solved in linear time. Solution O(n).

Elaborate it please..

First let's solve subtask: Given an array of length N, for each 0 <= i < n we need to find k such that sum[0, k) — sum[k, i] = max.

Assume we store array A, where A[j] = sum[0, k) — sum[k, i]. Answer for current i is the maximum in A. Now we want to update it for i + 1. To do this reduce all A[0 <= j <= i] by x[i + 1], A[i + 1] = abs(sum[0, i + 1]). So we can use dp, because maximum answer for i + 1 is maximum of (ans[i] — x[i + 1]) and abs(sum[0, i + 1]).

Then iterate with c through array. It divides into two intervals: [0, c), [c, n). You need to find k1 and k2 such that (sum[0, k1) — sum[k1, c)) + (sum[c, k2) — sum[k2, n)) is maximum. We can use previously calculated dp because this two ranges are independent.

E's trick in Input constraints! Missed it.