結果

問題 No.2790 Athena 3
ユーザー hotaosahotaosa
提出日時 2024-06-22 00:17:59
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,000 bytes
コンパイル時間 1,081 ms
コンパイル使用メモリ 89,224 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-22 00:18:01
合計ジャッジ時間 2,182 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>

using namespace std;

struct Point {
  double x, y;
  Point(double x, double y) : x(x), y(y) {}
  Point &operator+=(Point p) {
    x += p.x;
    y += p.y;
    return *this;
  }
  Point &operator-=(Point p) {
    x -= p.x;
    y -= p.y;
    return *this;
  }
  Point operator+(Point p) { return Point(*this) += p; }
};

double Area(Point a, Point b, Point c) {
  a -= c;
  b -= c;
  return abs((a.x * b.y - a.y * b.x) / 2.0);
}

int main() {
  int x1, y1, x2, y2, x3, y3;
  cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  Point p1(x1, y1), p2(x2, y2), p3(x3, y3);

  vector<Point> dp;
  dp.emplace_back(1, 0);
  dp.emplace_back(-1, 0);
  dp.emplace_back(0, 1);
  dp.emplace_back(0, -1);

  double res = 0.0;
  for (auto d1 : dp) {
    for (auto d2 : dp) {
      for (auto d3 : dp) {
        auto pp1 = p1 + d1;
        auto pp2 = p2 + d2;
        auto pp3 = p3 + d3;
        res = max(res, Area(pp1, pp2, pp3));
      }
    }
  }

  cout << res << endl;
  return 0;
}
0