Computer Science, asked by soumyadip7432, 9 months ago

INPUT:
The first line of the input contains three space-separated integers N, U, and D

The second line contains N space-separated integers B1, B2, …, BN.
OUTPUT:
Print a single line containing one integer -- the index of the rightmost reachable ball.

Answers

Answered by shephali56
0

Answer:

Mavis went to market. On a shop, he saw Superhero Playing Cards. Each card has a Superhero and his power-up portrayed on it, i.e. each card has a power-up represented by an integer (can be negative, positive or zero).

He thought of buying some cards with unique Power-Up, and he wants to maximize his total power-up, but shopkeeper only sells cards which are consecutively placed to each other. Mavis wants your help in finding the maximum total power-up that he can get with all unique consecutive cards

Since he has entered into the shop so he will buy atleast one card

Input:

The first line of the input contains a single integer, N denoting the number of Playing Cards on the shop. The second line contains N space-separated integers. ith integer represent the power-up of ith card on the shop.

Output:

Print the maximum total power-up of the cards that he can buy, satisfying his uniqueness wish and shopkeeper’s requirement of consecutive cards.

Constraints :

1 ≤ N ≤ 105

-109 ≤ Power-ups ≤ 109

Explanation:

Explanation: He can buy 4 unique cards {1, 2, -2, 5} from 3rd card to 6th card, to have a Maximum Power-up count of 6.

Time Limit: 1,0 sec(s) for each input file.

Memory Limit: 256 MB

Source Limit: 1024 KB

Marking Scheme: Marks are awarded when all the testcases pass.

Allowed Languages: Bash, C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, TypeScript, Visual Basic

Answered by basaharshitha8
0

Answer:

the first line of the input contains three integers N,M, and k

Similar questions