結果

問題 No.2331 Maximum Quadrilateral
ユーザー kotatsugamekotatsugame
提出日時 2023-05-28 15:43:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 200 ms / 2,000 ms
コード長 624 bytes
コンパイル時間 536 ms
コンパイル使用メモリ 64,660 KB
実行使用メモリ 4,852 KB
最終ジャッジ日時 2023-08-27 12:47:10
合計ジャッジ時間 5,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 179 ms
4,512 KB
testcase_01 AC 108 ms
4,432 KB
testcase_02 AC 129 ms
4,384 KB
testcase_03 AC 129 ms
4,388 KB
testcase_04 AC 166 ms
4,560 KB
testcase_05 AC 176 ms
4,488 KB
testcase_06 AC 166 ms
4,592 KB
testcase_07 AC 147 ms
4,456 KB
testcase_08 AC 105 ms
4,376 KB
testcase_09 AC 97 ms
4,432 KB
testcase_10 AC 88 ms
4,384 KB
testcase_11 AC 95 ms
4,380 KB
testcase_12 AC 87 ms
4,544 KB
testcase_13 AC 94 ms
4,504 KB
testcase_14 AC 183 ms
4,588 KB
testcase_15 AC 16 ms
4,376 KB
testcase_16 AC 63 ms
4,380 KB
testcase_17 AC 5 ms
4,376 KB
testcase_18 AC 19 ms
4,376 KB
testcase_19 AC 6 ms
4,380 KB
testcase_20 AC 200 ms
4,620 KB
testcase_21 AC 200 ms
4,600 KB
testcase_22 AC 199 ms
4,852 KB
testcase_23 AC 200 ms
4,620 KB
testcase_24 AC 199 ms
4,580 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,376 KB
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 1 ms
4,376 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,376 KB
testcase_37 AC 2 ms
4,380 KB
testcase_38 AC 2 ms
4,380 KB
testcase_39 AC 2 ms
4,376 KB
testcase_40 AC 2 ms
4,380 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 AC 2 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,376 KB
testcase_46 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
int N;
int X[400],Y[400];
long C[400][400];
int cross(int i,int j){return X[i]*Y[j]-X[j]*Y[i];}
long dp[3][400];
int main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>X[i]>>Y[i];
	for(int i=0;i<N;i++)for(int j=0;j<N;j++)C[i][j]=i!=j?cross(i,j):-(long)1e18;
	long ans=-1e18;
	for(int s=0;s<N;s++)
	{
		for(int t=0;t<N;t++)dp[0][t]=C[s][t];
		for(int k=0;k<2;k++)
		{
			for(int j=0;j<N;j++)dp[k+1][j]=-1e18;
			for(int i=0;i<N;i++)for(int j=0;j<N;j++)
			{
				dp[k+1][j]=max(dp[k+1][j],dp[k][i]+C[i][j]);
			}
		}
		for(int i=0;i<N;i++)ans=max(ans,dp[2][i]+C[i][s]);
	}
	cout<<ans<<endl;
}
0