結果

問題 No.2331 Maximum Quadrilateral
ユーザー shobonvipshobonvip
提出日時 2023-05-28 15:16:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,344 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 4,535 ms
コンパイル使用メモリ 262,504 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 11:46:42
合計ジャッジ時間 27,517 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,185 ms
4,376 KB
testcase_01 AC 697 ms
4,380 KB
testcase_02 AC 847 ms
4,380 KB
testcase_03 AC 845 ms
4,376 KB
testcase_04 AC 1,098 ms
4,376 KB
testcase_05 AC 1,166 ms
4,376 KB
testcase_06 AC 1,096 ms
4,376 KB
testcase_07 AC 972 ms
4,376 KB
testcase_08 AC 673 ms
4,376 KB
testcase_09 AC 618 ms
4,376 KB
testcase_10 AC 562 ms
4,376 KB
testcase_11 AC 608 ms
4,376 KB
testcase_12 AC 557 ms
4,376 KB
testcase_13 AC 594 ms
4,376 KB
testcase_14 AC 1,222 ms
4,376 KB
testcase_15 AC 82 ms
4,380 KB
testcase_16 AC 390 ms
4,376 KB
testcase_17 AC 18 ms
4,380 KB
testcase_18 AC 103 ms
4,380 KB
testcase_19 AC 26 ms
4,380 KB
testcase_20 AC 1,328 ms
4,376 KB
testcase_21 AC 1,338 ms
4,376 KB
testcase_22 AC 1,344 ms
4,376 KB
testcase_23 AC 1,341 ms
4,380 KB
testcase_24 AC 1,333 ms
4,376 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 1 ms
4,380 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,380 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 1 ms
4,380 KB
testcase_43 AC 1 ms
4,380 KB
testcase_44 AC 2 ms
4,376 KB
testcase_45 AC 2 ms
4,380 KB
testcase_46 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;

typedef modint998244353 mint;
typedef long long ll;

ll val(ll x1, ll y1, ll x2, ll y2, ll x, ll y){
	return (x2 - x1) * (y - y1) - (y2 - y1) * (x - x1);
}

int main(){
	int n; cin >> n;
	vector<ll> x(n), y(n);
	for (int i=0; i<n; i++){
		cin >> x[i] >> y[i];
	}
	ll ans = 0;
	for (int i=0; i<n; i++){
		for (int j=i+1; j<n; j++){
			vector<ll> ar;
			for (int k=0; k<n; k++){
				ll f = val(x[i], y[i], x[j], y[j], x[k], y[k]);
				if (val != 0) ar.push_back(f);
			}
			sort(ar.begin(), ar.end());
			if (ar[(int)ar.size()-1] > 0 && ar[0] < 0){
				ans = max(ans, ar[(int)ar.size()-1] - ar[0]);
			}
		}
	}
	cout << ans << endl;
}

0