AtCoder Regular Contest 148
F
998244353 → 1000000007
AtCoder
⌀ 3621
原题
← E→
翻译中…

Problem Statement

翻译中…

This problem is output-only.

翻译中…

We have a programming language equipped with the following operations of unsigned 64-bit integers: addition, multiplication, and a modulo operation where the divisor is $998244353$. Write a program that performs multiplication modulo $1000000007$ in this language.

翻译中…

More formally, write a program that receives integers $a$ and $b$ between $0$ and $1000000006$ and computes $a \times b \bmod{1000000007}$ under the following Specification and Format.

翻译中…

Specification

翻译中…

The program can handle $26$ variables represented by uppercase English letters: $A, B, \dots, Z$. Each variable can hold an integer value between $0$ and $2^{64}-1$ (inclusive). Below, such a value is called unsigned 64-bit integer. At the start of the execution of the program, $A$ is assigned an integer $a$, $B$ is assigned an integer $b$, and the other variables are assigned $0$. At the end of the execution, $C$ must hold $a \times b \bmod{1000000007}$.

翻译中…

Format

翻译中…

The $1$-st line of the program contains an integer $N$ $(1 \leq N \leq 100)$ representing the number of instructions in the program. The $2$-nd through $(N + 1)$-th lines contain $N$ instructions. The instructions are executed one by one from top to bottom. Each instruction is in one of the following three forms.

翻译中…
  • add x y z
  • Assign $(y + z) \bmod{2^{64}}$ to $x$, where $x$ is a variable, and each of $y$ and $z$ is a variable or an unsigned 64-bit integer.
  • mul x y z
  • Assign $(y \times z) \bmod{2^{64}}$ to $x$, where $x$ is a variable, and each of $y$ and $z$ is a variable or an unsigned 64-bit integer.
  • rem x y
  • Assign $y \bmod{998244353}$ to $x$, where $x$ is a variable, and $y$ is a variable or an unsigned 64-bit integer.
翻译中…

Input

翻译中…

The input given from Standard Input is empty.

翻译中…

Output

翻译中…

Print a program under the Specification and Format.

翻译中…

Judging

翻译中…

If the submitted program is malformed, the verdict will be indeterminate. If the submitted program is well-formed, for each test case, the judge will execute it against $10^4$ pairs of integers $(a, b)$ $(0 \leq a, b \leq 1000000006)$ independently. (These pairs are prepared beforehand and constant for each test case.) If the variable $C$ holds $a \times b \bmod{1000000007}$ at the end of the execution for all pairs $(a, b)$, the verdict will be AC; otherwise, it will be WA.

翻译中…

Sample Output

翻译中…

Here is an example of a well-formed program. (The Specification is not satisfied, so it will be judged as WA if submitted.)

翻译中…

5
mul C A B
rem C C
add A A 10
add D 2 B
add E 1 0

翻译中…

At the end of the execution of this program, the variables will hold the following values.

翻译中…
  • $A$: $a + 10$
  • $B$: $b$
  • $C$: $a \times b \bmod{998244353}$
  • $D$: $b + 2$
  • $E$: $1$
  • The others: $0$
翻译中…
题目信息
题号
arc148_f
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。