結果
| 問題 |
No.3100 Parallel Translated
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-12 07:12:53 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,726 bytes |
| コンパイル時間 | 4,386 ms |
| コンパイル使用メモリ | 226,736 KB |
| 実行使用メモリ | 7,720 KB |
| 最終ジャッジ日時 | 2025-04-12 07:12:59 |
| 合計ジャッジ時間 | 5,758 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, p, n) for (ll i = p; i < (ll)(n); i++)
#define rep2(i, p, n) for (ll i = p; i >= (ll)(n); i--)
using namespace std;
using ll = long long;
using ld = long double;
const double pi = 3.141592653589793;
const long long inf = 2 * 1e9;
const long long linf = 4 * 1e18;
const ll mod1 = 1000000007;
const ll mod2 = 998244353;
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return 1;
}
return 0;
}
// atcoder
#include <atcoder/all>
using namespace atcoder;
using mint1 = modint1000000007;
using mint2 = modint998244353;
vector<pair<ll, ll>> base = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
template <typename T>
struct area
{
vector<pair<T, T>> point;
T calc()
{
T res = 0;
pair<T, T> A, B, C;
A = point.at(0);
rep(i, 0, point.size())
{
B = point.at(i);
C = point.at((i + 1) % point.size());
T temp = 0;
temp += A.first * B.second;
temp += B.first * C.second;
temp += C.first * A.second;
temp -= B.first * A.second;
temp -= C.first * B.second;
temp -= A.first * C.second;
res += temp / 2;
}
return res;
}
};
int main()
{
//////////////////
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
//////////////////
ll N;
cin >> N;
area<mint2> A;
rep(i, 0, N)
{
ll x, y;
cin >> x >> y;
A.point.push_back({x, y});
}
cout << A.calc().val();
}