結果

問題 No.2790 Athena 3
ユーザー macaronmacaron
提出日時 2024-07-03 19:51:15
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 907 bytes
コンパイル時間 2,564 ms
コンパイル使用メモリ 244,004 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 19:51:19
合計ジャッジ時間 3,472 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 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 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#ifdef LOCAL
#include <algo/debug.h>
#else
#define debug(...) void(0)
#endif
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    fixed(cout).precision(12);
    auto calc = [](int x1, int y1, int x2, int y2, int x3, int y3) -> ld {
        int a1 = x2 - x1, b1 = y2 - y1;
        int a2 = x3 - x1, b2 = y3 - y1;
        return abs(a1 * b2 - a2 * b1) / ld(2);
    };
    ld ans = 0;
    int x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
    for(int i = 0; i < 4; i++) {
        for(int j = 0; j < 4; j++) {
            for(int k = 0; k < 4; k++) {
                ans = max(ans, calc(x1 + dx[i], y1 + dy[i], x2 + dx[j], y2 + dy[j], x3 + dx[k], y3 + dy[k]));
            }
        }
    }
    cout << ans << endl;
}
0