#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
using namespace std;
int main()
{
int n;
cin>>n;
vector<pair<ll,ll> > v(n);
ll maxx=0, maxy=0;
for(int i=0;i<n;i++)
cin>>v[i].first>>v[i].second,
maxx=max(maxx,abs(v[i].first) ),maxy=max(maxy,abs(v[i].second) );
ll emtedadx=1e11,emtedady=1e11 ;
for(int i=0;i<n;i++)
{
if(abs(v[i].first)==maxx)
emtedadx=min(emtedadx,abs(v[i].second));
if(abs(v[i].second)==maxy)
emtedady=min(emtedady,abs(v[i].first));
}
ll barax=-1e11,baray=-1e11;
emtedadx=abs(emtedadx);
emtedady=abs(emtedady);
for(int i=0;i<n;i++)
{
if(abs(v[i].first)>emtedady && abs(v[i].second)>emtedadx)
barax=max(barax,abs(v[i].first)),
baray=max(baray,abs(v[i].second));
}
ll ans=maxx*2*maxy*2;
if(barax==-1e11 && baray==-1e11)
{ans=min(ans,emtedady*2*maxy*2+emtedadx*2*maxx*2);goto go;}
ans=min(ans,emtedady*2*maxy*2+emtedadx*2*maxx*2+barax*2*baray*2);
ans=min(ans,barax*2*maxy*2+baray*2*maxx*2);
ans=min(ans,max(barax,baray)*2*maxy*2+emtedadx*2*maxx*2);
ans=min(ans,emtedady*2*maxy*2+max(barax,baray)*2*maxx*2);
go:;
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
7 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
8 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
9 |
Incorrect |
3 ms |
380 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |