General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
43770149 Contestant:
InFiNaNt
1060C - 14 GNU C++14 Accepted 46 ms 56 KB 2018-10-04 11:01:13 2018-10-04 13:24:48
 
 
→ Source
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define cps CLOCKS_PER_SEC
#define mod (ll)1000000007
#define f first
#define s second
#define debug1(x) cerr<<x<<"\n"
#define debug2(x,y) cerr<<x<<" "<<y<<"\n"
#define debug3(x,y,z) cerr<<x<<" "<<y<<" "<<z<<"\n"
#define nl cerr<<"\n";
#define pq priority_queue
#define inf 0x3f3f3f3f
#define test cerr<<"abcd\n";
#define pi pair<int,int>
#define pii pair<int,pi>
#define pb push_back
#define mxn 200005
int main()
{
    //sp;
    ll n,m,x;
    cin>>n>>m;
    ll a[n+1],b[m+1],p[n+1],q[m+1];
    a[0]=0;
    b[0]=0;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    for(int i=1;i<=m;i++)
    {
        cin>>b[i];
    }
    cin>>x;
    for(int i=1;i<=n;i++)
    {
        a[i]+=a[i-1];
    }
    for(int j=1;j<=m;j++)
    {
        b[j]+=b[j-1];
    }
    for(int i=1;i<=n;i++)
    {
        ll ans=INT_MAX;
        for(int j=0;j<=n-i;j++)
        {
            ans=min(ans,a[j+i]-a[j]);
        }
        p[i]=ans;
    }
    for(int i=1;i<=m;i++)
    {
        ll ans=INT_MAX;
        for(int j=0;j<=m-i;j++)
        {
            ans=min(ans,b[j+i]-b[j]);
        }
        q[i]=ans;
    }
    ll ans=INT_MIN;

    for(ll i=1;i<=n;i++)
    {
        for(ll j=1;j<=m;j++)
        {
            if(p[i]*q[j]<=x)
            {
                ans=max(ans,i*j);
            }
        }
    }
    if(ans==INT_MIN)
    {
        cout<<"0\n";
        return 0;
    }
    cout<<ans<<"\n";
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details