Plotting Good Graphs
All submissions for this problem are available.
Masadla is very passionate about his business. He has been working on it for past many years and wants to make it big. For this purpose he will be meeting an investor in the coming week. In the meeting he would have to show a graphical representation of the profit his business has been making .
He knows that to impress the investor, he must have a good non-dropping profit graph for his company. But unfortunately this wasn’t the case, so he decides to be clever and drop some numbers and make the graph non - dropping. But there is a catch - he can’t drop a lot of numbers as investor would then get to know what he has done .Can you help him figure out, how many such numbers at best he can retain which would satisfy the criteria he needs for plotting the graph?
The first line contains a single integer N denoting the number of profit data points for Masadla's business . The second line contains N space-separated integers A1, A2, ..., AN denoting the profit figures for his business in increasing order of time
For each test case, output one integer as solution for given input as per problem statement on new line.
4 1 5 5 7
- 1 ≤ N ≤ 100000
- -1000000 ≤ Ai ≤ 1000000
|Time Limit:||1 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