結果
| 問題 |
No.2790 Athena 3
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-06-29 14:28:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 829 bytes |
| コンパイル時間 | 1,790 ms |
| コンパイル使用メモリ | 171,248 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-29 14:28:40 |
| 合計ジャッジ時間 | 2,580 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
int main() {
vector<int> x(3), y(3);
rep(i, 3)
cin >> x[i] >> y[i];
auto s2 = [&](vector<int> x, vector<int> y) {
rep(i, 2) {
x[i+1] -= x[0];
y[i+1] -= y[0];
}
x[0] = 0, y[0] = 0;
return abs(x[1] * y[2] - x[2] * y[1]);
};
int ans = 0;
vector<int> dx = {1, -1, 0, 0};
vector<int> dy = {0, 0, 1, -1};
auto dfs = [&](auto dfs, int i, vector<int> x, vector<int> y) {
if (i == 3) {
ans = max(s2(x, y), ans);
return;
}
rep(j, 4) {
x[i] += dx[j];
y[i] += dy[j];
dfs(dfs, i + 1, x, y);
x[i] -= dx[j];
y[i] -= dy[j];
}
return;
};
dfs(dfs, 0, x, y);
cout << fixed << setprecision(1) << (float)ans / 2 << endl;
return 0;
}