Submission
Status:
[PPP-][PPP-][PPPP][PPPP][PPPP][PPPP][PPPP][P-SS]
Subtask/Task Score:
{0/13}{0/13}{13/13}{13/13}{13/13}{13/13}{13/13}{0/13}
Score: 65
User: NovemNotes
Problemset: ขนมปัง
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-17 14:05:14
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
int w,h,m,n;cin >> w >> h >> m >> n;
vector<int> v1(m),v2(n);
for(auto &x:v1)cin >> x;
for(auto &x:v2)cin >> x;
v1.emplace_back(w);
v2.emplace_back(h);
priority_queue<int,vector<int>,greater<int>> pq1,pq2;
for(int i=1;i<=m;i++){
pq1.push(v1[i]-v1[i-1]);
if(pq1.size()>2)pq1.pop();
}
for(int i=1;i<=n;i++){
pq2.push(v2[i]-v2[i-1]);
if(pq2.size()>2)pq2.pop();
}
v1.clear();v2.clear();
while(!pq1.empty()){
v1.emplace_back(pq1.top());
pq1.pop();
}
while(!pq2.empty()){
v2.emplace_back(pq2.top());
pq2.pop();
}
priority_queue<int> q;
for(auto &x:v1){
for(auto &y:v2){
// cout << x << " " << y << "\n";
q.push(x*y);
}
}
cout << q.top() << " ";
q.pop();
cout << q.top() << "\n";
return 0;
}