All submissions for this problem are available.
There are three kinds of possibilities about temperature in cities around the world, one whose temperature remains negative, second whose temperature remains positive, and the rest that have temperatures varying from negative to positive values.
Now, our very own poster boy Divyam, decides to do a quick analysis of the temperature of cities. For a city, he records temperatures t(1), t(2) … t(n) for n days where t(i) is the temperature on the i-th day. Divyam’s hypothesis is justified if first the temperature is negative for some non-zero number of days and then positive for non zero number of days.
In particular the temperature should never be zero. and there must be a positive integer k lying between 1 and (n-1) (both inclusive) for which the temperature values are all negative and from k+1 to n the temperature values are all positive.
Divyam becomes happy only if his hypothesis is satisfied, and your task is to keep him happy. Thus making you to modify some temperature values to fit the conditions of his hypothesis. Find the minimum number of such values that are required to be modified
The first line contains a single integer n - representing the number of days for which Divyam runs his hypothesis testing experiment.
The second line contains n integers t(1), t(2), ..., t(n) — which is sequence of measured temperature values. Numbers ti are separated by single spaces.
Print a single integer — the answer to the given task.
2 ≤ n ≤ 105
|t(i)| ≤ 109
Input: 5 0 -4 1 1 -3 Output: 2
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, CLOJ, FS|
Fetching successful submissions