Submission

Status:

[PPPP][PPPP][PPPP][PPPP][PPPP][PPPP][PPPP][PPPP]

Subtask/Task Score:

{13/13}{13/13}{13/13}{13/13}{13/13}{13/13}{13/13}{13/13}

Score: 100

User: anonymous

Problemset: ขนมปัง

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-21 13:14:22

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int w,h,m,n; cin >> w >> h >> m >> n;
    int a[1005];

    for(int i=0;i <= m;i++){
        static int m_last;
        int in;

        if(i == m) in = w;
        else cin >> in;

        a[i] = in - m_last;
        m_last = in;
    }

    int f_max = 0,s_max = 0;

    for(int i=0;i <= n;i++){
        static int n_last;
        int in;

        if(i == n) in = h;
        else cin >> in;

        int b = in - n_last;

        for(int j=0;j <= m;j++){
            int c = a[j] * b;

            if(c > f_max){
                s_max = f_max;
                f_max = c;
            }
            else if(c > s_max) s_max = c;
        }
        n_last = in;
    }

    cout << f_max << ' ' << s_max;

}