結果
問題 | No.3100 Parallel Translated |
ユーザー |
|
提出日時 | 2025-04-11 21:36:59 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 1,966 ms |
コンパイル使用メモリ | 197,396 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-04-11 21:37:03 |
合計ジャッジ時間 | 3,278 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
// https://onlinejudge.u-aizu.ac.jp/courses/library/4/CGL/all // 3_A, 3_B, 3_C #include <bits/stdc++.h> using namespace std; #include<atcoder/modint> using mint=atcoder::modint998244353; using Point = complex<mint>; using Polygon = vector<Point>; struct Line { Point a, b; Line(Point a, Point b) : a(a), b(b) {} }; struct Segment : Line { Segment(Point a, Point b) : Line(a, b) {} }; // 内積 mint dot(const Point &a, const Point &b) { return (a.real() * b.real() + a.imag() * b.imag()); } // 外積 mint cross(const Point &a, const Point &b) { return (a.real() * b.imag() - a.imag() * b.real()); } int main() { int N; cin >> N; Polygon poly(N); for (int i = 0; i < N; i++) { int x, y; cin >> x >> y; poly[i] = Point(x, y); } mint ans = 0; for (int i = 0; i < N; i++) { ans += cross(poly[i], poly[(i + 1) % N]); } ans /= 2; cout << ans.val() << endl; }