結果
| 問題 |
No.3100 Parallel Translated
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-11 22:33:41 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,540 bytes |
| コンパイル時間 | 7,232 ms |
| コンパイル使用メモリ | 352,048 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-04-11 22:33:51 |
| 合計ジャッジ時間 | 8,649 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const ll MOD = 998244353;
const double INFD = 1.0E10;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, -1, 0, 1};
//const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
//const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using Pair = pair<ll, ll>;
using Graph = vector<vector<ll, ll> >;
using mint = atcoder::modint998244353;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int n; cin >> n;
vector<ll> x(n), y(n);
for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
int idx = 0, val = INF;
for (int i = 0; i < n; i++){
if (x[i] < val){
idx = i;
val = x[i];
}
}
//cerr << idx << " " << x[idx] << " " << y[idx] << endl;
vector<pair<ll, ll>> xy;
for (int i = 0; i < n; i++){
if (i != idx) xy.emplace_back(x[i] - x[idx], y[i] - y[idx]);
}
sort(xy.begin(), xy.end(), [](const auto &p1, const auto &p2){
return atan2l(p1.second, p1.first) < atan2l(p2.second, p2.first);
});
mint ans = 0;
for (int i = 0; i < n - 2; i++){
auto [x1, y1] = xy[i];
auto [x2, y2] = xy[i + 1];
//cerr << x1 << y1 << x2 << y2 << " " << abs(x1 * y2 - x2 * y1) * mint(2).inv().val() << endl;;
ans += mint(2).inv() * abs(x1 * y2 - x2 * y1);
}
cout << ans.val() << endl;
return 0;
}