結果

問題 No.2331 Maximum Quadrilateral
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-16 20:57:45
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 381 ms / 2,000 ms
コード長 1,192 bytes
コンパイル時間 2,894 ms
コンパイル使用メモリ 68,192 KB
実行使用メモリ 25,612 KB
最終ジャッジ日時 2023-10-16 20:57:59
合計ジャッジ時間 11,882 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 346 ms
23,616 KB
testcase_01 AC 231 ms
23,676 KB
testcase_02 AC 266 ms
21,724 KB
testcase_03 AC 266 ms
21,568 KB
testcase_04 AC 327 ms
23,816 KB
testcase_05 AC 342 ms
25,612 KB
testcase_06 AC 323 ms
23,620 KB
testcase_07 AC 296 ms
23,608 KB
testcase_08 AC 254 ms
23,544 KB
testcase_09 AC 214 ms
19,620 KB
testcase_10 AC 201 ms
21,764 KB
testcase_11 AC 212 ms
21,680 KB
testcase_12 AC 201 ms
23,556 KB
testcase_13 AC 210 ms
21,560 KB
testcase_14 AC 354 ms
23,664 KB
testcase_15 AC 86 ms
19,724 KB
testcase_16 AC 163 ms
21,640 KB
testcase_17 AC 69 ms
21,756 KB
testcase_18 AC 91 ms
21,680 KB
testcase_19 AC 71 ms
23,520 KB
testcase_20 AC 379 ms
21,636 KB
testcase_21 AC 381 ms
21,668 KB
testcase_22 AC 378 ms
21,620 KB
testcase_23 AC 379 ms
21,748 KB
testcase_24 AC 380 ms
21,656 KB
testcase_25 AC 64 ms
23,724 KB
testcase_26 AC 64 ms
23,736 KB
testcase_27 AC 63 ms
23,700 KB
testcase_28 AC 62 ms
21,572 KB
testcase_29 AC 63 ms
23,608 KB
testcase_30 AC 64 ms
21,704 KB
testcase_31 AC 64 ms
23,792 KB
testcase_32 AC 64 ms
21,692 KB
testcase_33 AC 61 ms
21,516 KB
testcase_34 AC 62 ms
21,572 KB
testcase_35 AC 63 ms
23,692 KB
testcase_36 AC 62 ms
21,656 KB
testcase_37 AC 62 ms
19,636 KB
testcase_38 AC 63 ms
23,688 KB
testcase_39 AC 62 ms
21,648 KB
testcase_40 AC 63 ms
23,792 KB
testcase_41 AC 63 ms
21,500 KB
testcase_42 AC 62 ms
21,632 KB
testcase_43 AC 62 ms
21,676 KB
testcase_44 AC 63 ms
21,680 KB
testcase_45 AC 62 ms
21,592 KB
testcase_46 AC 65 ms
21,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var map = NArr(n);
        var ans = 0;
        for (var i = 0; i < n; ++i) for (var j = i + 1; j < n; ++j)
        {
            var max = int.MinValue;
            var min = int.MaxValue;
            for (var k = 0; k < n; ++k)
            {
                if (i == k || j == k) continue;
                var op = OuterProduct(map[i][0] - map[k][0], map[i][1] - map[k][1], map[j][0] - map[k][0], map[j][1] - map[k][1]);
                max = Math.Max(max, op);
                min = Math.Min(min, op);
            }
            ans = Math.Max(ans, max - min);
        }
        WriteLine(ans);
    }
    static int OuterProduct(int ax, int ay, int bx, int by)
    {
        return ax * by - ay * bx;
    }
}
0