Submission
Status:
[PPP-][PPP-][PPPP][PPPP][PPPP][PPPP][PPPP][P-SS]
Score: 65
User: Winzzwz
Problemset: ขนมปัง
Language: cpp
Time: 0.003 second
Submitted On: 2025-03-09 12:42:28
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int w,h,m,n,nn,old;
priority_queue<int> pq1,pq2;
int main() {
cin.tie(0)->sync_with_stdio(0);
cin >> w >> h >> m >> n;
for (int i = 1; i <= m; i++) {
cin >> nn;
if (i == 1) {old = nn; continue;}
pq1.push(nn-old);
old = nn;
}
pq1.push(w-old);
for (int i = 1; i <= n; i++) {
cin >> nn;
if (i == 1) {old = nn; continue;}
pq2.push(nn-old);
old = nn;
}
pq2.push(h-old);
int tempt1 = pq1.top();
int tempt2 = pq2.top();
int mx1 = tempt1 * tempt2;
pq1.pop();
int mx2 = pq1.top() * tempt2;
pq2.pop();
mx2 = max(mx2, pq2.top() * tempt1);
cout << mx1 << " " << mx2;
return 0;
}