// author: Daniel Delchev #include #include #include #include #include using namespace std; struct stock{ long long int stock_price; long int position; bool operator<(const stock& other)const{ return stock_price < other.stock_price; } }; //O(n) long int utmost_left(vector& prices,long long int stock_price,long int& start_index,long int& end_index, long long int& sum){ long int length = prices.size(); while (sum < stock_price && end_index < length-1){ sum -= prices[start_index++]; sum += prices[++end_index]; } return (sum < stock_price) ? (-1):start_index; } int main() { int N=0; int K=0; int Q=0; vector stock_prices; vector prices; scanf("%i",&N); scanf("%i",&K); scanf("%i",&Q); prices.reserve(N); stock_prices.reserve(Q); long int buffer; for (int i=0;i result; result.reserve(Q); result.assign(Q,-100); for (int i=0;i