結果

問題 No.3100 Parallel Translated
ユーザー shobonvip
提出日時 2025-01-21 05:49:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 2,109 ms
コンパイル使用メモリ 196,720 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-11 20:50:08
合計ジャッジ時間 2,966 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/modint>
typedef atcoder::modint998244353 mint;

int main() {
	int n; cin >> n;
	vector<long long> x(n), y(n);
	for (int i=0; i<n; i++) {
		cin >> x[i] >> y[i];
	}
	mint ans = 0;
	for (int i=0; i<n-2; i++) {
		long long ax = x[i+1] - x[0];
		long long bx = x[i+2] - x[0];
		long long ay = y[i+1] - y[0];
		long long by = y[i+2] - y[0];
		ans += abs(ax * by - bx * ay);
	}
	ans *= mint(2).inv();
	cout << ans.val() << endl;
}
0