結果

問題 No.2790 Athena 3
ユーザー Advaith GSAdvaith GS
提出日時 2024-06-21 21:52:08
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,103 bytes
コンパイル時間 2,065 ms
コンパイル使用メモリ 174,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-21 21:52:12
合計ジャッジ時間 2,935 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define f(a,b) for(int a = 0;a < b; a++)
#define max(a,b) (a) > (b) ? (a) : (b)
#define min(a,b) (a) < (b) ? (a) : (b)

double area(std::pair<int,int> A,std::pair<int,int> B,std::pair<int,int> C){
  int t = A.first;
  double x = (A.first)*(B.second - C.second ) + (B.first)*(C.second - A.second ) + (C.first)*(A.second - B.second);
  x /= 2;
  return fabs(x);
}

int main(){
  std::pair<int,int> A;
  std::pair<int,int> B;
  std::pair<int,int> C;
  std::cin >> A.first >> A.second >> B.first >> B.second >>  C.first >> C.second;
  std::vector<std::vector<int>> arr = {{1,0},{0,1},{-1,0},{0,-1}};
  double ans = 0;
  for (auto i : arr){
    for (auto j : arr){
      for (auto k : arr){
        A.first += (A.second += i[1],i[0]);
        B.first += (B.second += j[1],j[0]);
        C.first += (C.second += k[1],k[0]);
        ans = max(area(A,B,C),ans);
        // std::cout << area(A,B,C) << '\n';
        A.first -= (A.second -= i[1],i[0]);
        B.first -= (B.second -= j[1],j[0]);
        C.first -= (C.second -= k[1],k[0]);
      }
    }
  }
  std::cout << ans << '\n';
}
0