Maksim1744's blog

By Maksim1744, 5 years ago, In English

Continuing with the theme of absent editorials for old rounds, here is an editorial for Codeforces Round 171 (Div. 2). Even though there is an official editorial, it is only in russian and doesn't have solution for the last problem.

A

Editorial
Code

B

Editorial
Code

C

Editorial
Code

D

Editorial
Code

E

Editorial
Code
  • Vote: I like it
  • +111
  • Vote: I do not like it

| Write comment?
»
5 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

In problem C could you elaborate the last part of editorial

  • »
    »
    5 years ago, hide # ^ |
     
    Vote: I like it +8 Vote: I do not like it

    Let's look at $$$tol[i]$$$. If $$$a[i - 1] \lt a[i]$$$, then $$$tol[i] = i$$$, otherwise $$$a[i - 1] \geqslant a[i]$$$ and we can continue longest nonincreasing sequence which ends in $$$a[i - 1]$$$ by adding $$$a[i]$$$, so $$$tol[i] = tol[i - 1]$$$.

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

How do we do B using Binary search?

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Can we solve B with out Binary Search???

»
3 years ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

l mean problem b

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

Problem B can be solved using Queues

»
7 weeks ago, hide # |
← Rev. 2  
Vote: I like it 0 Vote: I do not like it

The code for Problem B is incorrect. If there is an element such that a[i] > t, it can produce a wrong answer, since the problem does not mention that a[i] <= t. If a[i] > t, the right pointer gets stuck at i — 1 and cannot move forward.