結果
| 問題 | No.3437 [Cherry 8th Tune C] Silhouette |
| コンテスト | |
| ユーザー |
SnowBeenDiding
|
| 提出日時 | 2026-01-23 22:19:42 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,220 bytes |
| 記録 | |
| コンパイル時間 | 11,205 ms |
| コンパイル使用メモリ | 423,056 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-23 22:21:24 |
| 合計ジャッジ時間 | 13,596 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | WA * 11 |
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, a, b) for (ll i = (ll)(a); i < (ll)(b); i++)
using namespace atcoder;
using namespace std;
typedef long long ll;
using mint = modint998244353;
struct Fraction {
/**
* p / q
* https://atcoder.jp/contests/abc390/submissions/72321330
*/
mint p, q;
Fraction(ll P = 0, ll Q = 1) : p(P), q(Q) {}
Fraction(mint P, mint Q) : p(P), q(Q) {}
Fraction operator+(const Fraction &other) const {
return Fraction(p * other.q + q * other.p, q * other.q);
}
Fraction operator-(const Fraction &other) const {
return Fraction(p * other.q - q * other.p, q * other.q);
}
Fraction operator*(const Fraction &other) const {
return Fraction(p * other.p, q * other.q);
}
Fraction operator/(const Fraction &other) const {
return Fraction(p * other.q, q * other.p);
}
};
pair<Fraction, Fraction> f(tuple<ll, ll, ll> a, tuple<ll, ll, ll> b) {
auto [ax, ay, az] = a;
auto [bx, by, bz] = b;
Fraction kake(az, az - bz);
auto dx = ax - bx;
auto dy = ay - by;
auto dz = az - bz;
pair<Fraction, Fraction> ret = {(Fraction)ax + (Fraction)dx * kake,
(Fraction)ay + (Fraction)dy * kake};
return ret;
}
void input(tuple<ll, ll, ll> &A) {
ll x, y, z;
cin >> x >> y >> z;
A = {x, y, z};
}
mint g(pair<Fraction, Fraction> a, pair<Fraction, Fraction> b,
pair<Fraction, Fraction> c) {
auto [ax, ay] = a;
auto [bx, by] = b;
auto [cx, cy] = c;
Fraction adx = ax - cx, ady = ay - cy;
Fraction bdx = bx - cx, bdy = by - cy;
Fraction t = adx * bdy - ady * bdx;
mint ret = -t.p / t.q / 2;
return ret;
}
void solve() {
tuple<ll, ll, ll> A, B, C, P;
input(A);
input(B);
input(C);
input(P);
auto p = f(P, A);
auto q = f(P, B);
auto r = f(P, C);
mint ans = g(p, q, r);
cout << ans.val() << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int t;
cin >> t;
while (t--) solve();
}
SnowBeenDiding