mobin_t's blog

By mobin_t, 10 years ago, In English

Hello . Does anyone know how to register for codechef contests ?

For example for the procon 2014 ....

Full text and comments »

Tags aa, bb
  • Vote: I like it
  • 0
  • Vote: I do not like it

By mobin_t, 10 years ago, In English

Hello . I have recently seen a question and I want your help ....


We have a sequence of numbers . Each of them is 1 or -1 .

In every second we can choose a contiguous subsequence of them and do

the operation for each of them : a[i] = a[i] * -1

The question is that given the sequence what is the minimum time needed to transform all of the numbers to 1 ?


Example

Input :

6

1 -1 -1 1 -1 1

Output :

2

Full text and comments »

  • Vote: I like it
  • +8
  • Vote: I do not like it