All submissions for this problem are available.
Wonder Woman's invisible plane has various advanced computers. In particular, it can perform various operations on an array. Wonder Woman is a strategic warrior. She can formulate Luthor's robotic army's power as an array of integers. She has some queries over the array to gauge the enemy's power. Each query consists of 3 integers, l, r and x. The answer to a query is the maximum sum subarray lying between l to r in which you cannot pick an element greater than x. If no such subarray exists, print "xx". Since Doomsday crashed her plane, she needs your skills to help her answer these queries and formulate the ideal strategy.
The first line contains the size to the array, n and the number of queries, q.
- The next line contains n integers, the array.
- The next q lines contain 3 integers each, l,r and x.
Print the answer for every query.
Input: 3 1 1 2 3 1 3 3 Output: 6
|Time Limit:||2 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, 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, SCM chicken, CLOJ, FS|
Fetching successful submissions