結果

問題 No.2790 Athena 3
ユーザー hotaosa
提出日時 2024-06-22 00:17:59
言語 C++23
(gcc 13.3.0 + boost 1.87.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
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

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