結果
| 問題 |
No.2790 Athena 3
|
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2024-06-21 21:32:28 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 688 bytes |
| コンパイル時間 | 707 ms |
| コンパイル使用メモリ | 92,620 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-21 21:32:30 |
| 合計ジャッジ時間 | 1,359 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
int x[3], y[3];
for (int i = 0; i < 3; ++i) cin >> x[i] >> y[i];
double ans = 0;
auto dfs = [&](auto f, int id) -> void
{
if (id >= 3)
{
int vx[2], vy[2];
for (int i = 1; i < 3; ++i)
{
vx[i - 1] = x[i] - x[0];
vy[i - 1] = y[i] - y[0];
}
double tmp = abs(vx[1] * vy[0] - vx[0] * vy[1]) / 2.0;
ans = max(ans, tmp);
return;
}
for (int i = 0; i < 4; ++i)
{
x[id] += dx[i];
y[id] += dy[i];
f(f, id + 1);
x[id] -= dx[i];
y[id] -= dy[i];
}
};
dfs(dfs, 0);
printf("%.1f\n", ans);
}
テナガザル