Submission
Status:
[PPPPP][PPP][PPPPPPP]
Score: 100
User: hmmm
Problemset: 05.Two Towers
Language: cpp
Time: 0.031 second
Submitted On: 2025-04-04 20:01:54
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
int mp1[N],mp2[N];
int main(){
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
memset(mp1,0x3f,sizeof mp1);
for(int i=1;i<=n;i++){
int p,h;
cin >> p >> h;
mp1[h]=min(mp1[h],p);
mp2[h]=max(mp2[h],p);
}
// cout << mp1[1];
long long int ans=0;
for(int i=1;i<=2000;i++){
for(int j=1;j<=2000;j++){
if(mp1[i]==1061109567 || mp2[j]==0) continue;
ans=max(ans,1ll*min(i,j)*abs(mp1[i]-mp2[j]));
}
}
cout << ans;
}