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: AugusEiEi

Problemset: ขนมปัง

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-23 13:38:33

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

int main(){
  ios_base::sync_with_stdio(0); cin.tie(0);
  int x,y,n,m;cin>>x>>y>>n>>m;
  vector<int>ver(n+1);
  vector<int>hor(m+1);
  int a=0,b=0;
  for(int i=0;i<n;i++){
    int u;cin>>u;
    if(i==0) ver[i]=u;
    else ver[i]=u-a;
    a=u;
  }
  ver[n]=x-a;
  for(int i=0;i<m;i++){
    int u;cin>>u;
    if(i==0) hor[i]=u;
    else hor[i]=u-b;
    b=u;
  }
  hor[m]=y-b;
  sort(ver.begin(),ver.end(),greater<int>());
  sort(hor.begin(),hor.end(),greater<int>());
  vector<int>ans(4);
  ans[0]=ver[0]*hor[0];
  ans[1]=ver[0]*hor[1];
  ans[2]=ver[1]*hor[0];
  ans[3]=ver[1]*hor[1];
  sort(ans.begin(),ans.end(),greater<int>());
  cout<<ans[0]<<" "<<ans[1];
}