#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 ans=maxx*2*maxy*2;
set<ll>lelx,lely;
for(int i=0;i<n;i++)
{
if(abs(v[i].first)==maxx)
lelx.insert(abs(v[i].second));
if(abs(v[i].second)==maxy)
lely.insert(abs(v[i].first));
}
for(set<ll>::iterator it=lelx.begin();it!=lelx.end();it++)
{
for(set<ll>::iterator it2=lely.begin();it2!=lely.end();it2++)
{
ll barax=-1e11,baray=-1e11;
for(int i=0;i<n;i++)
if(abs(v[i].first)>*it2 && abs(v[i].second)>*it)
barax=max(barax,abs(v[i].first)),
baray=max(baray,abs(v[i].second));
if(barax!=-1e11)
ans=min(ans,maxx**it*4+4*maxy**it2+4*barax*baray),
ans=min(ans,barax*maxy*4+baray*maxx*4),
ans=min(ans,max(barax,baray)*2*maxy*2+*it*2*maxx*2),
ans=min(ans,*it2*2*maxy*2+max(barax,baray)*2*maxx*2);
else ans=min(ans,maxx**it*4+4*maxy**it2);
}
}
cout<<ans;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
256 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
248 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
6 |
Incorrect |
2 ms |
256 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 |
376 KB |
Output isn't correct |
10 |
Incorrect |
5 ms |
376 KB |
Output isn't correct |