wans-caesar-02111007

CF1060C Maximum Subrectangle

题意翻译

现在给出一个长度为N的a数列,一个长度为Mb数列. 现在需要构造出一个矩阵c,其中ci,j=ai×bj.再给出一个x,请在矩阵中找出一个最大的矩形,使得这个矩形中的所有值的和小于等于x.

题目描述

You are given two arrays aa and bb of positive integers, with length n and m respectively.

Let c be an n×m matrix, where ci,j=aibj .

You need to find a subrectangle of the matrix c such that the sum of its elements is at most x , and its area (the total number of elements) is the largest possible.

Formally, you need to find the largest number s such that it is possible to choose integers x1,x2,y1,y2 subject to n1x1x2n , m1y1y2m , (x2x1+1)×(y2y1+1)=s , and $\sum_{i=x_1}^{x2}{\sum_{j=y_1}^{y2}{c{i,j}}} \leq x.$ 

输入输出格式

输入格式:

 

The first line contains two integers n and m ( 1n,m2000 ).

The second line contains n integers a1,a2,,an ( 1ai2000 ).

The third line contains m integers b1,b2,,bm ( 1bi2000 ).

The fourth line contains a single integer x ( 1x2109 ).

 

输出格式:

 

If it is possible to choose four integersx1,x2,y1,y2 such that n1x1x2n ,  m1y1y2m , and xi=x1x2j=y1y2ci,jx , output the largest value of (x

分类:

技术点:

相关文章: