問題一覧 > 通常問題

No.3437 [Cherry 8th Tune C] Silhouette

レベル : / AI推定難易度 : 1500 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (解説公開後に AC するまで非表示) / 解いたユーザー数 18
作問者 : 👑 Kazun / テスター : 👑 p-adic
お気に入りにしたユーザー ProblemId : 10674 / 自分の提出
問題文最終更新日: 2026-10-22 00:08:22
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 491 Go on Back!! (順位表) の他の問題:

Problem Visual

▶ Open to reveal the problem visual

Problem Statement

There are $3$ points $A, B, C$ in $xyz$ space. The coordinates of $A, B, C$ are $(a_x, a_y, a_z), (b_x, b_y, b_z), (c_x, c_y, c_z)$, respectively.

Let $S$ be the area of the shadow of triangle $ABC$ on the $xy$ plane cast by a point light source located at coordinates $(l_x, l_y, l_z)$. If the shadow is a line segment or a point, let $S = 0$.

Find $S \pmod{998244353}$.

Solve $T$ test cases.

Notes

Under the constraints of this problem, it can be proved that there exists a pair of integers $(\alpha, \beta)$ satisfying the following.

  • $\beta$ is not a multiple of $998244353$.
  • $\beta \times S = \alpha$.

For a pair of integers $(\alpha, \beta)$ satisfying this condition, there exists exactly one integer $\gamma$ satisfying $$\beta \times \gamma \equiv \alpha \pmod{998244353}$$ that is at least $0$ and less than $998244353$. Using this integer $\gamma$, we define $S \pmod{998244353} := \gamma$.

Note that although there can be many pairs of integers $(\alpha, \beta)$ satisfying the condition, it can be proved that $\gamma$ does not depend on the choice of $\alpha, \beta$ and is determined only by $E$.

Constraints

  • $1 \leq T \leq 10^5$.
  • Constraints for each test case
    • $\lvert a_x \rvert \leq 10^6$
    • $\lvert b_x \rvert \leq 10^6$
    • $\lvert c_x \rvert \leq 10^6$
    • $\lvert a_y \rvert \leq 10^6$
    • $\lvert b_y \rvert \leq 10^6$
    • $\lvert c_y \rvert \leq 10^6$
    • $1 \leq a_z \leq 10^6$
    • $1 \leq b_z \leq 10^6$
    • $1 \leq c_z \leq 10^6$
    • $\lvert l_x \rvert \leq 10^6$.
    • $\lvert l_y \rvert \leq 10^6$.
    • $1 \leq l_z \leq 10^6$.
    • $\max(a_z, b_z, c_z) \leq l_z$
    • $A, B, C$ are not $3$ collinear points.
  • All input values are integers.

Input

$T$
${\rm Testcase}_1$
$\vdots$
${\rm Testcase}_T$

Each test case is given in the following format.

$a_x$ $a_y$ $a_z$
$b_x$ $b_y$ $b_z$
$c_x$ $c_y$ $c_z$
$l_x$ $l_y$ $l_z$

Output

The output consists of $T$ lines. On line $t~(1 \leq t\leq T)$, print the answer for test case $t$.

Do not forget the newline at the end as well.

Sample

Sample 1
Input
3
9 -2 3
3 0 4
4 5 2
1 2 5
3 -1 3
0 9 4
7 -3 9
13 -6 18
8 29 2001
8 18 2004
2 17 2003
4 6 4646
Output
75
0
917747442
  • [Test case $1$]

    The shadow of triangle $P_1 P_2 P_3$ on the $xy$ plane is the triangle with the $3$ vertices $(6, 7), (21, -8), (11, -8)$. The area $S$ of this shadow triangle is $S = 75$.

  • [Test case $2$]

    The shadow of triangle $P_1 P_2 P_3$ on the $xy$ plane is the line segment with endpoints $(1, 0), \left(-\dfrac{26}{7}, \dfrac{93}{7} \right)$. Therefore, $S = 0$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。