結果

問題 No.3437 [Cherry 8th Tune C] Silhouette
コンテスト
ユーザー areik
提出日時 2026-01-23 22:54:31
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 255 ms / 2,000 ms
コード長 1,242 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,757 ms
コンパイル使用メモリ 279,256 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-23 22:55:02
合計ジャッジ時間 8,588 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;

using i32 = int;
using i64 = long long;
using i128 = __int128_t;
using f64 = double;
using p2 = pair<i64, i64>;
using el = tuple<i64, i64, i64>;
using mint = atcoder::modint998244353;;

void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
  _main();
}

struct Pose {
  i128 x, y, z;
  static Pose input() {
    i64 xx, yy, zz;
    cin >> xx >> yy >> zz;
    return Pose{xx, yy, zz};
  }
};
void _main() {
  i64 tt;
  cin >> tt;
  for (;tt--;) {
    vector<Pose> v(3), u(3);
    for (i64 i = 0; i < 3; i++) {
      v[i] = Pose::input();
    }
    Pose l = Pose::input();
    i128 a = l.z - v[0].z;
    i128 b = l.z - v[1].z;
    i128 c = l.z - v[2].z;
    i128 k = a * b * c;
    vector<i128> kk = {a, b, c};
    for (i64 i = 0; i < 3; i++) {
      u[i] = Pose{-l.x * v[i].z + l.z * v[i].x, -l.y * v[i].z + l.z * v[i].y, 0};
    }
    i128 s = ((u[0].x * c - u[2].x * a) * (u[1].y * c - u[2].y * b)
      - (u[1].x * c - u[2].x * b) * (u[0].y * c - u[2].y * a));
    if (s < 0) s = -s;
    mint ans = mint(s);
    ans /= 2;
    ans /= a;
    ans /= b;
    ans /= c;
    ans /= c;
    cout << ans.val() << "\n";
  }
}
0