結果

問題 No.2331 Maximum Quadrilateral
ユーザー m_99m_99
提出日時 2023-05-28 14:38:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 971 bytes
コンパイル時間 3,851 ms
コンパイル使用メモリ 225,768 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 10:17:04
合計ジャッジ時間 7,774 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
4,380 KB
testcase_01 AC 74 ms
4,376 KB
testcase_02 AC 89 ms
4,380 KB
testcase_03 AC 89 ms
4,376 KB
testcase_04 AC 114 ms
4,376 KB
testcase_05 AC 121 ms
4,376 KB
testcase_06 AC 114 ms
4,376 KB
testcase_07 AC 102 ms
4,376 KB
testcase_08 AC 73 ms
4,376 KB
testcase_09 AC 68 ms
4,376 KB
testcase_10 AC 61 ms
4,376 KB
testcase_11 AC 67 ms
4,380 KB
testcase_12 AC 61 ms
4,376 KB
testcase_13 AC 65 ms
4,380 KB
testcase_14 AC 127 ms
4,376 KB
testcase_15 AC 11 ms
4,376 KB
testcase_16 AC 43 ms
4,376 KB
testcase_17 AC 4 ms
4,380 KB
testcase_18 AC 14 ms
4,376 KB
testcase_19 AC 5 ms
4,384 KB
testcase_20 AC 138 ms
4,380 KB
testcase_21 AC 138 ms
4,376 KB
testcase_22 AC 138 ms
4,376 KB
testcase_23 AC 138 ms
4,376 KB
testcase_24 AC 138 ms
4,376 KB
testcase_25 AC 1 ms
4,380 KB
testcase_26 AC 1 ms
4,380 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 1 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,380 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 1 ms
4,376 KB
testcase_43 AC 1 ms
4,376 KB
testcase_44 AC 1 ms
4,380 KB
testcase_45 AC 1 ms
4,380 KB
testcase_46 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int check(long long x0,long long y0,long long x1,long long y1,long long x2,long long y2){
	return (x1-x0) * (y2-y1) - (y1-y0) * (x2-x1);
}

long long get(long long x0,long long y0,long long x1,long long y1,long long x2,long long y2){
	x0 -= x2;
	y0 -= y2;
	x1 -= x2;
	y1 -= y2;
	return x0*y1 - x1*y0;
}

int main(){
	
	int N;
	cin>>N;
	
	vector<long long> x(N),y(N);
	rep(i,N){
		cin>>x[i]>>y[i];
	}
	
	long long ans = 0;
	rep(i,N){
		rep(j,N){
			if(i==j)continue;
			long long X = -Inf64,Y = Inf64;
			rep(k,N){
				if(k==i||k==j)continue;
				X = max(X,get(x[i],y[i],x[j],y[j],x[k],y[k]));
			
				Y = min(Y,get(x[i],y[i],x[j],y[j],x[k],y[k]));
				
			}
			ans = max(ans,X-Y);
		}
	}
	cout<<ans<<endl;
	
	return 0;
}
0