wuhudsm's blog

By wuhudsm, history, 17 months ago, In English

A

code
solution

B

code
solution

C

code
solution

D

code
solution

E

code
solution

F

code
solution

G

code
solution
  • Vote: I like it
  • +21
  • Vote: I do not like it

»
17 months ago, # |
  Vote: I like it 0 Vote: I do not like it

For C, I have been trying this dp solution but it seems to be failing for tc 14.

dp[i][0] means including the ith round no round has been skipped yet.

dp[i][1] means including the ith round exactly one round has been skipped.

dp[i][0] = dp[i-1][0] if current i is unrated

dp[i][0] = dp[i-1][0] + f((p[i] — dp[i-1][0])/4.0) if current i is rated

dp[i][1] = max(dp[i-1]) if current i is unrated

dp[i][1] = max(dp[i-1][0], dp[i-1][1] + f((p[i] — dp[i-1][1])/4.0))

216641777

  • »
    »
    17 months ago, # ^ |
      Vote: I like it +1 Vote: I do not like it

    Your solution is incorrect.

    In case:

    3 2200
    1400 200 0
    1 1 1
    

    $$$500$$$ is expected but your code output $$$650$$$.

  • »
    »
    17 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Same works if we maintain separate states for 3 different things (<1900, <2100 and >=2100).

»
17 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Can you please share the link of the group, if anyone wants to join it.