|
|||
optimize-2
We model a stock price with the following function: Currently we are at time . We want to know: given a time interval , what is the maximum profit () we can achieve by buying and then selling the stock. We can use any times for buying () and selling (). If we don’t buy/sell anything, our profit is of course. Input specificationAll data are integers. In the first line comes the number of test cases. Description of each test case: First line contains and . Next line contains . Third line contains , which are distinct values. Output specificationlines, each containing the requested number . Constraints
Sample input 1
Sample output 1
|
|||
| University of Debrecen; Faculty of Informatics; v. 09/30/2024 |