結果

問題 No.2331 Maximum Quadrilateral
ユーザー Taiki0715Taiki0715
提出日時 2023-05-28 15:00:53
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 1,565 ms / 2,000 ms
コード長 2,527 bytes
コンパイル時間 3,679 ms
コンパイル使用メモリ 129,184 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 11:12:47
合計ジャッジ時間 30,293 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,380 ms
4,376 KB
testcase_01 AC 806 ms
4,380 KB
testcase_02 AC 981 ms
4,380 KB
testcase_03 AC 991 ms
4,380 KB
testcase_04 AC 1,279 ms
4,376 KB
testcase_05 AC 1,363 ms
4,380 KB
testcase_06 AC 1,274 ms
4,380 KB
testcase_07 AC 1,130 ms
4,384 KB
testcase_08 AC 783 ms
4,376 KB
testcase_09 AC 719 ms
4,376 KB
testcase_10 AC 654 ms
4,380 KB
testcase_11 AC 708 ms
4,380 KB
testcase_12 AC 647 ms
4,380 KB
testcase_13 AC 687 ms
4,380 KB
testcase_14 AC 1,421 ms
4,380 KB
testcase_15 AC 94 ms
4,380 KB
testcase_16 AC 451 ms
4,380 KB
testcase_17 AC 22 ms
4,384 KB
testcase_18 AC 120 ms
4,380 KB
testcase_19 AC 31 ms
4,380 KB
testcase_20 AC 1,558 ms
4,376 KB
testcase_21 AC 1,565 ms
4,376 KB
testcase_22 AC 1,550 ms
4,380 KB
testcase_23 AC 1,565 ms
4,380 KB
testcase_24 AC 1,549 ms
4,380 KB
testcase_25 AC 2 ms
4,380 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,384 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,384 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,380 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 ms
4,380 KB
testcase_43 AC 2 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 2 ms
4,384 KB
testcase_46 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:47:17: warning: implicit conversion from 'double' to 'R' (aka 'int') changes value from 1.0E-12 to 0 [-Wliteral-conversion]
constexpr R eps=1e-12;
            ~~~ ^~~~~
main.cpp:48:16: warning: implicit conversion from 'double' to 'R' (aka 'int') changes value from 3.141592653589793 to 3 [-Wliteral-conversion]
constexpr R pi=3.141592653589793238;
            ~~ ^~~~~~~~~~~~~~~~~~~~
2 warnings generated.

ソースコード

diff #

#include <iostream>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <math.h>
#include <cassert>
#include <bitset>
#include <map>
#include <algorithm>
#include <iterator>
#include <string>
#include <utility>
#include <numeric>
#include <regex>
#include <complex>
#include <atcoder/all>
using namespace atcoder;
using namespace std;
using ll=long long;
using ull=unsigned long long;
using P=pair<ll,ll>;
template<typename T>using minque=priority_queue<T,vector<T>,greater<T>>;
template<typename T>bool chmax(T &a,const T &b){return (a<b?(a=b,true):false);}
template<typename T>bool chmin(T &a,const T &b){return (a>b?(a=b,true):false);}
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
  os<<p.first<<" "<<p.second;
  return os;
}
template<typename T1,typename T2>
istream &operator>>(istream &is,pair<T1,T2>&p){
  is>>p.first>>p.second;
  return is;
}
template<typename T>
istream &operator>>(istream &is,vector<T> &a){
  for(auto &i:a)is>>i;
  return is;
}
#define reps(i,a,n) for(int i=(a);i<(n);i++)
#define rep(i,n) reps(i,0,n)
#define all(x) x.begin(),x.end()
ll myceil(ll a,ll b){return (a+b-1)/b;}
using R=int;
using Point=complex<R>;
constexpr R eps=1e-12;
constexpr R pi=3.141592653589793238;
inline bool equal(const R &a,const R &b){
  return fabs(a-b)<eps;
}
Point unit_vector(const Point &a){return a/abs(a);}
R dot(const Point &a,const Point &b){//内積
  return a.real()*b.real()+a.imag()*b.imag();
}
R cross(const Point &a,const Point &b){//外積
  return a.real()*b.imag()-a.imag()*b.real();
}
Point rotate(const Point &a,const R t){
  return Point(cos(t)*a.real()-sin(t)*a.imag(),sin(t)*a.real()+cos(t)*a.imag());
}
struct Line{
  Point a,b;
  Line(Point a,Point b):a(a),b(b){}
  Line(R A,R B,R C){
    assert(!(equal(A,0)&&equal(B,0)));
    if(equal(A,0)){
      a=Point(0,C/B),b=Point(1,C/B);
    }
    else if(equal(B,0)){
      a=Point(C/A,0),b=Point(C/A,1);
    }
    else{
      a=Point(C/A,0),b=Point(0,C/B);
    }
  }
};
int main(){
  int n;
  cin>>n;
  vector<Point>a(n);
  rep(i,n){
    R x,y;
    cin>>x>>y;
    a[i]={x,y};
  }
  int ans=0;
  rep(i,n-1)reps(j,i+1,n){
    vector<R>s,t;
    rep(k,n){
      if(k==i||k==j)continue;
      R area=cross(a[i]-a[k],a[j]-a[k]);
      if(area>0)s.push_back(area);
      else t.push_back(-area);
    }
    sort(all(s),[&](auto x,auto y){return x>y;});
    sort(all(t),[&](auto x,auto y){return x>y;});
    if(s.empty()||t.empty())continue;
    chmax(ans,s[0]+t[0]);
  }
  cout<<ans<<endl;
}
0