結果

問題 No.2331 Maximum Quadrilateral
ユーザー tomo0608
提出日時 2023-05-28 15:45:57
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 59 ms / 2,000 ms
コード長 8,635 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 214,760 KB
最終ジャッジ日時 2025-02-13 13:55:15
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

/**
* author: tomo0608
* created: 01.05.2023 18:24:08
**/
#ifdef __LOCAL
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#include <atcoder/modint>
namespace tomo0608 {
typedef long long ll;
typedef long double ld;
template <class T> using V = std::vector<T>;
template <class T> using VV = V<V<T>>;
template <class T> using VVV = V<VV<T>>;
typedef std::pair<int, int> pii;
typedef std::pair<long long, long long> pll;
template<class... T>void input(T&... a) { (std::cin >> ... >> a); };
#define INT(...) int __VA_ARGS__; input(__VA_ARGS__)
#define LL(...) long long __VA_ARGS__; input(__VA_ARGS__)
#define STR(...) string __VA_ARGS__; input(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__; input(__VA_ARGS__)
std::istream& operator>>(std::istream& is, atcoder::modint998244353& a) { long long v; is >> v; a = v; return is; }
std::ostream& operator<<(std::ostream& os, const atcoder::modint998244353& a) { return os << a.val(); }
std::istream& operator>>(std::istream& is, atcoder::modint1000000007& a) { long long v; is >> v; a = v; return is; }
std::ostream& operator<<(std::ostream& os, const atcoder::modint1000000007& a) { return os << a.val(); }
template<int m> std::istream& operator>>(std::istream& is, atcoder::static_modint<m>& a) { long long v; is >> v; a = v; return is; }
template<int m> std::ostream& operator<<(std::ostream& os, const atcoder::static_modint<m>& a) { return os << a.val(); }
template<int m> std::istream& operator>>(std::istream& is, atcoder::dynamic_modint<m>& a) { long long v; is >> v; a = v; return is; }
template<int m> std::ostream& operator<<(std::ostream& os, const atcoder::dynamic_modint<m>& a) { return os << a.val(); }
template<class T1, class T2> std::istream& operator>>(std::istream& is, std::pair<T1, T2>& p) { is >> p.first >> p.second; return is; }
template<class T1, class T2> std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) { os << '(' << p.first << ", " << p.second <<
        ')'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& v) { for (auto& e : v) is >> e; return is; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) { for (auto& e : v) os << e << ' '; return os; }
template<typename T> std::ostream& operator << (std::ostream& os, std::set<T>& set_var) { os << "{"; for (auto itr = set_var.begin(); itr !=
        set_var.end(); itr++) { os << *itr;++itr;if (itr != set_var.end()) os << ", ";itr--; }os << "}";return os; }
template <typename T, typename U> std::ostream& operator<<(std::ostream& os, std::map<T, U>& map_var) { os << "{";for (auto itr = map_var.begin
        (); itr != map_var.end(); itr++) { os << *itr;itr++;if (itr != map_var.end()) os << ", ";itr--; }os << "}";return os; }
void print() { std::cout << '\n'; }
template<class T, class... Ts>void print(const T& a, const Ts&... b) { std::cout << a; (std::cout << ... << (std::cout << ' ', b)); std::cout <<
        '\n'; }
void drop() { std::cout << '\n';exit(0); }
template<class T, class... Ts>void drop(const T& a, const Ts&... b) { std::cout << a; (std::cout << ... << (std::cout << ' ', b)); std::cout <<
        '\n';exit(0); }
