結果

問題 No.2790 Athena 3
ユーザー VvyLwVvyLw
提出日時 2024-06-23 04:33:15
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,234 bytes
コンパイル時間 1,824 ms
コンパイル使用メモリ 122,188 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-23 04:33:19
合計ジャッジ時間 2,460 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <iostream>
#include <cmath>
#include <ranges>
constexpr int dx[] = {0, 0, -1, 1}, dy[] = {-1, 1, 0, 0};
constexpr auto d = std::views::iota(0, 4);
template <class T> constexpr inline bool chmax(T &a, const T &b) noexcept { if(a < b){ a = b; return true; } return false; }
int main() {
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    int x1, y1, x2, y2, x3, y3;
    std::cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    const auto sqr = [](const int64_t x) -> int64_t { return x * x; };
    long double res = 0;
    for(const auto a: d) {
        const int p1 = x1 + dx[a], q1 = y1 + dy[a];
        for(const auto b: d) {
            const int p2 = x2 + dx[b], q2 = y2 + dy[b];
            const long double x = std::sqrt(sqr(p1 - p2) + sqr(q1 - q2));
            for(const auto c: d) {
                const int p3 = x3 + dx[c], q3 = y3 + dy[c];
                const long double y = std::sqrt(sqr(p2 - p3) + sqr(q2 - q3)), z = std::sqrt(sqr(p3 - p1) + sqr(q3 - q1));
                const long double s = (x + y + z) / 2;
                chmax(res, std::sqrt(s * (s - x) * (s - y) * (s - z)));
            }
        }
    }
    std::cout << res << '\n';
}
0