結果
問題 | No.2790 Athena 3 |
ユーザー | GOTKAKO |
提出日時 | 2024-06-21 21:26:36 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.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 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#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; }