No.1476 esreveR dna esreveR
タグ : / 解いたユーザー数 229
作問者 :
PCTprobability
/ テスター :
nok0
Problem Statement
There is an $N×N$ matrix. Let $a_{i,j}$ denote the value in row $i$, column $j$ of this matrix.
Initially, $a_{i,i}=1$ for each positive integer $i$ satisfying $1 \le i \le N$. For all other elements, $a_{i,j}=0\ (i \neq j)$.
You may perform the following operations any number of times, $0$ or more, in any order.
- Choose a positive integer $i$ satisfying $1 \le i \le N$ and reverse row $i$. More formally, for each positive integer $j$ satisfying $1 \le j \le N$, replace $a_{i,j}$ with $a_{i,N-j+1}$.
- Choose a positive integer $j$ satisfying $1 \le j \le N$ and reverse column $j$. More formally, for each positive integer $i$ satisfying $1 \le i \le N$, replace $a_{i,j}$ with $a_{N-i+1,j}$.
Find the number of matrices that can be obtained in the end.
Since the answer can be very large, find it modulo $998244353$.
Input
$N$
- All inputs are integers.
- $1 \le N \le 10^{18}$
Output
Find the number of matrices that can be obtained in the end.
Since the answer can be very large, find it modulo $998244353$.
Sample
Sample 1
Input
2
Output
6
Initially, the matrix is as follows.
1 0
0 1
For $N=2$, every matrix having $2$ each of $0,1$ as elements can be obtained, and no other matrix can be obtained, so print $6$.
For example, by reversing row $1$, the following matrix can be obtained.
0 1
0 1
Sample 2
Input
2021
Output
654946506
Print the answer modulo $998244353$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。