thetwoface's blog

By thetwoface, history, 9 months ago, In English

Given a binary string s, the objective is to divide it into subsegments such that all bits into that segment is identical(i.e. either '0' or '1') and the subsegments should be of even length. Mathematically for any subsegment Bi ∈ s ⇒ len(Bi)%2==0 and ∀ j either Bij='0' or '1' . The criteria to achieve this: 1. This should be done in minimum number of flips required to form an Identical even subsegments. 2. And Minimize the total number of subsegments. Outpur the minimum number of subsegments.

NOTE: First you have to minimize the number of flips before minimizing subsegments.

Constraints are: 2<= s.size() <=10^5

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By thetwoface, history, 9 months ago, In English

The constraints are 1<n<=10⁵ and a[i]<=10⁹ Now you are given an array a. You task is to find minimum in the current sized array and remove that element and it's adjacent elements. The cost of this operation will be the minimum element choosen. Repeat this step till array becomes empty. Mathematically, for any i within array limit such that a[i] is minimum of array a, then remove a[i] and if i-1 exists remove a[i-1] and if i+1 exists a[i+1], the cost will be cost+=a[i] , the array will become {a1, a2,...ai-2,ai+2,....an} again find minimum and repeat the same till array becomes empty. NOTE: ELEMENTS NEED NOT TO BE UNIQUE. IF THERE ARE MULTIPLE MINIMIUMS CHOOSE THE ONE WITH LOWEST INDEX

Full text and comments »

  • Vote: I like it
  • -6
  • Vote: I do not like it

By thetwoface, history, 20 months ago, In English

Bring my Pinely Round 4 (Div. 1 + Div. 2) ratings back whose solutions are skipped and myy ratings were roll backed and reduced. I haven't cheated, i write my own code in sublime and try to build my logic sure i am newbie tryna push for pupil and specialist, but things would lead me down. I request Codeforces to bring my ratings back._

Full text and comments »

  • Vote: I like it
  • -25
  • Vote: I do not like it