All submissions for this problem are available.The Programming Club of TDTM is all set to host its first ever Annual Programming Contest “Tamboree” which will contain n problems in total with an uneven distribution of points to each problem . In order to solve the i th problem one needs to solve the (i-1) th problem. You’re asked $M$ queries Each query contains a number $P$ and you have to return the minimum number of problems one needs to solve in total in order to gain at least p points or return -1 if not possible to do so. ###Input: - First line will contain $N$, number of problems. -Second Line $N$ in integers ,points given to each problem - Next line will contain $M$ number queries - Next line will contain $M$ integers denoting $M$ queries ###Output: -Answer to all Query in one line with space in between ###Constraints - $1 \leq N,M,P \leq 100000$ ###Sample Input: 5 4 5 2 6 9 3 10 2 30 ###Sample Output: 3 1 -1
|Time Limit:||1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, rust, SCALA, swift, 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, SQL, kotlin, PERL6, TEXT, SCM chicken, PYP3, CLOJ, R, COB, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.