Блог пользователя BledDest

Автор BledDest, история, 9 лет назад, По-русски
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Разбор задач Educational Codeforces Round 28
  • Проголосовать: нравится
  • +24
  • Проголосовать: не нравится

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

Another nice idea for solving D can be — link .

»
9 лет назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

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

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

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can someone explain B more explicitly?

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится +1 Проголосовать: не нравится

    Suppose you know how many tasks you are solving completely, say i. This costs you i times the sum of costs over all subtasks, and gives you i*(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 i and take the maximum.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

can someone please explain problem C !

»
9 лет назад, скрыть # |
 
Проголосовать: нравится +5 Проголосовать: не нравится

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

  • »
    »
    9 лет назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    Elaborate it please..

    • »
      »
      »
      9 лет назад, скрыть # ^ |
      Rev. 2  
      Проголосовать: нравится 0 Проголосовать: не нравится

      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[k] = 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.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Кто может объяснить F-ку более явно.

»
9 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

E's trick in Input constraints! Missed it.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Different approach for F. For each unique value ai in the array find the probability that a random choice for l and r will contain at least one ai. To do this assuming we have all the positions of ai stored we can find the probability of the interval not containing ai by summing each of the probabilities of both l and r being in each of the disjoint intervals not containing ai, which is just the length of the interval squared divided by n2 and subtracting this from 1.

Finally by the linearity of expectation the answer is the sum of these probabilities over all distinct values in the array.

»
8 лет назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

That moment when you solve Div 2 A with DP!

»
4 года назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

we can find max size subwindow with dp. dp[i][j] = dp[i][j] * (min(dp[i][j-1],dp[i-1][j-1],dp[i-1][j])+1) dp[i][j] — right-bottom corner of the window