結果

問題 No.2790 Athena 3
ユーザー Advaith GSAdvaith GS
提出日時 2024-06-21 21:52:08
言語 C++14
(gcc 12.3.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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