#ifdef __LOCAL
void debug_out() { std::cerr << std::endl; }
template < class Head, class... Tail> void debug_out(Head H, Tail... T) { std::cerr << ' ' << H; debug_out(T...); }
#define debug(...) std::cerr << 'L' << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) std::cerr << 'L' << __LINE__ << " " << #x << " = " << (x) << std::endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif
#define rep1(a) for(long long i = 0; i < a; i++)
#define rep2(i, a) for(long long i = 0; i < a; i++)
#define rep3(i, a, b) for(long long i = a; i < b; i++)
#define rep4(i, a, b, c) for(long long i = a; i < b; i += c)
#define drep1(a) for(long long i = a-1; i >= 0; i--)
#define drep2(i, a) for(long long i = a-1; i >= 0; i--)
#define drep3(i, a, b) for(long long i = a-1; i >= b; i--)
#define drep4(i, a, b, c) for(long long i = a-1; i >= b; i -= c)
#define overload4(a, b, c, d, e, ...) e
#define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define drep(...) overload4(__VA_ARGS__, drep4, drep3, drep2, drep1)(__VA_ARGS__)
} // namespace tomo0608
int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 };
int dy[8] = { 0, 1, 0, -1, 1, -1, -1, 1 };
#define endl '\n'
namespace tomo0608 {
#define all(x) x.begin(),x.end()
template <class T = long long, class S> T SUM(const S& v) { return accumulate(all(v), T(0)); }
#define MIN(v) *min_element(all(v))
#define MAX(v) *max_element(all(v))
#define lb(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define ub(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) sort(all(x)), x.erase(unique(all(x)), x.end())
template <typename T> void zip(std::vector<T>& x) { std::vector<T> y = x;UNIQUE(y);for (int i = 0; i < x.size(); ++i) { x[i] = lb(y, x[i]); } }
template<class T> using priority_queue_rev = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T, class U> inline bool chmax(T& a, const U& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a, const U& b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline int count_between(std::vector<T>& a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
#define bit(n, k) ((n >> k) & 1) /*nk bit*/
int topbit(signed t) { return t == 0 ? -1 : 31 - __builtin_clz(t); }
int topbit(long long t) { return t == 0 ? -1 : 63 - __builtin_clzll(t); }
int lowbit(signed a) { return a == 0 ? 32 : __builtin_ctz(a); }
int lowbit(long long a) { return a == 0 ? 64 : __builtin_ctzll(a); }
template <typename T>T mypow(T x, long long n) { T ret = 1;while (n > 0) { if (n & 1)(ret *= x);(x *= x);n >>= 1; }return ret; }
}
//typedef atcoder::modint1000000007 mint;
typedef atcoder::modint998244353 mint;
using namespace atcoder;
using namespace std;
using namespace tomo0608;
#include <atcoder/fenwicktree>
const ll inf = 1e18;
struct Point {
// R^2
long long x, y;
Point(long long x = 0, long long y = 0) : x(x), y(y) {}
Point operator+(const Point& p)
{
return { x + p.x, y + p.y };
}
Point operator-(const Point& p)
{
return { x - p.x, y - p.y };
}
Point operator*(const long long k) {
return { k * x, k * y };
}
Point operator/(const long long k) {
assert(k);
return { x / k, y / k };
}
long long operator*(const Point& p) {
return x * p.x + y * p.y;
}
long long operator^(const Point& p) {
return x * p.y - y * p.x;
}
bool operator<(const Point& p) {
if (x < p.x)return true;
if (x > p.x)return false;
if (y < p.y)return true;
return false;
}
double getangle() {
// (0 <= angle <= 360)
if (y >= 0.0) {
double I = (long double)x / sqrt((*this) * (*this));
double angle = acos(I) * 180.0 / 3.14159265358979;
return angle;
}
else {
double I = (long double)x / sqrt((*this) * (*this));
double angle = acos(I) * 180.0 / 3.14159265358979;
return 360.0 - angle;
}
}
};
std::istream& operator>>(std::istream& is, Point& p) { is >> p.x >> p.y; return is; }
std::ostream& operator<<(std::ostream& os, const Point& p) { os << p.x << ' ' << p.y; return os; }
#define POINT(...) Point __VA_ARGS__; input(__VA_ARGS__)
typedef std::vector<Point> Polygon;
ll ip(Point v, Point w) {
return v.x * w.x + v.y * w.y;
}
ll up(Point v, Point w) {
return v.x * w.y - v.y * w.x;
}
void solve() {
LL(n);
V<Point> points(n);
rep(i, n)cin >> points[i];
ll ans = 0;
rep(i, n)rep(j, i + 1, n) {
Point v = points[j] - points[i];
ll max_sq = -inf, min_sq = inf;
rep(k, n) {
if (k == i || k == j)continue;
Point w = points[k] - points[i];
chmax(max_sq, up(v, w));
chmin(min_sq, up(v, w));
}
chmax(ans, max_sq - min_sq);
}
print(ans);
}
int main() {
std::cin.tie(0);
std::ios_base::sync_with_stdio(false);
std::cout << std::setprecision(20);
int codeforces = 1;
//cin >> codeforces;
while (codeforces--) {
solve();
}
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0