Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // NgJaBach: Forever Meadow <3
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- typedef unsigned long long ull;
- #define pb push_back
- #define pob pop_back
- #define mp make_pair
- #define upb upper_bound
- #define lwb lower_bound
- #define bend(a) a.begin(),a.end()
- #define rev(x) reverse(bend(x))
- #define mset(a) memset(a, 0, sizeof(a))
- #define fi first
- #define se second
- #define gcd __gcd
- #define getl(s) getline(cin, s);
- #define setpre(x) fixed << setprecision(x)
- #define endl '\n'
- const int N=200050,M=1000000007;
- const ll INF=1e18+7;
- ll dist(pair<ll,ll>A,pair<ll,ll>B){
- A.fi-=B.fi;
- A.se-=B.se;
- return sqrt(A.fi*A.fi+A.se*A.se);
- }
- ll tria(pair<ll,ll>A,pair<ll,ll>B,pair<ll,ll>C){
- return (dist(A,B)*dist(A,C));
- }
- ll cal;
- bool check(vector<pair<ll,ll> >gay){
- pair<ll,ll>A,B,C;
- sort(bend(gay));
- A=gay[0]; B=gay[1]; C=gay[2];
- if((A.fi==B.fi and B.fi==C.fi) or (A.se==B.se and B.se==C.se)) return false;
- if(A.fi==B.fi){
- if(A.se==C.se){
- cal=tria(A,B,C);
- return true;
- }
- else if(B.se==C.se){
- cal=tria(B,C,A);
- return true;
- }
- }
- else if(B.fi==C.fi){
- if(B.se==A.se){
- cal=tria(B,C,A);
- return true;
- }
- else if(C.se==A.se){
- cal=tria(C,A,B);
- return true;
- }
- }
- return false;
- }
- vector<pair<ll,ll> >vec;
- int main(){
- ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
- freopen("triangles.in","r",stdin);
- freopen("triangles.out","w",stdout);
- int n,a,b;
- ll ans=0;
- cin>>n;
- for(int i=0;i<n;++i){
- cin>>a>>b;
- vec.pb({a,b});
- }
- for(int i=0;i<n;++i){
- for(int j=i+1;j<n;++j){
- for(int k=j+1;k<n;++k){
- if(check({vec[i],vec[j],vec[k]})) ans=max(ans,cal);
- }
- }
- }
- cout<<ans;
- return 0;
- }
- /*
- ==================================+
- INPUT: |
- ------------------------------ |
- ------------------------------ |
- ==================================+
- OUTPUT: |
- ------------------------------ |
- ------------------------------ |
- ==================================+
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement