結果

問題 No.2790 Athena 3
ユーザー GOTKAKOGOTKAKO
提出日時 2024-06-21 21:26:36
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,317 bytes
コンパイル時間 1,945 ms
コンパイル使用メモリ 203,852 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-21 21:26:39
合計ジャッジ時間 2,569 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

struct Point{
    int x,y;
    Point() : x(0),y(0) {}
    Point(int a,int b) : x(a),y(b) {}
    Point(long long a,long long b) : x(a),y(b) {}
    Point(double a,double b) : x(a),y(b) {}
    Point &operator=(const Point &b) = default;
    Point operator+(const Point &b){return Point(x+b.x,y+b.y);}
    Point operator-(const Point &b){return Point(x-b.x,y-b.y);}
    Point operator+=(const Point &b){return *this=*this+b;}
    Point operator-=(const Point &b){return *this=*this-b;}
    bool operator==(const Point &b){return x==b.x && y==b.y;}
    bool operator!=(const Point &b){return x!=b.x || y!=b.y;}
};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int N = 3;
    vector<Point> P(3);
    for(int i=0; i<N; i++){
        int x,y; cin >> x >> y;
        P.at(i) = {x,y};
    }

    vector<Point> dxy = {{-1,0},{0,1},{1,0},{0,-1}};
    int answer = 0;
    for(int i=0; i<4; i++) for(int k=0; k<4; k++) for(int l=0; l<4; l++){
        auto a = P.at(0);
        auto b = P.at(1);
        auto c = P.at(2);

        a += dxy.at(i); b += dxy.at(k); c += dxy.at(l);
        b -= a; c -= a;

        answer = max(answer,abs(b.x*c.y-b.y*c.x));
    }
    if(answer%2 == 0) cout << answer/2 << endl;
    else cout << answer/2 << ".5" << endl;
}
0